/* -----------------------------
   Global
----------------------------- */

body {
    margin: 0;
    font-family: var(--app-font-family);
    background-color: #f8f8f8;
    min-height: 100vh;
}

body:not(.embed-view):not(.tb-sheet-embedded):not(.dimension-sheet-embedded) {
    display: flex;
    flex-direction: column;
}

body > .pricing-content,
body > .app-layout {
    flex: 1 0 auto;
}

:root {
    --app-font-family: "Roboto", Arial, sans-serif;
    --navbar-offset: 3.5rem;
    --navbar-control-height: 24px;
    --navbar-divider-height: 20px;
    --tab-strip-height: 2.05rem;
    --top-offset: var(--navbar-offset);
    --sidebar-width: 184px;
}

button,
input,
select,
textarea {
    font-family: var(--app-font-family);
}

body.has-tab-strip {
    --top-offset: calc(var(--navbar-offset) + var(--tab-strip-height));
}

body.session-expired-locked {
    overflow: hidden;
}

.app-hidden-form {
    display: none !important;
}

.app-hidden-row,
.app-hidden-block {
    display: none !important;
}

.app-inline-form {
    display: inline;
}

.app-full-width {
    width: 100%;
    box-sizing: border-box;
}

.app-page-head-row,
.app-toolbar-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.app-inline-actions,
.app-form-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.app-form-actions {
    margin-top: 14px;
}

.app-form-actions-spacious {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.app-flex-end-wrap {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.app-filter-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.app-page-title-flush {
    margin-bottom: 0;
}

.app-section-title-flush {
    margin-top: 0;
}

.app-muted-tight {
    margin-top: 0.25rem;
}

.app-muted-top-none {
    margin-top: 0;
}

.app-muted-top-xs {
    margin-top: 0.25rem;
}

.app-muted-top-sm {
    margin-top: 0.45rem;
}

.app-muted-top-md {
    margin-top: 0.75rem;
}

.app-muted-top-lg {
    margin-top: 0.8rem;
}

.app-muted-bottom-none {
    margin-bottom: 0;
}

.app-card-top {
    margin-top: 1rem;
}

.app-card-top-sm {
    margin-top: 16px;
}

.app-card-narrow {
    max-width: 860px;
}

.app-card-wide {
    max-width: 880px;
}

.app-card-wide.app-card-top {
    margin-top: 1rem;
}

.app-warning-card {
    background: #fff7e6;
    border: 1px solid #ffe2a8;
    margin-top: 0.75rem;
}

.app-narrow-form {
    max-width: 520px;
    margin-top: 14px;
}

.app-danger-alert {
    border: 1px solid #fecaca;
    background: #fef2f2;
    padding: 0.75rem;
    border-radius: 8px;
    margin: 0.75rem 0;
}

.app-danger-title {
    color: #991b1b;
}

.app-auth-panel {
    padding: 2rem;
    max-width: 500px;
}

.app-inline-block-gap {
    margin: 12px 0;
}

.app-remove-offset {
    margin-left: 0.5rem;
}

.app-table-col-number {
    width: 140px;
}

.app-table-col-actions {
    width: 220px;
}

.app-table-col-xs {
    width: 90px;
}

.app-table-col-sm {
    width: 100px;
}

.app-table-col-md {
    width: 110px;
}

.app-table-col-lg {
    width: 160px;
}

.app-table-col-xl {
    width: 220px;
}

.app-select-inline {
    width: auto;
    display: inline-block;
    min-width: 220px;
}

.app-select-wide {
    min-width: 280px;
    padding: 0.45rem 0.55rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
}

.app-windowed-table-scroll {
    overflow: auto;
    max-height: clamp(320px, 65vh, 760px);
    scrollbar-gutter: stable;
}

.app-mt-xs {
    margin-top: 4px;
}

.app-mt-sm {
    margin-top: 10px;
}

.app-mt-md {
    margin-top: 1rem;
}

.app-mt-form {
    margin-top: 14px;
}

.app-mt-xl {
    margin-top: 20px;
}

.app-mt-neg-sm {
    margin-top: -0.25rem;
}

.app-mt-neg-xs {
    margin-top: -0.2rem;
}

.app-mb-none {
    margin-bottom: 0;
}

.app-mb-sm {
    margin-bottom: 0.4rem;
}

.app-label-strong {
    font-weight: 700;
}

.app-opacity-muted {
    opacity: 0.75;
}

.embed-view {
    margin: 0;
    min-height: 100%;
    padding: 0.6rem 0.8rem;
    box-sizing: border-box;
    background: #f8fafc;
}

html:has(body.embed-view) {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: #f8fafc;
}

body.tb-sheet-embedded {
    height: 100%;
    overflow: hidden;
    padding: 0.35rem 0.55rem 0 !important;
}

html:has(body.tb-sheet-embedded) {
    height: 100%;
    overflow: hidden;
}

body.dimension-sheet-embedded {
    height: 100%;
    overflow: hidden;
    padding: 0.45rem 0.55rem 0 !important;
}

html:has(body.dimension-sheet-embedded) {
    height: 100%;
    overflow: hidden;
}

.refresh-history-progress-fill {
    width: var(--refresh-progress-pct, 0%);
}

.saas-home-billing-warning {
    color: #991b1b !important;
    font-weight: 700;
}

.workflow-node.has-billing-warning .node-logo {
    border-color: #fca5a5;
    background: #fef2f2;
    color: #b91c1c;
}

.workflow-node.has-billing-warning .node-logo::after {
    content: "!";
    position: absolute;
    top: -0.46rem;
    right: -0.46rem;
    width: 1rem;
    height: 1rem;
    border: 2px solid #ffffff;
    border-radius: 999px;
    background: #dc2626;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(153, 27, 27, 0.3);
}

.workflow-node.has-billing-warning:hover .node-logo {
    border-color: #ef4444;
    background: #fee2e2;
    color: #991b1b;
}

.org-subscription-section.is-canceling {
    border-color: #fca5a5;
    background: #fff7f7;
    box-shadow: 0 10px 28px rgba(153, 27, 27, 0.12);
}

.org-subscription-section.is-canceling .org-subscription-head h2 {
    color: #991b1b;
}

.org-subscription-section.is-canceling .org-subscription-head p {
    color: #7f1d1d;
}

.org-subscription-cancel-alert {
    margin-top: 0.72rem;
    border: 1px solid #fecaca;
    border-radius: 8px;
    background: #fef2f2;
    color: #7f1d1d;
    padding: 0.68rem 0.78rem;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.4;
}

/* Give content room below fixed navbar */
.page-wrap {
    padding-top: var(--top-offset);
}

.session-expired-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.46);
    backdrop-filter: blur(2px);
}

.session-expired-overlay[hidden] {
    display: none !important;
}

.session-expired-dialog {
    width: min(100%, 360px);
    box-sizing: border-box;
    padding: 1.15rem 1.2rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 22px 55px rgba(15, 23, 42, 0.22);
}

.session-expired-title {
    margin: 0;
    color: #111827;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25;
}

.session-expired-copy {
    margin: 0.45rem 0 1rem;
    color: #4b5563;
    font-size: 0.92rem;
    line-height: 1.45;
}

.session-expired-actions {
    display: flex;
    justify-content: flex-end;
}

.session-expired-ok {
    border: none;
    border-radius: 7px;
    background: #4da768;
    color: #ffffff;
    cursor: pointer;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.2;
    padding: 0.5rem 0.95rem;
}

.session-expired-ok:hover,
.session-expired-ok:focus {
    background: #3f9a5f;
}

.session-expired-ok:focus-visible {
    outline: 2px solid rgba(77, 167, 104, 0.35);
    outline-offset: 2px;
}

.refresh-draft-warning-dialog {
    position: fixed;
    inset: 0;
    z-index: 9400;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.26);
    backdrop-filter: blur(1px);
}

.refresh-draft-warning-dialog[hidden] {
    display: none !important;
}

.refresh-draft-warning-panel {
    width: min(720px, 100%);
    max-height: calc(100vh - 2rem);
    overflow: auto;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
}

.refresh-draft-warning-head {
    display: flex;
    gap: 0.85rem;
    padding: 1.15rem 1.2rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.refresh-draft-warning-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    border: 1px solid #cbd5e1;
    border-radius: 50%;
    background: #f8fafc;
    color: #475569;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
}

.refresh-draft-warning-eyebrow {
    color: #64748b;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.2;
    text-transform: uppercase;
}

.refresh-draft-warning-head h2 {
    margin: 0.18rem 0 0;
    color: #0f172a;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.22;
}

.refresh-draft-warning-head p {
    margin: 0.45rem 0 0;
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.45;
}

.refresh-draft-warning-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    padding: 0.85rem 1.2rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.refresh-draft-warning-metrics div {
    display: grid;
    gap: 0.18rem;
    min-width: 0;
}

.refresh-draft-warning-metrics strong {
    color: #111827;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.2;
}

.refresh-draft-warning-metrics span {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.25;
}

.refresh-draft-warning-list-wrap {
    padding: 0.85rem 1.2rem 0.45rem;
}

.refresh-draft-warning-list-head,
.refresh-draft-warning-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 4.5rem 4.5rem;
    gap: 0.65rem;
    align-items: center;
}

.refresh-draft-warning-list-head {
    padding: 0 0 0.45rem;
    color: #64748b;
    font-size: 0.74rem;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
}

.refresh-draft-warning-row {
    min-height: 3rem;
    padding: 0.58rem 0;
    border-top: 1px solid #e5e7eb;
}

.refresh-draft-warning-main {
    display: grid;
    gap: 0.2rem;
    min-width: 0;
}

.refresh-draft-warning-main a,
.refresh-draft-warning-main span {
    color: #0f172a;
    font-size: 0.88rem;
    font-weight: 800;
    line-height: 1.28;
    overflow-wrap: anywhere;
}

.refresh-draft-warning-main a {
    text-decoration: none;
}

.refresh-draft-warning-main a:hover,
.refresh-draft-warning-main a:focus {
    color: #166534;
    text-decoration: underline;
}

.refresh-draft-warning-main small {
    color: #64748b;
    font-size: 0.78rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.refresh-draft-warning-number {
    color: #334155;
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.2;
    text-align: right;
}

.refresh-draft-warning-more {
    margin: 0 1.2rem 0.9rem;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.35;
}

.refresh-draft-warning-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6rem;
    padding: 0.9rem 1.2rem 1rem;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}

.refresh-draft-warning-secondary,
.refresh-draft-warning-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.25rem;
    box-sizing: border-box;
    border-radius: 7px;
    cursor: pointer;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 800;
    line-height: 1.2;
    padding: 0.55rem 0.9rem;
}

.refresh-draft-warning-secondary {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #0f172a;
}

.refresh-draft-warning-secondary:hover,
.refresh-draft-warning-secondary:focus {
    background: #f8fafc;
}

.refresh-draft-warning-primary {
    border: 1px solid #166534;
    background: #166534;
    color: #ffffff;
}

.refresh-draft-warning-primary:hover,
.refresh-draft-warning-primary:focus {
    border-color: #14532d;
    background: #14532d;
}

.refresh-draft-warning-secondary:focus-visible,
.refresh-draft-warning-primary:focus-visible,
.refresh-draft-warning-main a:focus-visible {
    outline: 2px solid rgba(22, 101, 52, 0.24);
    outline-offset: 2px;
}

@media (max-width: 640px) {
    .refresh-draft-warning-head {
        padding: 1rem;
    }

    .refresh-draft-warning-metrics {
        grid-template-columns: 1fr;
        padding: 0.8rem 1rem;
    }

    .refresh-draft-warning-list-wrap {
        padding: 0.8rem 1rem 0.4rem;
    }

    .refresh-draft-warning-list-head,
    .refresh-draft-warning-row {
        grid-template-columns: minmax(0, 1fr) 3.5rem 3.5rem;
        gap: 0.45rem;
    }

    .refresh-draft-warning-actions {
        align-items: stretch;
        flex-direction: column-reverse;
        padding: 0.85rem 1rem 1rem;
    }

    .refresh-draft-warning-secondary,
    .refresh-draft-warning-primary {
        width: 100%;
    }
}

/* -----------------------------
   Top Navbar
----------------------------- */

.navbar {
    background-color: #4da768;
    color: white;
    padding: 0.62rem 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    box-sizing: border-box;
    border-bottom: none;
    min-width: 0;
}

.navbar a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    padding: 0 10px;
    transition: opacity 0.2s ease-in-out;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 auto;
    min-width: 0;
}

.navbar-right-tools {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.48rem;
    flex: 1 1 auto;
    min-width: 0;
}

.navbar-right-divider {
    display: none;
}

.navbar-right-divider::before {
    content: none;
}

.navbar .navbar-signup-pill,
.navbar .navbar-signup-pill:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.7rem;
    padding: 0.25rem 0.78rem;
    border-radius: 999px;
    background: #ffffff;
    color: #2f8550;
    line-height: 1;
}

.navbar .navbar-signup-pill:hover,
.navbar .navbar-signup-pill:focus {
    background: #f4fbf6;
    color: #2f8550;
    opacity: 1;
}

.navbar-link-button {
    border: none;
    background: none;
    color: white;
    text-decoration: none;
    font-weight: bold;
    padding: 0 10px;
    font-size: inherit;
    font-family: inherit;
    line-height: inherit;
    cursor: pointer;
    transition: opacity 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    appearance: none;
    -webkit-appearance: none;
}

.navbar-link-button:hover:not(.is-disabled):not(.is-running) {
    opacity: 0.8;
}

.navbar-link-button,
.navbar-link-button:hover,
.navbar-link-button:focus,
.navbar-link-button:active,
.navbar-link-button:visited {
    color: #ffffff;
}

.navbar-link-button.is-disabled {
    opacity: 0.62;
    cursor: not-allowed;
    pointer-events: none;
}

.navbar-link-button.is-running {
    opacity: 0.9;
    cursor: default;
    pointer-events: none;
}

.refresh-nav-spinner {
    width: 0.78rem;
    height: 0.78rem;
}

.navbar a:hover {
    opacity: 0.8;
}

.navbar a.navbar-link-disabled,
.navbar a.navbar-link-disabled:hover,
.navbar a.navbar-link-disabled:focus {
    opacity: 0.55;
    cursor: not-allowed;
}

.navbar-icon-menu {
    display: inline-flex;
    align-items: center;
    position: relative;
    flex: 0 0 auto;
    min-width: 0;
}

.navbar-icon-trigger {
    border: none;
    background: transparent;
    color: #ffffff;
    width: var(--navbar-control-height);
    height: var(--navbar-control-height);
    padding: 0;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease-in-out;
}

.navbar-icon-trigger:hover,
.navbar-icon-trigger:focus,
.navbar-icon-trigger:active,
.navbar-icon-menu.is-open .navbar-icon-trigger {
    opacity: 0.8;
    color: #ffffff;
}

.navbar-icon-trigger:focus-visible {
    outline: none;
}

.navbar-icon-svg {
    width: 1.14rem;
    height: 1.14rem;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.navbar-icon-menu-content {
    display: none;
    position: absolute;
    top: calc(100% + 0.3rem);
    right: 0;
    min-width: 220px;
    background: #eceff2;
    color: #374151;
    box-shadow: 0 12px 24px rgba(22, 101, 52, 0.16);
    border: 1px solid #4da768;
    border-radius: 8px;
    z-index: 2000;
    text-align: left;
    overflow: hidden;
}

.navbar-icon-menu-content[hidden] {
    display: none !important;
}

.navbar-icon-menu.is-open .navbar-icon-menu-content {
    display: block;
}

.navbar-refresh-menu {
    min-width: 286px;
    width: auto;
    padding: 0;
}

.refresh-menu-title {
    padding: 0.58rem 0.62rem 0.46rem;
    border-bottom: 1px solid #e5e7eb;
    color: #111827;
    font-size: 0.86rem;
    font-weight: 800;
    line-height: 1.2;
}

.refresh-menu-active {
    display: grid;
    gap: 0.38rem;
    margin: 0.42rem 0.42rem 0;
    padding: 0.52rem;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #f9fafb;
}

.refresh-menu-active[hidden] {
    display: none !important;
}

.refresh-menu-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    color: #111827;
    font-size: 0.82rem;
}

.refresh-menu-status span {
    color: #166534;
    font-size: 0.78rem;
    font-weight: 800;
}

.refresh-menu-progress-bar {
    height: 0.48rem;
    border-radius: 999px;
    background: #dbe3ef;
    overflow: hidden;
}

.refresh-menu-progress-bar div {
    width: 0%;
    height: 100%;
    background: #16a34a;
    transition: width 0.25s ease;
}

.refresh-menu-step {
    color: #475569;
    font-size: 0.78rem;
    line-height: 1.3;
}

.refresh-step-list {
    display: grid;
    gap: 0.3rem;
    margin-top: 0.5rem;
}

.refresh-step-list[hidden] {
    display: none !important;
}

.refresh-menu-step-list {
    max-height: 10rem;
    overflow: auto;
    padding-right: 0.15rem;
}

.refresh-step-item {
    display: grid;
    grid-template-columns: 0.85rem minmax(0, 1fr);
    gap: 0.42rem;
    align-items: start;
    color: #374151;
}

.refresh-step-marker {
    width: 0.48rem;
    height: 0.48rem;
    margin-top: 0.28rem;
    border-radius: 999px;
    background: #cbd5e1;
    box-shadow: 0 0 0 2px #f8fafc;
}

.refresh-step-item.status-active .refresh-step-marker {
    background: #2563eb;
    box-shadow: 0 0 0 2px #dbeafe;
}

.refresh-step-item.status-complete .refresh-step-marker {
    background: #16a34a;
    box-shadow: 0 0 0 2px #dcfce7;
}

.refresh-step-item.status-warning .refresh-step-marker {
    background: #d97706;
    box-shadow: 0 0 0 2px #fef3c7;
}

.refresh-step-item.status-failed .refresh-step-marker {
    background: #dc2626;
    box-shadow: 0 0 0 2px #fee2e2;
}

.refresh-step-item.status-cancelled .refresh-step-marker {
    background: #64748b;
    box-shadow: 0 0 0 2px #e2e8f0;
}

.refresh-step-text {
    min-width: 0;
    display: grid;
    gap: 0.04rem;
}

.refresh-step-text strong {
    color: #111827;
    font-size: 0.77rem;
    line-height: 1.25;
}

.refresh-step-text small {
    color: #64748b;
    font-size: 0.72rem;
    line-height: 1.25;
}

.refresh-menu-actions {
    display: grid;
    gap: 0.24rem;
    padding: 0.42rem;
}

.refresh-menu-start-wrap {
    border-bottom: 1px solid #e5e7eb;
}

.refresh-menu-running-entry {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.58rem;
    min-height: 2.35rem;
    padding: 0.26rem 0.1rem;
}

.refresh-menu-running-entry[hidden] {
    display: none !important;
}

.refresh-spinner-menu {
    width: 1rem;
    height: 1rem;
    border-color: rgba(22, 101, 52, 0.22);
    border-top-color: #166534;
}

.refresh-menu-running-copy {
    min-width: 0;
    display: grid;
    gap: 0.05rem;
}

.refresh-menu-running-copy strong {
    color: #111827;
    font-size: 0.82rem;
    line-height: 1.2;
}

.refresh-menu-running-copy span {
    color: #64748b;
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.refresh-menu-view-active {
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    background: #f0fdf4;
    color: #166534;
    font-size: 0.76rem;
    font-weight: 800;
    line-height: 1;
    padding: 0.42rem 0.52rem;
    text-decoration: none;
    white-space: nowrap;
}

.refresh-menu-view-active:hover,
.refresh-menu-view-active:focus {
    border-color: #86efac;
    background: #dcfce7;
    color: #14532d;
    text-decoration: none;
}

.refresh-menu-split-start {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 2.25rem;
    align-items: stretch;
}

.refresh-menu-split-start[hidden] {
    display: none !important;
}

.refresh-menu-mode-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 2.15rem;
    border: 1px solid #1f7a43;
    border-left: 0;
    border-radius: 0 7px 7px 0;
    background: #1b6f3c;
    color: #ffffff;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.refresh-menu-mode-toggle span {
    position: relative;
    display: block;
    width: 0.7rem;
    height: 0.44rem;
    border: 0;
    transition: transform 0.14s ease;
}

.refresh-menu-mode-toggle span::before,
.refresh-menu-mode-toggle span::after {
    content: "";
    position: absolute;
    top: 0.2rem;
    width: 0.43rem;
    height: 0.12rem;
    border-radius: 999px;
    background: currentColor;
}

.refresh-menu-mode-toggle span::before {
    left: 0;
    transform: rotate(42deg);
}

.refresh-menu-mode-toggle span::after {
    right: 0;
    transform: rotate(-42deg);
}

.refresh-menu-mode-toggle.is-open span {
    transform: rotate(180deg);
}

.refresh-menu-mode-toggle:hover,
.refresh-menu-mode-toggle:focus {
    background: #155f33;
}

.refresh-menu-mode-toggle:disabled {
    color: #94a3b8;
    cursor: not-allowed;
}

.refresh-menu-modes {
    border-bottom: 1px solid #e5e7eb;
}

.refresh-menu-modes[hidden] {
    display: none !important;
}

.navbar-refresh-menu .refresh-menu-item,
.navbar-refresh-menu .refresh-menu-cancel {
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid transparent;
    border-radius: 7px;
    background: #f9fafb;
    color: #374151 !important;
    cursor: pointer;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.25;
    padding: 0.44rem 0.52rem;
    text-align: left;
    text-decoration: none;
    appearance: none;
    -webkit-appearance: none;
}

.navbar-refresh-menu .refresh-menu-item:hover,
.navbar-refresh-menu .refresh-menu-item:focus {
    background: #ecfdf3;
    border-color: #2f8550;
    color: #374151 !important;
    opacity: 1;
}

.navbar-refresh-menu .refresh-menu-item:disabled {
    color: #94a3b8 !important;
    cursor: not-allowed;
}

.navbar-refresh-menu .refresh-menu-start-default {
    border-radius: 7px 0 0 7px;
    border-color: #1f7a43;
    background: #1f7a43;
    color: #ffffff !important;
    justify-content: center;
    font-weight: 800;
}

.navbar-refresh-menu .refresh-menu-start-default:hover,
.navbar-refresh-menu .refresh-menu-start-default:focus {
    border-color: #155f33;
    background: #155f33;
    color: #ffffff !important;
}

.navbar-refresh-menu .refresh-menu-mode {
    display: grid;
    align-items: start;
    gap: 0;
    min-height: 2.2rem;
}

.refresh-menu-mode .refresh-mode-label {
    min-width: 0;
}

.refresh-menu-mode small {
    display: block;
    max-height: 0;
    overflow: hidden;
    color: #64748b;
    font-size: 0.74rem;
    font-weight: 600;
    line-height: 1.3;
    opacity: 0;
    transition: max-height 0.16s ease, opacity 0.16s ease, margin-top 0.16s ease;
}

.refresh-menu-mode:hover small,
.refresh-menu-mode:focus small,
.refresh-menu-mode:focus-visible small {
    max-height: 4.5rem;
    margin-top: 0.18rem;
    opacity: 1;
}

.refresh-menu-mode:disabled small {
    color: #94a3b8;
}

.navbar-refresh-menu .refresh-menu-cancel {
    border: 1px solid #fecaca;
    background: #fff7f7;
    color: #b91c1c !important;
}

.navbar-refresh-menu .refresh-menu-cancel:hover,
.navbar-refresh-menu .refresh-menu-cancel:focus {
    background: #fef2f2;
}

.navbar-settings-menu-main {
    display: grid;
    gap: 0.72rem;
    padding: 0.68rem;
}

.navbar-settings-menu-main form {
    margin: 0;
}

.navbar-settings-field {
    display: grid;
    gap: 0.35rem;
}

.navbar-settings-label {
    font-size: 0.86rem;
    color: #4b5563;
    font-weight: 700;
    line-height: 1.25;
}

.navbar-menu-section-label {
    display: block;
    padding: 0 0.1rem;
}

.navbar-settings-select {
    width: 100%;
    border: 1px solid #4da768;
    border-radius: 7px;
    background: #ffffff;
    color: #374151;
    font: inherit;
    font-size: 0.86rem;
    line-height: 1.25;
    padding: 0.38rem 0.5rem;
}

.navbar-settings-select:focus {
    outline: 2px solid rgba(77, 167, 104, 0.22);
    border-color: #3f9a5f;
}

.navbar-help-menu-list {
    display: grid;
    gap: 0.24rem;
    padding: 0.42rem;
}

.navbar-help-menu-item {
    border: 1px solid transparent;
    background: #f9fafb;
    color: #374151;
    border-radius: 7px;
    padding: 0.44rem 0.52rem;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
}

.navbar-help-menu-item:hover {
    background: #ecfdf3;
    border-color: #2f8550;
    color: #374151;
}

.app-tab-strip {
    position: fixed;
    top: var(--navbar-offset);
    left: 0;
    right: 0;
    height: var(--tab-strip-height);
    z-index: 980;
    background: #dde3ea;
    border-bottom: 1px solid #c2ccd7;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    overflow: visible;
    padding: 0.18rem 0.48rem;
}

.app-tab-strip[hidden] {
    display: none !important;
}

.app-tab-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    flex: 0 0 auto;
    min-width: 0;
}

.app-tab-controls-left {
    margin-right: 0.1rem;
}

.app-tab-controls-right {
    margin-left: 0.1rem;
}

.app-tab-icon-button {
    border: none;
    background: transparent;
    color: #334155;
    width: 1.55rem;
    height: calc(var(--tab-strip-height) - 0.45rem);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    flex: 0 0 auto;
    position: relative;
}

.app-tab-icon-button:hover:not(:disabled) {
    background: #f1f5f9;
}

.app-tab-icon-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.app-tab-save-button {
    border: 1px solid #1d4ed8;
    background: #2563eb;
    color: #ffffff;
    width: auto;
    min-width: 6.7rem;
    height: calc(var(--tab-strip-height) - 0.45rem);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0 0.72rem;
    cursor: pointer;
    flex: 0 0 auto;
    position: relative;
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.app-tab-save-button:hover:not(:disabled) {
    background: #1d4ed8;
    border-color: #1e40af;
}

.app-tab-save-button:disabled {
    opacity: 0.62;
    cursor: not-allowed;
}

.app-tab-tree-toggle {
    flex-direction: column;
    gap: 2px;
}

.app-tab-tree-toggle.is-collapsed {
    background: transparent;
}

.app-tab-icon-plus {
    width: 14px;
    height: 14px;
    position: relative;
    display: inline-block;
}

.app-tab-icon-plus::before,
.app-tab-icon-plus::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    background: #334155;
    border-radius: 999px;
}

.app-tab-icon-plus::before {
    width: 12px;
    height: 2px;
    transform: translate(-50%, -50%);
}

.app-tab-icon-plus::after {
    width: 2px;
    height: 12px;
    transform: translate(-50%, -50%);
}

.app-tab-icon-save,
.app-tab-icon-refresh {
    width: 15px;
    height: 15px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-tab-icon-button.is-running .app-tab-icon-refresh {
    animation: app-tab-refresh-spin 0.85s linear infinite;
    transform-origin: 50% 50%;
}

@keyframes app-tab-refresh-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-tab-icon-button.is-running .app-tab-icon-refresh {
        animation: none;
    }
}

.app-tab-save-feedback {
    display: none;
    align-items: center;
    gap: 0.28rem;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.app-tab-save-button.is-saving,
.app-tab-save-button.is-saved,
.app-tab-save-button.is-save-error {
    min-width: 5.4rem;
}

.app-tab-save-button.is-saving .app-tab-save-label,
.app-tab-save-button.is-saved .app-tab-save-label,
.app-tab-save-button.is-save-error .app-tab-save-label {
    display: none;
}

.app-tab-save-button.is-saving .app-tab-save-feedback,
.app-tab-save-button.is-saved .app-tab-save-feedback,
.app-tab-save-button.is-save-error .app-tab-save-feedback {
    display: inline-flex;
}

.app-tab-save-button.is-saving .app-tab-save-feedback::before {
    content: "";
    width: 0.72rem;
    height: 0.72rem;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
}

.app-tab-save-button.is-saved {
    border-color: #15803d;
    background: #16a34a;
    color: #ffffff;
}

.app-tab-save-button.is-save-error {
    border-color: #b91c1c;
    background: #dc2626;
    color: #ffffff;
}

.app-tab-icon-button.is-saving,
.app-tab-icon-button.is-saved,
.app-tab-icon-button.is-save-error {
    width: auto;
    min-width: 4.8rem;
    padding: 0 0.45rem;
    gap: 0.35rem;
}

.app-tab-icon-button.is-saving:disabled {
    opacity: 1;
    cursor: wait;
}

.app-tab-icon-button.is-saving .app-tab-icon-save,
.app-tab-icon-button.is-saved .app-tab-icon-save,
.app-tab-icon-button.is-save-error .app-tab-icon-save,
.app-tab-icon-button.is-saving .app-tab-menu-icon,
.app-tab-icon-button.is-saved .app-tab-menu-icon,
.app-tab-icon-button.is-save-error .app-tab-menu-icon {
    display: none;
}

.app-tab-icon-button.is-saving .app-tab-save-feedback,
.app-tab-icon-button.is-saved .app-tab-save-feedback,
.app-tab-icon-button.is-save-error .app-tab-save-feedback {
    display: inline-flex;
}

.app-tab-icon-button.is-saving .app-tab-save-feedback::before {
    content: "";
    width: 0.72rem;
    height: 0.72rem;
    border-radius: 999px;
    border: 2px solid rgba(51, 65, 85, 0.25);
    border-top-color: #334155;
    animation: spin 0.8s linear infinite;
}

.app-tab-icon-button.is-saved {
    background: #f0fdf4;
    color: #166534;
}

.app-tab-icon-button.is-save-error {
    background: #fef2f2;
    color: #991b1b;
}

.app-tab-icon-dots {
    width: 3px;
    height: 3px;
    border-radius: 999px;
    background: #334155;
    box-shadow: 0 5px 0 #334155, 0 -5px 0 #334155;
}

.app-tab-icon-pencil {
    width: 11px;
    height: 4px;
    border: 1px solid currentColor;
    border-radius: 1px;
    background: transparent;
    box-sizing: border-box;
    transform: rotate(-35deg);
    position: relative;
}

.app-tab-icon-pencil::before {
    content: "";
    position: absolute;
    right: -5px;
    top: -1px;
    width: 0;
    height: 0;
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
    border-left: 5px solid currentColor;
}

.app-tab-icon-pencil::after {
    content: "";
    position: absolute;
    left: -4px;
    top: -1px;
    width: 3px;
    height: 4px;
    border: 1px solid currentColor;
    border-radius: 1px;
    background: transparent;
    box-sizing: border-box;
}

.app-tab-lines-toggle.is-active {
    background: #ffffff;
}

.app-tab-menu-wrap {
    position: relative;
    display: inline-flex;
}

.app-tab-menu {
    position: absolute;
    top: calc(100% + 0.2rem);
    right: 0;
    min-width: 142px;
    z-index: 1205;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
    padding: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.app-tab-menu[hidden] {
    display: none !important;
}

.app-tab-menu button,
.app-tab-menu a {
    border: none;
    background: #ffffff;
    color: #1f2937;
    text-align: left;
    padding: 0.42rem 0.5rem;
    border-radius: 6px;
    font: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    text-decoration: none;
}

.app-tab-menu .app-menu-group {
    width: 100%;
}

.app-tab-menu button:hover,
.app-tab-menu button:focus,
.app-tab-menu a:hover,
.app-tab-menu a:focus {
    background: #f3f4f6;
}

.app-tab-menu button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: #f9fafb;
}

.app-tab-tree-toggle-line {
    width: 11px;
    height: 2px;
    border-radius: 2px;
    background: #334155;
    display: block;
}

.app-tab-list {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    width: auto;
    min-width: 0;
    flex: 1 1 auto;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

.app-tab {
    display: inline-flex;
    align-items: center;
    margin-top: 0;
    max-width: 250px;
    background: #f8fafc;
    border: none;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    height: calc(var(--tab-strip-height) - 0.45rem);
}

.app-tab.is-active {
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.app-tab-link {
    color: #111827;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.82rem;
    line-height: 1;
    padding: 0 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 190px;
}

.app-tab-link,
.app-tab-link:hover,
.app-tab-link:focus,
.app-tab-link:active,
.app-tab-link:visited {
    color: #111827;
    text-decoration: none;
}

.app-tab-close {
    border: none;
    background: transparent;
    color: #4b5563;
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.15rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
}

.app-tab-close:hover {
    background: rgba(17, 24, 39, 0.12);
    color: #111827;
}

.refresh-progress-panel {
    position: fixed;
    top: calc(var(--top-offset) + 0.45rem);
    right: 0.9rem;
    left: auto;
    width: min(560px, calc(100vw - 1.8rem));
    z-index: 990;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
    padding: 0.55rem 1rem 0.65rem;
}

.refresh-progress-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.refresh-progress-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex: 0 0 auto;
}

.refresh-progress-close {
    width: 1.45rem;
    height: 1.45rem;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #4b5563;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.refresh-progress-close:hover,
.refresh-progress-close:focus {
    background: rgba(17, 24, 39, 0.08);
    color: #111827;
}

.refresh-progress-title-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: #111827;
    font-weight: 700;
    min-width: 0;
}

.refresh-progress-title-wrap span {
    white-space: nowrap;
}

.refresh-progress-step {
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: #374151;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.refresh-progress-bar {
    margin-top: 0.45rem;
    width: 100%;
    height: 0.5rem;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}

.refresh-progress-fill {
    height: 100%;
    width: 0%;
    background: #16a34a;
    transition: width 0.25s ease;
}

.refresh-progress-panel.is-error .refresh-progress-fill {
    background: #dc2626;
}

.refresh-progress-panel.is-error .refresh-progress-step {
    color: #991b1b;
}

.refresh-progress-panel.is-failure-banner {
    border-color: #fecaca;
    background: #fef2f2;
    box-shadow: 0 8px 24px rgba(153, 27, 27, 0.18);
}

.refresh-progress-panel.is-failure-banner .refresh-progress-top {
    align-items: flex-start;
}

.refresh-progress-panel.is-failure-banner .refresh-progress-title-wrap {
    color: #991b1b;
}

.refresh-progress-panel.is-failure-banner .refresh-progress-step {
    color: #7f1d1d;
    white-space: normal;
}

.refresh-progress-panel.is-failure-banner .refresh-progress-history-link {
    color: #991b1b;
}

.refresh-progress-panel.is-failure-banner .refresh-progress-close {
    color: #991b1b;
}

.refresh-progress-panel.is-failure-banner .refresh-progress-close:hover,
.refresh-progress-panel.is-failure-banner .refresh-progress-close:focus {
    background: rgba(153, 27, 27, 0.1);
    color: #7f1d1d;
}

.refresh-progress-panel.is-failure-banner .refresh-progress-history-link:hover,
.refresh-progress-panel.is-failure-banner .refresh-progress-history-link:focus {
    color: #7f1d1d;
}

.refresh-progress-panel.is-warning {
    border-color: #f59e0b;
    box-shadow: 0 8px 24px rgba(146, 64, 14, 0.18);
}

.refresh-progress-panel.is-warning .refresh-progress-fill {
    background: #d97706;
}

.refresh-progress-panel.is-warning .refresh-progress-step {
    color: #92400e;
}

.refresh-progress-step-list {
    max-height: min(15rem, calc(100vh - var(--top-offset) - 9rem));
    overflow: auto;
    padding-right: 0.2rem;
}

.refresh-progress-history-link {
    display: inline-flex;
    align-items: center;
    margin-top: 0.55rem;
    color: #166534;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
}

.refresh-progress-history-link:hover,
.refresh-progress-history-link:focus {
    color: #14532d;
    text-decoration: underline;
}

.refresh-progress-history-link[hidden] {
    display: none !important;
}

.refresh-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(17, 24, 39, 0.2);
    border-top-color: #111827;
    animation: spin 0.8s linear infinite;
}

.refresh-spinner[hidden] {
    display: none !important;
}

.refresh-progress-panel[hidden] {
    display: none !important;
}

.refresh-spinner-light {
    border-color: rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes navbar-refresh-spin {
    to {
        transform: rotate(360deg);
    }
}

/* -----------------------------
   Navbar User Menu
----------------------------- */

.navbar-user-menu {
    position: relative;
    min-width: 0;
    max-width: min(320px, 42vw);
}

.navbar-user-trigger {
    display: inline-flex;
    align-items: center;
    min-height: var(--navbar-control-height);
    vertical-align: middle;
    background: transparent;
    border: none;
    color: #ffffff;
    font: inherit;
    font-weight: bold;
    line-height: inherit;
    cursor: pointer;
    border-radius: 0;
    padding: 0 0 0 0.12rem;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
    transition: opacity 0.2s ease-in-out;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.navbar-user-trigger-label {
    display: block;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.navbar-user-trigger:hover,
.navbar-user-menu.is-open .navbar-user-trigger,
.navbar-user-trigger:focus,
.navbar-user-trigger:active {
    opacity: 0.8;
    background: transparent;
    color: #ffffff;
}

.navbar-user-menu-content {
    display: none;
    position: absolute;
    top: calc(100% + 0.3rem);
    right: 0;
    background: #eceff2;
    color: #374151;
    box-shadow: 0 12px 24px rgba(22, 101, 52, 0.16);
    border: 1px solid #4da768;
    border-radius: 8px;
    min-width: 360px;
    max-width: min(460px, 92vw);
    z-index: 2000;
    text-align: left;
    overflow: hidden;
}

.navbar-user-menu-content form {
    margin: 0;
}

.navbar-user-menu-main {
    display: grid;
    gap: 0.9rem;
    padding: 0.8rem 0.86rem 0.9rem;
}

.navbar-user-menu-main[hidden],
.navbar-org-menu-panel[hidden] {
    display: none !important;
}

.navbar-user-menu-email-box {
    display: grid;
    gap: 0.35rem;
    padding: 0.6rem 0.68rem;
    border: 1px solid #4da768;
    border-radius: 7px;
    background: #f9fafb;
}

.navbar-user-menu-email-value {
    display: block;
    color: #374151;
    font-size: 0.86rem;
    line-height: 1.25;
    word-break: break-word;
}

.navbar-user-menu-email-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    flex-wrap: wrap;
    font-size: 0.86rem;
    line-height: 1.25;
}

.navbar-user-menu-mini-link {
    color: #374151;
    text-decoration: none;
    font: inherit;
    font-weight: 700;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.navbar-user-menu-mini-link:hover {
    color: #374151;
    text-decoration: underline;
}

.navbar-user-menu .navbar-user-menu-mini-link,
.navbar-user-menu .navbar-user-menu-mini-link:visited {
    color: #374151 !important;
}

.navbar-user-menu .navbar-user-menu-mini-link:hover,
.navbar-user-menu .navbar-user-menu-mini-link:focus {
    color: #1f2937 !important;
}

.navbar-user-menu .navbar-user-menu-mini-link-signout,
.navbar-user-menu .navbar-user-menu-mini-link-signout:visited,
.navbar-user-menu .navbar-user-menu-mini-link-signout:hover,
.navbar-user-menu .navbar-user-menu-mini-link-signout:focus {
    color: #2563eb !important;
}

.navbar-user-menu-mini-divider {
    color: #9ca3af;
    line-height: 1;
}

.navbar-user-menu-inline-form {
    margin: 0;
    display: inline;
}

.navbar-user-menu-org-box {
    display: grid;
    gap: 0.35rem;
    padding: 0.6rem 0.68rem;
    border: 1px solid #4da768;
    border-radius: 7px;
    background: #f9fafb;
}

.navbar-user-menu-org-label {
    font-size: 0.86rem;
    color: #6b7280;
    font-weight: 700;
    line-height: 1.25;
}

.navbar-user-menu-org-value {
    color: #374151;
    font-size: 0.86rem;
    line-height: 1.25;
    word-break: break-word;
}

.navbar-user-menu-org-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.45rem;
}

.navbar-user-menu-org-action {
    border: 1px solid #3f9a5f;
    background: #ffffff;
    color: #374151;
    border-radius: 7px;
    padding: 0.4rem 0.52rem;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.25;
    cursor: pointer;
    text-align: center;
}

.navbar-user-menu-org-action:hover {
    border-color: #2f8550;
    color: #374151;
    background: #ecfdf3;
}

.navbar-user-menu-org-action.is-disabled,
.navbar-user-menu-org-action:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f3f4f6;
    border-color: #d1d5db;
    color: #6b7280;
}

.navbar-user-menu-org-action.is-danger {
    border-color: #4da768;
    color: #4b5563;
}

.navbar-user-menu-org-action.is-danger:hover {
    border-color: #2f8550;
    color: #374151;
    background: #ecfdf3;
}

.navbar-org-menu-panel {
    display: grid;
    gap: 0.5rem;
    padding: 0.64rem;
    background: #eceff2;
}

.navbar-org-menu-title {
    font-size: 0.86rem;
    color: #374151;
    font-weight: 700;
    line-height: 1.25;
}

.navbar-org-menu-back {
    border: 1px solid #4da768;
    background: #ffffff;
    color: #374151;
    border-radius: 7px;
    padding: 0.38rem 0.52rem;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.25;
    display: inline-flex;
    align-items: center;
    gap: 0.34rem;
    cursor: pointer;
    width: fit-content;
}

.navbar-org-menu-back:hover {
    background: #ecfdf3;
}

.navbar-org-menu-back-arrow {
    width: 6px;
    height: 6px;
    border-left: 2px solid #374151;
    border-bottom: 2px solid #374151;
    transform: rotate(45deg);
    margin-top: -1px;
}

.navbar-org-menu-list {
    display: grid;
    gap: 0.35rem;
    max-height: min(292px, 48vh);
    overflow-y: auto;
    padding-right: 0.05rem;
}

.navbar-org-menu-button {
    width: 100%;
    border: 1px solid #4da768;
    background: #ffffff;
    color: #374151;
    border-radius: 7px;
    padding: 0.48rem 0.55rem;
    text-align: left;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.42rem;
}

.navbar-org-menu-button:hover {
    background: #ecfdf3;
    border-color: #2f8550;
}

.navbar-org-menu-button.is-active {
    border-color: #3f9a5f;
    background: #dcfce7;
}

.navbar-org-menu-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.navbar-org-menu-current {
    flex: 0 0 auto;
    font-size: 0.86rem;
    color: #4b5563;
    font-weight: 700;
}

.navbar-org-remove-link {
    border: 1px solid #4da768;
    background: #ffffff;
    color: #374151;
    border-radius: 7px;
    padding: 0.48rem 0.55rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.42rem;
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.25;
}

.navbar-org-remove-link:hover {
    background: #ecfdf3;
    border-color: #2f8550;
    color: #374151;
}

.navbar-org-remove-text {
    flex: 0 0 auto;
    font-size: 0.86rem;
}

.navbar-org-menu-empty {
    border: 1px solid #4da768;
    border-radius: 7px;
    padding: 0.45rem 0.55rem;
    font-size: 0.86rem;
    color: #374151;
    background: #ffffff;
    line-height: 1.25;
}

.navbar-org-menu-remove-entry {
    border: 1px solid #4da768;
    background: #f3f4f6;
    color: #4b5563;
    border-radius: 7px;
    padding: 0.42rem 0.55rem;
    text-decoration: none;
    font-size: 0.86rem;
    font-weight: 700;
    line-height: 1.25;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.navbar-user-menu-content .navbar-org-menu-remove-entry,
.navbar-user-menu-content .navbar-org-menu-remove-entry:visited {
    color: #4b5563 !important;
}

.navbar-org-menu-remove-entry:hover {
    background: #ecfdf3;
    color: #374151 !important;
    opacity: 1;
}

.navbar-user-menu.is-open .navbar-user-menu-content {
    display: block;
}

.navbar-user-trigger:focus-visible {
    outline: none;
}

/* -----------------------------
   Sidebar + Main Layout (App pages)
----------------------------- */

.app-layout {
    display: flex;
    padding-top: var(--top-offset);
    min-height: calc(100vh - var(--top-offset));
    min-width: 0;
}

.app-layout.no-sidebar .sidebar,
.app-layout.no-sidebar .sidebar-toggle {
    display: none !important;
}

.app-layout.no-sidebar .main-container {
    margin-left: 0;
    padding-left: 0.75rem;
    padding-right: 1rem;
    width: 100%;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: #4da768;
    color: white;
    padding: 1rem;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
    position: fixed;
    top: var(--top-offset);
    left: 0;
    bottom: 0;
    z-index: 900;
    box-sizing: border-box;
    transition: transform 0.22s ease-in-out;
    will-change: transform;
}

.sidebar a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    display: block;
    padding: 0.5rem 1rem;
    border-radius: 4px;
}

.sidebar a:hover {
    background-color: #3a8551;
}

.sidebar-toggle {
    position: fixed;
    top: calc(var(--top-offset) + 0.45rem);
    left: calc(var(--sidebar-width) - 1.35rem);
    z-index: 910;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #ffffff;
    box-shadow: none;
    padding: 0.1rem 0.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.45);
    transition: left 0.22s ease-in-out, color 0.2s ease;
}

.sidebar-toggle:hover {
    color: #f3f4f6;
}

.sidebar-toggle:focus-visible {
    outline: 1px solid #ffffff;
    outline-offset: 1px;
}

.sidebar-toggle-icon {
    font-size: 1.2rem;
    font-weight: 700;
    min-width: 0.65rem;
    text-align: center;
}

.main-container {
    margin-left: var(--sidebar-width);
    padding: 0 2rem 2rem;
    width: calc(100% - var(--sidebar-width));
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    transition: margin-left 0.22s ease-in-out;
}

body.sidebar-collapsed .sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width) - 1.25rem));
}

body.sidebar-collapsed .main-container {
    margin-left: 0;
    padding-left: 0.75rem;
    padding-right: 1rem;
    width: 100%;
}

body.sidebar-collapsed .sidebar-toggle {
    left: 0.35rem;
    color: #4b5563;
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.2);
}

body.sidebar-collapsed .sidebar-toggle:hover {
    color: #111827;
}

body.sidebar-collapsed .sidebar-toggle:focus-visible {
    outline-color: #4b5563;
}

/* Responsive sidebar */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 168px;
    }

    .sidebar-toggle {
        top: calc(var(--top-offset) + 0.6rem);
    }

    .main-container {
        padding: 0 1rem 1.5rem;
    }
}

@media (max-width: 720px) {
    .navbar {
        padding-left: 0.55rem;
        padding-right: 0.55rem;
        gap: 0.28rem;
    }

    .navbar a {
        padding-left: 0.35rem;
        padding-right: 0.35rem;
    }

    .navbar-right-tools {
        gap: 0.28rem;
    }

    .navbar-user-menu {
        max-width: min(132px, 28vw);
    }
}

@media (max-width: 520px) {
    .navbar-user-menu {
        max-width: min(96px, 24vw);
    }
}

/* -----------------------------
   Common Page Styles (Optional but helpful)
----------------------------- */

.page-title {
    font-family: var(--app-font-family);
    font-weight: bold;
    text-align: center;
    font-size: 2.5rem;
    margin-top: 2rem;
    color: #555;
}

.dashboard-container {
    display: flex;
    justify-content: center;
    gap: 4rem;
    margin-top: 3rem;
}

.dashboard-column {
    flex: 1;
    max-width: 400px;
}

.dashboard-column h2 {
    font-family: var(--app-font-family);
    color: #4da768;
}

.button {
    display: block;
    padding: 1rem 2rem;
    background-color: #a8d5ba;
    color: #333;
    text-decoration: none;
    font-weight: bold;
    border-radius: 8px;
    transition: background-color 0.3s;
    text-align: center;
}

.button:hover {
    background-color: #92c9a5;
}

/* =============================
   Marketing / Pricing Page
   (restores original look)
============================= */

.pricing-content {
    padding: 90px 1.25rem 0;
}

.pricing-hero {
    font-family: var(--app-font-family);
    font-weight: bold;
    font-size: 2.5rem;
    margin: 0.45rem 0 1.65rem;
    color: #7a7b7c;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.pricing-intro {
    max-width: 840px;
    margin: 0 auto 1.75rem;
    text-align: center;
}

.pricing-excerpt {
    max-width: 760px;
    margin: -0.7rem auto 0;
    color: #555f68;
    font-family: var(--app-font-family);
    font-size: 1.04rem;
    font-weight: 500;
    line-height: 1.55;
}

.pricing-hero-prefix {
    color: #7a7b7c;
}

.pricing-hero-wordmark {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #7a7b7c;
    font-size: clamp(2.85rem, 7vw, 3.35rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: 0;
}

.pricing-hero-mark {
    width: clamp(3.05rem, 7vw, 3.46rem);
    height: clamp(3.05rem, 7vw, 3.46rem);
    display: block;
    object-fit: contain;
    flex: 0 0 auto;
    transform: translateY(-0.2rem);
}

.pricing-hero-brand {
    color: #5f9a74;
}

.pricing-hero-product {
    color: #7a7b7c;
}

.pricing-wrapper {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    max-width: 1040px;
    margin: 1.45rem auto 2.35rem;
}

.pricing-card {
    display: block;
    border: 1px solid #ccc;
    padding: 1.35rem;
    border-radius: 10px;
    width: 285px;
    background-color: #f5f5f5;
    font-family: var(--app-font-family);
    text-align: center;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.pricing-card:hover,
.pricing-card:focus-visible {
    border-color: #4da768;
    box-shadow: 0 10px 24px rgba(77, 167, 104, 0.16);
    transform: translateY(-1px);
}

.pricing-card:focus-visible {
    outline: 2px solid rgba(77, 167, 104, 0.35);
    outline-offset: 3px;
}

.pricing-card p.price {
    font-size: 1.1rem;
    font-weight: bold;
}

.pricing-card p.sub {
    color: #666;
}

.pricing-benefits {
    list-style: none;
    display: grid;
    gap: 0.5rem;
    margin: 1rem 0 0;
    padding: 0;
    text-align: left;
}

.pricing-benefits li {
    position: relative;
    padding-left: 1.1rem;
    color: #2f3f4f;
    font-size: 0.9rem;
    line-height: 1.35;
}

.pricing-benefits li::before {
    content: "";
    position: absolute;
    top: 0.48rem;
    left: 0;
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 999px;
    background: #4da768;
}

.pricing-video-title {
    color: #555;
    font-family: var(--app-font-family);
    text-align: center;
    margin: 2.2rem 0 0;
}

.pricing-plans-title {
    color: #555;
    font-family: var(--app-font-family);
    font-size: 1.65rem;
    text-align: center;
    margin: 2.8rem 0 0;
}

.video-container {
    position: relative;
    padding-bottom: 40%;
    height: 0;
    overflow: hidden;
    max-width: 800px;
    margin: 2rem auto;
    border-radius: 10px;
}

.video-container iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.marketing-footer {
    flex-shrink: 0;
    margin-top: auto;
    background: #e5e9ef;
    border-top: 1px solid #cdd5df;
    color: #111827;
}

.marketing-footer-inner {
    box-sizing: border-box;
    width: 100%;
    min-height: 7.25rem;
    padding: 1.35rem clamp(1rem, 2vw, 2rem) 1.55rem;
    display: grid;
    align-content: end;
    justify-items: start;
    gap: 0.5rem;
    text-align: left;
}

.marketing-footer-logo {
    display: none !important;
}

.marketing-footer-meta {
    display: grid;
    justify-items: start;
    gap: 0.18rem;
    color: #4b5563;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.35;
    min-width: 0;
}

.marketing-footer-meta > * {
    margin: 0;
    color: inherit;
    font: inherit;
    font-style: normal;
    text-decoration: none;
    white-space: normal;
}

.marketing-footer-meta > * + *::before {
    content: none;
}

.marketing-footer-meta a {
    color: #1f2937;
}

.marketing-footer-meta a:hover,
.marketing-footer-meta a:focus-visible {
    color: #166534;
    text-decoration: underline;
}

.marketing-footer-links {
    display: inline-flex;
    align-items: center;
    gap: 0.48rem;
}

.marketing-footer-link-divider {
    display: inline-flex;
    align-items: center;
    color: #6b7280;
    line-height: 1;
}

/* Mobile stacking */
@media (max-width: 900px) {
    .pricing-wrapper {
        flex-direction: column;
        align-items: center;
    }

    .marketing-footer-inner {
        min-height: 8rem;
        padding: 1.25rem 1rem 1.4rem;
        gap: 0.45rem;
    }

    .marketing-footer-meta {
        gap: 0.22rem;
    }

}

/* -----------------------------
   Auth Pages (Login / Signup)
----------------------------- */

.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    padding-top: 2rem;
}

.auth-card {
    background-color: white;
    padding: 2rem 3rem;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.auth-title {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-field {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 0.82rem;
}

.auth-field label {
    color: #374151;
    font-size: 0.88rem;
    font-weight: 700;
}

.auth-field input {
    border: 1px solid #d1d5db;
    border-radius: 7px;
    box-sizing: border-box;
    font: inherit;
    padding: 0.56rem 0.62rem;
    width: 100%;
}

.auth-errors,
.auth-form-errors,
.auth-field .errorlist,
.auth-legal-box .errorlist {
    color: #b91c1c;
    font-size: 0.8rem;
    margin: 0;
    padding-left: 1rem;
}

.auth-errors {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    margin: 0 0 0.9rem;
    padding: 0.62rem 0.72rem;
}

.auth-success {
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    color: #166534;
    font-size: 0.84rem;
    margin: 0 0 0.9rem;
    padding: 0.75rem;
}

.auth-errors ul,
.auth-errors p {
    margin: 0;
}

.auth-field-error {
    color: #b91c1c;
    font-size: 0.76rem;
    line-height: 1.25;
}

.auth-legal-box {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #f8fafc;
    display: grid;
    gap: 0.65rem;
    margin: 0.9rem 0 1rem;
    padding: 0.72rem;
}

.auth-checkbox-row {
    align-items: flex-start;
    color: #374151;
    display: grid;
    font-size: 0.84rem;
    gap: 0.52rem;
    grid-template-columns: 1rem 1fr;
    line-height: 1.35;
}

.auth-checkbox-row input {
    height: 1rem;
    margin: 0.12rem 0 0;
    width: 1rem;
}

.auth-checkbox-row a {
    color: #166534;
    font-weight: 700;
}

.auth-button {
    width: 100%;
    padding: 0.75rem;
    background-color: #4da768;
    color: white;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 1rem;
    transition: opacity 0.2s;
}

.auth-button:hover {
    opacity: 0.9;
}

.auth-link-button {
    background: transparent;
    border: 0;
    color: #2563eb;
    cursor: pointer;
    display: block;
    font: inherit;
    margin: 0.85rem auto 0;
    padding: 0;
    text-align: center;
}

.auth-link-button:hover {
    text-decoration: underline;
}

.auth-footer {
    text-align: center;
    margin-top: 1rem;
}

.legal-shell {
    box-sizing: border-box;
    margin: 0 auto;
    max-width: 960px;
    padding: calc(var(--navbar-offset) + 1.4rem) 1.2rem 2.5rem;
}

.legal-back-link {
    color: #1f2937;
    display: inline-flex;
    font-size: 0.84rem;
    font-weight: 700;
    margin-bottom: 0.62rem;
    text-decoration: none;
}

.legal-back-link:hover {
    color: #166534;
}

.legal-header {
    align-items: flex-start;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 0.9rem;
}

.legal-title {
    color: #111827;
    font-size: 1.65rem;
    line-height: 1.15;
    margin: 0;
}

.legal-meta {
    color: #6b7280;
    font-size: 0.86rem;
    margin: 0.35rem 0 0;
}

.legal-switch-link {
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    color: #1f2937;
    font-size: 0.84rem;
    font-weight: 700;
    padding: 0.48rem 0.68rem;
    text-decoration: none;
    white-space: nowrap;
}

.legal-panel {
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    padding: 1rem 1.15rem;
}

.legal-section {
    border-top: 1px solid #e5e7eb;
    padding: 1rem 0 0.15rem;
}

.legal-section:first-of-type {
    border-top: none;
}

.legal-section h2 {
    color: #111827;
    font-size: 1rem;
    line-height: 1.25;
    margin: 0 0 0.45rem;
}

.legal-section p {
    color: #374151;
    font-size: 0.92rem;
    line-height: 1.55;
    margin: 0 0 0.72rem;
}

@media (max-width: 640px) {
    .auth-card {
        width: min(400px, calc(100vw - 2rem));
        padding: 1.4rem;
    }

    .legal-header {
        display: grid;
    }

    .legal-switch-link {
        justify-self: start;
    }
}



/* -----------------------------
   Chart of Accounts
----------------------------- */

.muted-text {
    color: #6b7280;
}

.text-danger-strong {
    color: #b91c1c;
    font-weight: 700;
}

.coa-home-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.coa-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.coa-section-title {
    margin: 0;
}

.coa-create-btn {
    max-width: 260px;
}

.coa-col-currency { width: 110px; }
.coa-col-actions { width: 180px; }
.coa-col-mapped { width: 260px; }

.coa-actions-row {
    margin: 1rem 0;
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    align-items: center;
}

.coa-grid-wrap {
    overflow: auto;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.coa-grid {
    width: 100%;
    border-collapse: collapse;
    min-width: 520px;
}

.coa-grid th,
.coa-grid td {
    border-bottom: 1px solid #e5e7eb;
    padding: .55rem .6rem;
    vertical-align: top;
}

.coa-grid th {
    text-align: left;
    background: #f3f4f6;
    position: sticky;
    top: 0;
    z-index: 1;
}

.coa-grid td.cell:focus {
    outline: 2px solid rgba(77, 167, 104, 0.35);
    outline-offset: -2px;
}


.coa-list {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.coa-list th,
.coa-list td {
    border-bottom: 1px solid #e5e7eb;
    padding: .55rem .6rem;
    text-align: left;
}

.coa-list th {
    background: #f3f4f6;
}

.coa-form-shell {
    max-width: 620px;
    margin: 1rem 0 2rem;
}

.coa-form-header {
    align-items: center;
    border-bottom: 1px solid #d8dee7;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 0.85rem;
    padding-bottom: 0.65rem;
}

.coa-form-header h1 {
    color: #111827;
    font-size: 1.32rem;
    line-height: 1.15;
    margin: 0;
}

.coa-form-back {
    color: #374151;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
}

.coa-form-back:hover {
    color: #166534;
    text-decoration: underline;
}

.coa-chart-form {
    display: grid;
    gap: 0;
}

.coa-form-panel {
    border-bottom: 1px solid #e5e7eb;
    display: grid;
    gap: 0.65rem;
    padding: 0.75rem 0;
}

.coa-form-field {
    align-items: center;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: 150px minmax(0, 1fr);
}

.coa-form-field label,
.coa-form-section-head h2 {
    color: #1f2937;
    font-weight: 700;
}

.coa-form-field label {
    font-size: 0.86rem;
}

.coa-form-field input,
.coa-form-field select,
.coa-mapping-row select {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 7px;
    box-sizing: border-box;
    color: #111827;
    font: inherit;
    font-size: 0.88rem;
    min-height: 2.08rem;
    padding: 0.4rem 0.52rem;
    width: 100%;
}

.coa-form-field input:focus,
.coa-form-field select:focus,
.coa-mapping-row select:focus {
    border-color: #3f9a5f;
    outline: 2px solid rgba(77, 167, 104, 0.22);
    outline-offset: 0;
}

.coa-form-check-field {
    align-items: start;
}

.coa-form-check-content {
    display: grid;
    gap: 0.28rem;
}

.coa-form-check-row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.9rem;
}

.coa-form-check-control {
    align-items: flex-start;
    color: #1f2937;
    cursor: pointer;
    display: inline-flex;
    font-size: 0.86rem;
    font-weight: 700;
    gap: 0.5rem;
    line-height: 1.25;
}

.coa-form-field .coa-form-check-control input[type="checkbox"] {
    accent-color: #4da768;
    flex: 0 0 auto;
    height: 1rem;
    margin: 0.08rem 0 0;
    min-height: 1rem;
    padding: 0;
    width: 1rem;
}

.coa-form-help {
    color: #64748b;
    font-size: 0.8rem;
    line-height: 1.35;
}

.coa-form-inline-link {
    color: #1d4ed8;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.25;
    text-decoration: none;
}

.coa-form-inline-link:hover,
.coa-form-inline-link:focus {
    text-decoration: underline;
}

.coa-form-section-head {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
}

.coa-form-section-head h2 {
    font-size: 0.92rem;
    line-height: 1.2;
    margin: 0;
}

.coa-mapping-list {
    display: grid;
    gap: 0.4rem;
}

.coa-mapping-row {
    display: grid;
    gap: 0.45rem;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.coa-form-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-start;
    padding-top: 0.9rem;
}

.coa-form-button,
.coa-remove-mapping {
    align-items: center;
    border-radius: 7px;
    box-sizing: border-box;
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    justify-content: center;
    line-height: 1.2;
    min-height: 2.05rem;
    padding: 0.42rem 0.68rem;
    text-decoration: none;
}

.coa-form-button-primary {
    background: #4da768;
    border: 1px solid #3f9a5f;
    color: #ffffff;
}

.coa-form-button-primary:hover {
    background: #3f9a5f;
    color: #ffffff;
}

.coa-form-button-secondary,
.coa-remove-mapping {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #1f2937;
}

.coa-form-button-secondary:hover,
.coa-remove-mapping:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #111827;
}

.coa-remove-mapping {
    color: #64748b;
    flex: 0 0 auto;
    font-size: 1.15rem;
    height: 2.08rem;
    line-height: 1;
    min-height: 2.08rem;
    min-width: 2.08rem;
    padding: 0;
    width: 2.08rem;
}

.coa-remove-mapping:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.coa-form-button-small {
    flex: 0 0 auto;
    min-height: 1.86rem;
    padding: 0.34rem 0.55rem;
}

.coa-form-error,
.coa-form-alert {
    color: #b91c1c;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.35;
}

.coa-form-alert {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 0.62rem 0.75rem;
}

.coa-form-alert ul {
    margin: 0;
    padding-left: 1rem;
}

@media (max-width: 640px) {
    .coa-form-shell {
        max-width: none;
    }

    .coa-form-header,
    .coa-form-field,
    .coa-form-section-head,
    .coa-form-actions {
        align-items: stretch;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        justify-content: stretch;
    }

    .coa-mapping-row {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .coa-form-check-spacer {
        display: none;
    }
}

/* -----------------------------
   AI Agent Chat Widget
----------------------------- */

.ai-chat-widget {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 995;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    pointer-events: auto;
}

.ai-chat-toggle {
    border: none;
    border-radius: 999px;
    background: #0f766e;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.55rem 0.95rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.ai-chat-toggle:hover {
    opacity: 0.92;
}

.ai-chat-panel {
    width: min(430px, calc(100vw - 1.6rem));
    height: min(580px, 68vh);
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-chat-panel[hidden] {
    display: none !important;
}

.ai-chat-header {
    border-bottom: 1px solid #e5e7eb;
    padding: 0.6rem 0.7rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.7rem;
}

.ai-chat-title-wrap {
    min-width: 0;
}

.ai-chat-title {
    font-size: 0.95rem;
    color: #111827;
}

.ai-chat-status {
    display: block;
    margin-top: 0.2rem;
    font-size: 0.75rem;
    color: #374151;
    min-height: 1em;
}

.ai-chat-status.is-error {
    color: #b91c1c;
}

.ai-chat-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.ai-chat-header-btn {
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #111827;
    border-radius: 6px;
    font-size: 0.75rem;
    padding: 0.15rem 0.45rem;
    cursor: pointer;
}

.ai-chat-header-btn:hover {
    background: #f9fafb;
}

.ai-chat-header-btn:disabled {
    color: #9ca3af;
    background: #f8fafc;
    cursor: not-allowed;
}

.ai-chat-conversation-list {
    max-height: 170px;
    overflow-y: auto;
    border-bottom: 1px solid #e5e7eb;
    background: #ffffff;
    padding: 0.35rem;
}

.ai-chat-conversation-list[hidden] {
    display: none !important;
}

.ai-chat-panel.is-list-mode .ai-chat-conversation-list {
    flex: 1;
    max-height: none;
    border-bottom: none;
}

.ai-chat-conversation-item {
    width: 100%;
    border: 1px solid transparent;
    border-radius: 6px;
    background: #ffffff;
    color: #111827;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.4rem 0.45rem;
    text-align: left;
    cursor: pointer;
}

.ai-chat-conversation-item:hover {
    background: #f8fafc;
}

.ai-chat-conversation-item.is-active {
    border-color: #93c5fd;
    background: #eff6ff;
}

.ai-chat-conversation-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.78rem;
    font-weight: 700;
}

.ai-chat-conversation-meta,
.ai-chat-conversation-empty {
    font-size: 0.72rem;
    color: #64748b;
}

.ai-chat-conversation-empty {
    padding: 0.45rem;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: #f8fafc;
}

.ai-chat-messages[hidden],
.ai-chat-form[hidden] {
    display: none !important;
}

.ai-chat-message {
    max-width: 95%;
}

.ai-chat-message-body {
    font-size: 0.84rem;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 0.5rem 0.6rem;
    border-radius: 10px;
    border: 1px solid transparent;
    background: #ffffff;
    color: #111827;
}

.ai-chat-message-time {
    margin-top: 0.15rem;
    font-size: 0.68rem;
    color: #6b7280;
}

.ai-chat-message-user {
    align-self: flex-end;
}

.ai-chat-message-user .ai-chat-message-body {
    background: #d1fae5;
    border-color: #a7f3d0;
}

.ai-chat-message-assistant .ai-chat-message-body {
    background: #ffffff;
    border-color: #e5e7eb;
}

.ai-chat-action-message {
    align-self: stretch;
    max-width: 100%;
}

.ai-chat-action-card {
    border-color: #cbd5e1;
    background: #ffffff;
}

.ai-chat-action-detail {
    color: #111827;
}

.ai-chat-action-footer {
    margin-top: 0.45rem;
    padding-top: 0.45rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.ai-chat-action-status {
    font-size: 0.72rem;
    color: #475569;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ai-chat-action-link {
    border: 1px solid #2563eb;
    border-radius: 6px;
    background: #eff6ff;
    color: #1d4ed8;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.25rem 0.55rem;
    text-decoration: none;
}

.ai-chat-action-link:hover {
    background: #dbeafe;
    text-decoration: none;
}

.ai-chat-action-revert {
    border: 1px solid #b91c1c;
    border-radius: 6px;
    background: #ffffff;
    color: #991b1b;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.25rem 0.55rem;
    cursor: pointer;
}

.ai-chat-action-revert:hover:not(:disabled) {
    background: #fef2f2;
}

.ai-chat-action-revert:disabled {
    border-color: #cbd5e1;
    color: #64748b;
    cursor: not-allowed;
    background: #f8fafc;
}

.ai-chat-form {
    border-top: 1px solid #e5e7eb;
    padding: 0.6rem 0.7rem 0.7rem;
    background: #ffffff;
}

.ai-chat-actions-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: #374151;
    margin-bottom: 0.45rem;
    user-select: none;
}

.ai-chat-input-row {
    display: flex;
    gap: 0.4rem;
}

.ai-chat-input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0.48rem 0.6rem;
    font-size: 0.85rem;
}

.ai-chat-input:focus {
    outline: 2px solid rgba(15, 118, 110, 0.22);
    outline-offset: 0;
    border-color: #0f766e;
}

.ai-chat-send {
    border: none;
    border-radius: 8px;
    background: #0f766e;
    color: #ffffff;
    font-weight: 700;
    padding: 0 0.8rem;
    cursor: pointer;
}

.ai-chat-send:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .ai-chat-widget {
        right: 0.65rem;
        left: 0.65rem;
        align-items: stretch;
    }

    .ai-chat-panel {
        width: calc(100vw - 1.3rem);
        height: min(560px, 70vh);
    }

    .ai-chat-toggle {
        align-self: flex-end;
    }
}

/* -----------------------------
   History Pages
----------------------------- */

.history-shell {
    margin: 1.1rem 0 1.5rem;
    display: grid;
    gap: 0.8rem;
}

.history-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.history-title {
    margin: 0;
    font-size: 1.35rem;
    line-height: 1.15;
    color: #111827;
    font-weight: 700;
}

.history-subtitle {
    margin-top: 0.24rem;
}

.history-btn {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #1f2937;
    border-radius: 7px;
    padding: 0.42rem 0.62rem;
    font: inherit;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    box-sizing: border-box;
}

.history-btn:hover {
    background: #f8fafc;
}

.history-btn.is-primary {
    border-color: #133752;
    background: #133752;
    color: #ffffff;
}

.history-btn.is-primary:hover,
.history-btn.is-primary:focus {
    border-color: #0f2d44;
    background: #0f2d44;
    color: #ffffff;
}

.history-panel {
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
    overflow: hidden;
}

.history-table-wrap {
    overflow: auto;
    max-height: calc(100vh - 14rem);
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.history-table th,
.history-table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 0.52rem 0.6rem;
    text-align: left;
    vertical-align: middle;
    font-size: 0.82rem;
    line-height: 1.25;
}

.history-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #eef2f6;
    color: #1f2937;
    font-weight: 700;
    white-space: nowrap;
}

.history-table tbody tr:nth-child(odd) {
    background: #fcfdff;
}

.history-table tbody tr:hover {
    background: #f6f9fc;
}

.history-table form {
    margin: 0;
    display: inline;
}

.history-table .is-right {
    text-align: right;
}

.history-empty {
    color: #6b7280;
    font-style: italic;
}

.history-detail-row td {
    background: #f8fafc;
    padding: 0.55rem 0.7rem;
}

.history-snapshot summary {
    cursor: pointer;
    color: #1f2937;
    font-weight: 700;
    font-size: 0.8rem;
}

.history-snapshot pre {
    margin: 0.55rem 0 0;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    background: #ffffff;
    color: #111827;
    max-height: 22rem;
    overflow: auto;
    padding: 0.72rem;
    font-size: 0.78rem;
    line-height: 1.35;
    white-space: pre;
}
