/* TravelB2B application chrome. Tokens live in tokens.css; company theme vars set in base.html. */

html,
body {
    height: 100%;
}

body.app-body {
    margin: 0;
    color: var(--ink);
    background: var(--page);
    font-size: calc(14px * var(--ui-font-scale, 1));
    line-height: 1.45;
}

body.app-body.is-authed {
    overflow: hidden;
}

:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.app-skip {
    position: absolute;
    left: 0.75rem;
    top: -3rem;
    z-index: 80;
    border-radius: var(--radius-md);
    background: #0f172a;
    color: #fff;
    padding: 0.5rem 0.75rem;
}
.app-skip:focus {
    top: 0.75rem;
}

/* Shell */
.app-shell {
    display: flex;
    min-height: 100%;
    height: 100%;
}

.app-sidebar {
    display: flex;
    flex-shrink: 0;
    flex-direction: column;
    border-right: 1px solid var(--line);
    --bs-offcanvas-bg: var(--surface);
    background-color: var(--surface);
    color: var(--ink);
    transition: width 0.15s ease;
}

@media (min-width: 992px) {
    .app-sidebar {
        width: var(--app-sidebar-width);
    }

    .app-shell.is-collapsed .app-sidebar {
        width: var(--app-sidebar-collapsed);
    }
}

.app-sidebar-brand {
    display: flex;
    height: var(--app-topbar-height);
    align-items: center;
    gap: 0.55rem;
    border-bottom: 1px solid var(--line);
    padding: 0 0.85rem;
    min-width: 0;
    text-decoration: none;
    color: inherit;
    background-color: var(--surface);
}

.app-sidebar-brand img {
    display: block;
    height: 1.75rem;
    width: 1.75rem;
    object-fit: contain;
    object-position: center;
    flex-shrink: 0;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: #fff;
    padding: 0.1rem;
}

.app-sidebar-brand-text {
    min-width: 0;
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--ui-primary, #173f35);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-sidebar-mobile-header {
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.85rem;
}

.app-sidebar-mobile-brand {
    flex: 1;
    min-width: 0;
    height: auto;
    border-bottom: 0;
    padding: 0;
}

.app-shell.is-collapsed .app-sidebar-brand-text,
.app-shell.is-collapsed .app-nav-label,
.app-shell.is-collapsed .app-nav-section-title {
    display: none;
}

.app-nav {
    flex: 1;
    overflow: auto;
    padding: 0.75rem 0.55rem 1rem;
    background-color: var(--surface);
}

.app-nav-section {
    margin-bottom: 0.85rem;
}

.app-nav-section-title {
    margin: 0 0.55rem 0.3rem;
    font-size: 0.68rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.app-nav a,
.app-nav-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    border-radius: var(--radius-md);
    padding: 0.45rem 0.55rem;
    color: #64748b;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 450;
}

.app-nav a:hover,
.app-nav-btn:hover {
    background: color-mix(in srgb, var(--ui-surface, #f4efe6) 30%, #eef1f4);
    color: var(--ink);
}

.app-nav a.is-active {
    background: color-mix(in srgb, var(--ui-primary, #173f35) 10%, #ffffff);
    color: color-mix(in srgb, var(--ui-primary, #173f35) 82%, #0f172a);
    font-weight: 600;
}

.app-nav-icon {
    display: inline-flex;
    width: 1.15rem;
    height: 1.15rem;
    flex-shrink: 0;
    color: currentColor;
}

.app-nav-icon svg {
    width: 100%;
    height: 100%;
}

.app-shell.is-collapsed .app-nav a,
.app-shell.is-collapsed .app-nav-btn {
    justify-content: center;
    padding: 0.55rem;
}

.app-frame {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    background: var(--page);
}

.app-topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    height: var(--app-topbar-height);
    flex-shrink: 0;
    align-items: center;
    column-gap: 0.75rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
    padding: 0 1rem;
    position: relative;
    z-index: 30;
}

.app-topbar-start {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    justify-self: start;
    position: relative;
    z-index: 2;
}

.app-topbar-end {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    min-width: 0;
    justify-self: end;
    position: relative;
    z-index: 2;
}

.app-icon-btn {
    display: inline-flex;
    height: var(--app-touch);
    width: var(--app-touch);
    min-height: var(--app-touch);
    min-width: var(--app-touch);
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
    color: #334155;
    cursor: pointer;
}

.app-icon-btn:hover {
    background: #f1f5f9;
}

/* True visual center — page title between side controls */
.app-topbar-page {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    min-width: 0;
    max-width: min(24rem, calc(100% - 8.5rem));
    pointer-events: none;
}

.app-topbar-page-logo {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    border: 1px solid var(--line, #e2e8f0);
    background: #fff;
    overflow: hidden;
    pointer-events: auto;
    text-decoration: none;
    transition: box-shadow var(--motion-fast) ease, transform var(--motion-fast) var(--ease-out);
}

.app-topbar-page-logo:hover {
    box-shadow: 0 2px 8px rgb(15 23 42 / 0.1);
}

.app-topbar-page-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    padding: 0.1rem;
}

.app-topbar-page-title {
    margin: 0;
    min-width: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    line-height: 1.2;
}

.app-admin-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: #111827;
    color: #f8fafc;
    font-size: 0.7rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    padding: 0.15rem 0.5rem;
}

.app-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.app-user-menu {
    position: relative;
}

.app-user-menu > summary {
    list-style: none;
    display: flex;
    cursor: pointer;
    align-items: center;
    gap: 0.5rem;
    border-radius: var(--radius-md);
    padding: 0.2rem 0.35rem 0.2rem 0.2rem;
}

.app-user-menu > summary::-webkit-details-marker {
    display: none;
}

.app-avatar {
    display: inline-flex;
    height: 1.85rem;
    width: 1.85rem;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 999px;
    background: color-mix(in srgb, var(--ui-primary, #173f35) 16%, #ffffff);
    color: color-mix(in srgb, var(--ui-primary, #173f35) 80%, #0f172a);
    font-size: 0.72rem;
    font-weight: 700;
}

.app-avatar img {
    height: 100%;
    width: 100%;
    object-fit: cover;
}

.app-user-name {
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8125rem;
    font-weight: 600;
}

.app-menu {
    position: absolute;
    right: 0;
    z-index: 40;
    margin-top: 0.35rem;
    min-width: 12rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #fff;
    padding: 0.3rem;
    box-shadow: 0 10px 24px rgb(15 23 42 / 0.12);
}

.app-menu a,
.app-menu button {
    display: block;
    width: 100%;
    border: 0;
    border-radius: 6px;
    background: transparent;
    padding: 0.45rem 0.55rem;
    text-align: left;
    font-size: 0.8125rem;
    color: #334155;
    cursor: pointer;
    text-decoration: none;
}

.app-menu a:hover,
.app-menu button:hover {
    background: #f1f5f9;
}

.app-menu .is-danger {
    color: #b91c1c;
}

.app-main {
    flex: 1;
    overflow: auto;
    padding: 1.25rem 1.25rem 2rem;
}

.app-main.is-flush {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.app-main.is-flush .app-crumbs {
    flex-shrink: 0;
    margin: 0;
    padding: 0.65rem 1rem 0.35rem;
}

.app-main.is-flush .editor-page {
    flex: 1;
    min-height: 0;
}

.app-flash {
    margin-bottom: 1rem;
}

/* Bottom toast notifications */
.app-toast-region {
    position: fixed;
    right: 1rem;
    bottom: calc(1rem + var(--app-safe-bottom));
    z-index: 1090;
    display: flex;
    width: min(22rem, calc(100vw - 2rem));
    flex-direction: column-reverse;
    gap: 0.55rem;
    pointer-events: none;
}

.app-toast {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: #fff;
    padding: 0.8rem 0.85rem;
    font-size: 0.875rem;
    line-height: 1.4;
    box-shadow: 0 10px 30px rgb(15 23 42 / 0.12);
    pointer-events: auto;
    animation: app-toast-in var(--motion) var(--ease-out) both;
}

.app-toast.is-hiding {
    animation: app-toast-out var(--motion-fast) var(--ease-out) both;
}

.app-toast-message {
    min-width: 0;
    flex: 1;
    margin: 0;
}

.app-toast-close {
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.app-toast.is-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #9f1239;
}

.app-toast.is-warning {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.app-toast.is-success {
    border-color: color-mix(in srgb, var(--ui-accent, #c58f38) 28%, #e7e5e4);
    background: color-mix(in srgb, var(--ui-accent, #c58f38) 10%, #ffffff);
    color: color-mix(in srgb, var(--ui-accent, #c58f38) 58%, #1e293b);
}

.app-flash-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #fff;
    padding: 0.7rem 0.85rem;
    font-size: 0.875rem;
}

.app-flash-item.is-error {
    border-color: #fecaca;
    background: #fef2f2;
    color: #9f1239;
}

.app-flash-item.is-warning {
    border-color: #fde68a;
    background: #fffbeb;
    color: #92400e;
}

.app-flash-item.is-success {
    border-color: color-mix(in srgb, var(--ui-accent, #c58f38) 28%, #e7e5e4);
    background: color-mix(in srgb, var(--ui-accent, #c58f38) 10%, #ffffff);
}

/* Public layout */
.app-public-header,
.app-public-footer {
    border-color: var(--line);
}

/* Type */
.app-page-title {
    margin: 0;
    font-size: clamp(1.6rem, 1.4rem + 0.6vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.app-page-subtitle {
    margin: 0.35rem 0 0;
    max-width: 42rem;
    color: var(--ink-muted);
    font-size: 0.875rem;
}

.app-section-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.app-kicker {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink-faint);
}

.app-crumbs {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    color: var(--ink-faint);
    min-width: 0;
    overflow: hidden;
}

.app-crumbs a {
    color: var(--ink-muted);
    text-decoration: none;
    flex-shrink: 0;
}

.app-crumbs a:hover {
    color: var(--ink);
}

.app-crumbs [aria-current="page"] {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Buttons */
.app-btn,
.app-main button[type="submit"]:not(.dropdown-item),
a.app-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    padding: 0.5rem 0.85rem;
    font-size: 0.8125rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.2;
    appearance: none;
    -webkit-appearance: none;
    transition:
        background-color var(--motion-fast) ease,
        border-color var(--motion-fast) ease,
        color var(--motion-fast) ease,
        box-shadow var(--motion-fast) ease,
        transform var(--motion-fast) var(--ease-out);
}

.app-btn:active,
.app-main button[type="submit"]:not(.dropdown-item):active,
a.app-btn:active {
    transform: translateY(1px) scale(0.98);
}

.app-ico {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    display: block;
}

.app-btn .app-ico,
.app-tabs .app-ico,
.settings-nav .app-ico,
.app-sheet-nav .app-ico,
.editor-steps .app-ico,
.editor-steps-mobile .app-ico,
.settings-mobile-trigger .app-ico {
    width: 1rem;
    height: 1rem;
}

.app-tabs a {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.settings-nav a,
.app-sheet-nav a {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.settings-nav .app-ico,
.app-sheet-nav .app-ico {
    opacity: 0.72;
}

.settings-nav a.is-active .app-ico,
.app-sheet-nav a.is-active .app-ico {
    opacity: 1;
}

.settings-mobile-trigger {
    gap: 0.5rem;
}

.settings-mobile-trigger > span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.app-btn-primary,
.app-page-header .app-btn-primary {
    background: var(--ui-accent, #c58f38);
    color: #fff;
}

.app-btn-primary:hover {
    background: var(--ui-accent-hover, color-mix(in srgb, var(--ui-accent, #c58f38) 86%, #000));
    box-shadow: 0 4px 12px color-mix(in srgb, var(--ui-accent, #c58f38) 35%, transparent);
}

.app-btn-secondary {
    background: #fff;
    border-color: var(--line-strong);
    color: var(--ink);
}

.app-btn-secondary:hover {
    background: #f8fafc;
}

.app-btn-tertiary {
    background: transparent;
    border-color: var(--line);
    color: var(--ink-muted);
}

.app-btn-danger {
    background: #fff;
    border-color: #fecaca;
    color: #b91c1c;
}

.app-btn-danger:hover {
    background: #fef2f2;
}

.app-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.app-page-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Surfaces */
.app-panel {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.app-metric-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

@media (min-width: 900px) {
    .app-metric-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.app-metric {
    padding: 0.85rem 1rem;
}

.app-metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.app-metric a {
    color: inherit;
    text-decoration: none;
}

.app-metric a:hover .app-metric-value {
    color: var(--ui-primary, #173f35);
}

.dashboard-layout {
    display: grid;
    gap: 1.25rem;
    align-items: start;
}

.dashboard-main {
    min-width: 0;
}

.dashboard-app-tiles {
    margin-bottom: 0.25rem;
    width: 100%;
    max-width: 26rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-app-tiles .content-hub-card {
    aspect-ratio: 1 / 1;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto 1fr auto;
    align-items: start;
    gap: 0.55rem 0.5rem;
    padding: 1rem 1.05rem;
}

.dashboard-app-tiles .content-hub-card-icon {
    grid-column: 1;
    grid-row: 1;
    width: 2.75rem;
    height: 2.75rem;
}

.dashboard-app-tiles .content-hub-card-icon .app-ico {
    width: 1.35rem;
    height: 1.35rem;
}

.dashboard-app-tiles .content-hub-card-body {
    grid-column: 1 / -1;
    grid-row: 2;
    align-self: center;
}

.dashboard-app-tiles .content-hub-card-title {
    font-size: 1rem;
}

.dashboard-app-tiles .content-hub-card-desc {
    margin-top: 0.25rem;
    font-size: 0.78rem;
    line-height: 1.4;
}

.dashboard-app-tiles .content-hub-card-count {
    grid-column: 1;
    grid-row: 3;
    align-self: end;
    margin-top: 0;
}

.dashboard-app-tiles .content-hub-card-go {
    grid-column: 2;
    grid-row: 3;
    align-self: end;
}

@media (min-width: 1100px) {
    .dashboard-app-tiles.content-hub-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .dashboard-layout {
        grid-template-columns: minmax(0, 1fr) minmax(15rem, 17.5rem);
    }

    .dashboard-sidebar {
        position: sticky;
        top: calc(var(--app-topbar-height) + 1rem);
        display: flex;
        flex-direction: column;
        gap: 0.85rem;
    }

    .dashboard-sidebar-metrics {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.65rem;
        margin-bottom: 0;
    }

    .dashboard-sidebar-metrics .app-metric {
        padding: 0.75rem 0.9rem;
    }

    .dashboard-sidebar-metrics .app-metric-value {
        font-size: 1.35rem;
    }

    .dashboard-sidebar-panel .app-btn-tertiary {
        padding-inline: 0.55rem;
        font-size: 0.8125rem;
    }
}

/* Operational dashboard (home) */
.dashboard-page {
    width: 100%;
}

.dashboard-shell {
    width: 100%;
    max-width: 84rem;
    margin-inline: auto;
}

.dashboard-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem 1.25rem;
}

.dashboard-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}

.dashboard-mobile-ctas {
    display: grid;
    gap: 0.65rem;
}

.dashboard-stats-mobile {
    font-size: 0.875rem;
    color: var(--ink-muted, #64748b);
    line-height: 1.45;
}

.dashboard-stats-mobile-line {
    margin: 0;
}

.dashboard-stats-mobile-line + .dashboard-stats-mobile-line {
    margin-top: 0.2rem;
}

.dashboard-stats-mobile a {
    color: inherit;
    text-decoration: none;
}

.dashboard-stats-mobile a:hover strong {
    color: var(--ui-primary, #173f35);
}

.dashboard-stats-sep {
    margin-inline: 0.35rem;
    color: var(--ink-faint, #94a3b8);
}

.dashboard-stats-desktop,
.dashboard-stats-tablet {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.dashboard-stats-tablet {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-stat-card {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 0.1rem 0.55rem;
    min-height: 5.75rem;
    padding: 0.85rem 1rem;
    text-decoration: none;
    color: inherit;
}

.dashboard-stat-card--link:hover .dashboard-stat-value {
    color: var(--ui-primary, #173f35);
}

.dashboard-stat-icon {
    grid-row: 1 / span 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.55rem;
    background: color-mix(in srgb, var(--ui-primary, #173f35) 8%, transparent);
    color: var(--ink-muted, #64748b);
}

.dashboard-stat-icon .app-ico {
    width: 1rem;
    height: 1rem;
}

.dashboard-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--ink, #0f172a);
}

.dashboard-stat-label {
    grid-column: 2;
    font-size: 0.8125rem;
    color: var(--ink-muted, #64748b);
}

.dashboard-content-grid {
    margin-top: 0.25rem;
}

.dashboard-main-col,
.dashboard-side-col {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    min-width: 0;
}

.dashboard-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.dashboard-section-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ink, #0f172a);
}

.dashboard-section-link {
    flex-shrink: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ui-primary, #173f35);
    text-decoration: none;
    white-space: nowrap;
}

.dashboard-section-link:hover {
    text-decoration: underline;
}

.dashboard-recent-panel {
    padding: 1rem 1rem 0.35rem;
}

.dashboard-doc-list {
    display: flex;
    flex-direction: column;
}

.dashboard-doc-row {
    display: flex;
    align-items: stretch;
    gap: 0.35rem;
    border-top: 1px solid color-mix(in srgb, var(--ink, #0f172a) 8%, transparent);
}

.dashboard-doc-row:first-child {
    border-top: 0;
}

.dashboard-doc-row-main {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.75rem 0.25rem 0.75rem 0;
    color: inherit;
    text-decoration: none;
}

.dashboard-doc-row-main:hover .dashboard-doc-row-title {
    color: var(--ui-primary, #173f35);
}

.dashboard-doc-row-title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.35;
    color: var(--ink, #0f172a);
}

.dashboard-doc-row-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin: 0.25rem 0 0;
    font-size: 0.8125rem;
    color: var(--ink-muted, #64748b);
}

.dashboard-doc-meta-sep {
    color: var(--ink-faint, #94a3b8);
}

.dashboard-doc-dropdown {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.dashboard-doc-menu-btn {
    min-width: 2.75rem;
    min-height: 2.75rem;
}

.dashboard-empty {
    margin: 0.25rem 0 0.85rem;
    padding: 1rem;
    background: color-mix(in srgb, var(--ink, #0f172a) 3%, transparent);
    border: 1px dashed color-mix(in srgb, var(--ink, #0f172a) 12%, transparent);
}

.dashboard-empty-title {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.9375rem;
}

.dashboard-empty-body {
    margin: 0 0 0.75rem;
    font-size: 0.8125rem;
    color: var(--ink-muted, #64748b);
}

.dashboard-quick-actions {
    padding: 1rem;
}

.dashboard-quick-actions-list {
    list-style: none;
    margin: 0.65rem 0 0;
    padding: 0;
}

.dashboard-quick-action {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 2.75rem;
    padding: 0.45rem 0.35rem;
    border-radius: 0.45rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink, #0f172a);
    text-decoration: none;
}

.dashboard-quick-action:hover {
    background: color-mix(in srgb, var(--ui-primary, #173f35) 6%, transparent);
    color: var(--ui-primary, #173f35);
}

.dashboard-quick-action .app-ico {
    width: 1rem;
    height: 1rem;
    color: var(--ink-muted, #64748b);
}

.dashboard-template-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.dashboard-template-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 2.75rem;
    padding: 0.55rem 0;
    border-top: 1px solid color-mix(in srgb, var(--ink, #0f172a) 8%, transparent);
}

.dashboard-template-row:first-child {
    border-top: 0;
}

.dashboard-template-name {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
}

.dashboard-template-desc {
    margin: 0.15rem 0 0;
    font-size: 0.75rem;
    color: var(--ink-muted, #64748b);
}

.dashboard-template-use {
    flex-shrink: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ui-primary, #173f35);
    text-decoration: none;
    white-space: nowrap;
}

.dashboard-template-use:hover {
    text-decoration: underline;
}

@media (max-width: 767.98px) {
    .dashboard-doc-row-main {
        padding-block: 0.85rem;
    }

    .dashboard-section-head .dashboard-section-link {
        font-size: 0.75rem;
    }
}

@media (min-width: 992px) and (max-width: 1199.98px) {
    .dashboard-stat-card {
        min-height: 5.25rem;
    }

    .dashboard-stat-value {
        font-size: 1.6rem;
    }
}

.content-hub-app-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.15rem 1.2rem 1.25rem;
    border: 1px solid color-mix(in srgb, var(--ink, #0f172a) 10%, transparent);
    border-radius: 0.85rem;
    background: color-mix(in srgb, var(--surface, #fff) 96%, var(--ink, #0f172a));
}

.content-hub-app-section + .content-hub-app-section {
    margin-top: 0.25rem;
}

.content-hub-app-head {
    margin-bottom: 0.15rem;
}

.content-hub-app-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink, #0f172a);
}

.content-hub-app-desc {
    margin: 0.3rem 0 0;
    font-size: 0.8125rem;
    color: var(--ink-muted, #64748b);
    line-height: 1.45;
}

.content-hub-app-section .content-hub-group {
    margin-top: 0.35rem;
}

.content-hub-app-section .content-hub-group + .content-hub-group {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid color-mix(in srgb, var(--ink, #0f172a) 7%, transparent);
}

.content-hub-group-title {
    margin: 0 0 0.65rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.content-hub-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .content-hub-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1100px) {
    .content-hub-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.content-hub-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.95rem 1rem;
    color: inherit;
    text-decoration: none;
    transition:
        background-color var(--motion-fast) ease,
        border-color var(--motion-fast) ease,
        box-shadow var(--motion-fast) ease,
        transform var(--motion-fast) var(--ease-out);
}

.content-hub-card:hover,
.content-hub-card:focus-visible {
    border-color: color-mix(in srgb, var(--ui-accent, #c58f38) 35%, var(--line));
    background: color-mix(in srgb, var(--ui-accent, #c58f38) 5%, #ffffff);
    box-shadow: 0 4px 14px rgb(15 23 42 / 0.06);
    transform: translateY(-1px);
}

.content-hub-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    flex-shrink: 0;
    border-radius: 0.85rem;
    background: color-mix(in srgb, var(--ui-primary, #173f35) 8%, #ffffff);
    color: var(--ui-primary, #173f35);
}

.content-hub-card-icon .app-ico {
    width: 1.15rem;
    height: 1.15rem;
}

.content-hub-card-body {
    min-width: 0;
    flex: 1;
}

.content-hub-card-title {
    display: block;
    font-size: 0.95rem;
    font-weight: 650;
    color: var(--ink);
}

.content-hub-card-desc {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.75rem;
    line-height: 1.35;
    color: var(--ink-faint);
}

.content-hub-card-count {
    flex-shrink: 0;
    min-width: 1.75rem;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: #f1f5f9;
    font-size: 0.75rem;
    font-weight: 700;
    color: #475569;
    text-align: center;
}

.content-hub-card-go {
    flex-shrink: 0;
    color: var(--ink-faint);
}

.content-hub-card-go .app-ico {
    width: 1rem;
    height: 1rem;
    transition: transform var(--motion-fast) ease, color var(--motion-fast) ease;
}

.content-hub-card:hover .content-hub-card-go,
.content-hub-card:focus-visible .content-hub-card-go {
    color: var(--ui-primary, #173f35);
}

.content-hub-card:hover .content-hub-card-go .app-ico,
.content-hub-card:focus-visible .content-hub-card-go .app-ico {
    transform: translateX(2px);
}

.content-page-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ink-faint);
    text-decoration: none;
}

.content-page-back:hover {
    color: var(--ui-primary, #173f35);
}

.content-page-back .app-ico {
    width: 1rem;
    height: 1rem;
}

.settings-nav-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ink-faint);
    text-decoration: none;
}

.settings-nav-back:hover {
    color: var(--ui-primary, #173f35);
}

/* Tables */
.app-table-wrap {
    overflow: auto;
}

.app-table {
    width: 100%;
    min-width: 42rem;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.app-table th {
    text-align: left;
    font-weight: 600;
    color: var(--ink-faint);
    border-bottom: 1px solid var(--line);
    padding: 0.55rem 0.75rem;
    white-space: nowrap;
}

.app-table td {
    border-bottom: 1px solid #f1f5f9;
    padding: 0.65rem 0.75rem;
    vertical-align: middle;
}

.app-table tbody tr:hover {
    background: #fafbfc;
}

.app-table--nav tbody tr.app-table-row--nav {
    cursor: pointer;
}

.app-table--nav tbody tr.app-table-row--nav:hover,
.app-table--nav tbody tr.app-table-row--nav:focus-visible {
    background: color-mix(in srgb, var(--ui-accent, #c58f38) 7%, #ffffff);
}

.app-table--nav tbody tr.app-table-row--nav:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--ui-accent, #c58f38) 55%, #cbd5e1);
    outline-offset: -2px;
}

.app-table--nav .row-title {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
    color: var(--ui-primary, #173f35);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--ui-primary, #173f35) 28%, transparent);
    text-underline-offset: 0.14em;
}

.app-table--nav tbody tr.app-table-row--nav:hover .row-title,
.app-table--nav tbody tr.app-table-row--nav:focus-visible .row-title {
    text-decoration-color: currentColor;
}

.app-table-row-go {
    width: 2.25rem;
    padding-left: 0.25rem !important;
    padding-right: 0.75rem !important;
    text-align: right;
    color: var(--ink-faint);
}

.app-table-row-go .app-ico {
    width: 1rem;
    height: 1rem;
    transition: transform var(--motion-fast) ease, color var(--motion-fast) ease;
}

.app-table--nav tbody tr.app-table-row--nav:hover .app-table-row-go,
.app-table--nav tbody tr.app-table-row--nav:focus-visible .app-table-row-go {
    color: var(--ui-primary, #173f35);
}

.app-table--nav tbody tr.app-table-row--nav:hover .app-table-row-go .app-ico,
.app-table--nav tbody tr.app-table-row--nav:focus-visible .app-table-row-go .app-ico {
    transform: translateX(2px);
}

.app-table-hint {
    margin: 0;
    padding: 0.65rem 0.75rem 0;
    font-size: 0.75rem;
    color: var(--ink-faint);
}

.app-table a.row-title {
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
}

.app-table a.row-title:hover {
    color: var(--ui-primary, #173f35);
}

.app-truncate {
    max-width: 16rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.12rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 650;
    letter-spacing: 0.01em;
}

.app-badge-draft {
    background: #f1f5f9;
    color: #334155;
}

.app-badge-generated {
    background: #d1fae5;
    color: #065f46;
}

.app-badge-ready {
    background: #eff6ff;
    color: #1d4ed8;
}

.app-tag {
    display: inline-flex;
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    padding: 0.05rem 0.45rem;
    font-size: 0.7rem;
    font-weight: 550;
}

.draft-tags-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.draft-tags-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    min-height: var(--app-control-h, 2.75rem);
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #fff;
}

.draft-tags-box:focus-within {
    border-color: color-mix(in srgb, var(--tb-primary, #173f35) 45%, var(--line));
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--tb-primary, #173f35) 18%, transparent);
}

.draft-tags-chips {
    display: contents;
}

.draft-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.1rem;
    max-width: 100%;
    min-height: 1.75rem;
    padding: 0.15rem 0.2rem 0.15rem 0.55rem;
    border-radius: 999px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
    line-height: 1.2;
}

.draft-tag-chip-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.draft-tag-chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #94a3b8;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
}

.draft-tag-chip-remove:hover {
    background: #e2e8f0;
    color: #be123c;
}

.draft-tag-add-btn {
    min-height: 1.75rem !important;
    height: 1.75rem;
    padding: 0 0.55rem !important;
    font-size: 0.8125rem;
    border-style: dashed;
}

.draft-tag-compose {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
}

.draft-tag-compose .form-control {
    flex: 1 1 auto;
    min-width: 0;
}

.draft-tag-compose .app-btn {
    flex: 0 0 auto;
}

.app-empty {
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius-lg);
    background: #fff;
    padding: 2rem 1.25rem;
    text-align: center;
    color: var(--ink-muted);
    font-size: 0.875rem;
}

.app-empty strong {
    display: block;
    color: var(--ink);
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.app-tabs {
    display: flex;
    gap: 0.15rem;
    margin-bottom: 0.85rem;
    border-bottom: 1px solid var(--line);
}

.app-tabs a {
    padding: 0.5rem 0.7rem;
    color: var(--ink-muted);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 550;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.app-tabs a.is-active {
    color: var(--ink);
    border-bottom-color: var(--ui-accent, #c58f38);
    font-weight: 650;
}

.app-search-bar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.85rem;
}

.app-search-bar input[type="search"],
.app-search-bar select {
    height: 2.25rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #fff;
    padding: 0 0.7rem;
    font-size: 0.8125rem;
}

.app-search-bar input[type="search"] {
    min-width: 0;
    width: auto;
    flex: 1 1 auto;
}

.app-search-bar select {
    width: auto;
    min-width: 7.5rem;
    max-width: 10.5rem;
    flex: 0 0 auto;
}

.app-search-bar .btn,
.app-search-bar .app-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* Settings */
.settings-layout {
    display: grid;
    gap: 1.25rem;
}

@media (min-width: 960px) {
    .settings-layout {
        grid-template-columns: 200px minmax(0, 1fr);
        align-items: start;
    }
}

.settings-nav {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: #fff;
    padding: 0.65rem;
}

.settings-nav a {
    display: block;
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.55rem;
    color: #334155;
    text-decoration: none;
    font-size: 0.8125rem;
}

.settings-nav a.is-active {
    background: color-mix(in srgb, var(--ui-primary, #173f35) 10%, #ffffff);
    color: color-mix(in srgb, var(--ui-primary, #173f35) 82%, #0f172a);
    font-weight: 600;
}

.settings-nav-title {
    margin: 0 0.55rem 0.35rem;
    font-size: 0.68rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.settings-group {
    margin-bottom: 1rem;
}

.settings-group-title {
    margin: 0.75rem 0.55rem 0.25rem;
    font-size: 0.68rem;
    font-weight: 650;
    color: var(--ink-faint);
}

/* Editor */
.editor-page {
    display: flex;
    min-height: 100%;
    flex-direction: column;
}

.editor-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
    border-bottom: 1px solid var(--line);
    background: #fff;
    padding: 0.65rem 1rem;
    position: sticky;
    top: 0;
    z-index: 8;
}

.editor-header-title {
    min-width: 0;
    flex: 1;
}

.editor-header-title h1 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.editor-save-state {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    font-size: 0.75rem;
    color: var(--ink-faint);
}

.editor-save-state::before {
    content: "";
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 999px;
    background: #22c55e;
    flex-shrink: 0;
}

.editor-save-state.is-dirty {
    color: #92400e;
    font-weight: 600;
}

.editor-save-state.is-dirty::before {
    background: #f59e0b;
    box-shadow: 0 0 0 3px rgb(245 158 11 / 0.18);
}

.editor-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.editor-action-bar {
    display: grid;
    grid-template-columns: auto minmax(7rem, 1fr) auto;
    align-items: center;
    gap: 0.5rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #fff;
    padding: 0.35rem 0.65rem;
}

.editor-section-nav {
    display: inline-flex;
    align-items: stretch;
    flex-shrink: 0;
    min-width: max-content;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    overflow: visible;
    background: #f8fafc;
}

.editor-section-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    height: 2rem;
    padding: 0 0.55rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #64748b;
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    white-space: nowrap;
}

.editor-section-nav-btn + .editor-section-nav-btn {
    border-left: 1px solid var(--line);
}

.editor-section-nav-btn:hover:not(:disabled) {
    background: #f1f5f9;
    color: var(--ink);
}

.editor-section-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.editor-section-nav-btn .app-ico {
    width: 1rem;
    height: 1rem;
}

.editor-action-bar-buttons {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex-shrink: 1;
    min-width: 0;
}

.editor-action-save-state {
    justify-self: start;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.editor-action-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 2rem;
    padding: 0.3rem 0.65rem;
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}

.editor-action-bar .editor-action-btn .app-ico {
    width: 1rem;
    height: 1rem;
}

.editor-action-bar .app-btn-secondary {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: var(--ink);
}

.editor-action-bar .app-btn-secondary:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: var(--ink);
}

@media (min-width: 1024px) {
    .editor-header {
        display: none;
    }

    .editor-layout {
        grid-template-rows: auto minmax(0, 1fr);
    }

    .editor-action-bar {
        grid-column: 2;
        grid-row: 1;
        position: sticky;
        top: 0;
        z-index: 6;
        flex-shrink: 0;
        margin: 0.75rem 1rem 0.35rem;
    }

    .editor-layout.has-preview .editor-action-bar {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-rows: auto auto;
        align-items: center;
    }

    .editor-layout.has-preview .editor-section-nav {
        grid-column: 1;
        grid-row: 2;
    }

    .editor-layout.has-preview .editor-action-save-state {
        grid-column: 2;
        grid-row: 2;
        justify-self: start;
    }

    .editor-layout.has-preview .editor-action-bar-buttons {
        grid-column: 1 / -1;
        grid-row: 1;
        justify-content: flex-end;
    }

    .editor-canvas {
        grid-column: 2;
        grid-row: 2;
        min-height: 0;
        padding: 0 0 1rem;
        overflow: auto;
    }

    .editor-action-save-state {
        font-size: 0.75rem;
    }

    .editor-canvas > .draft-form-section {
        margin: 0 1rem 1rem;
    }

    .editor-layout.has-preview .editor-preview {
        grid-column: 3;
        grid-row: 1 / span 2;
    }

    .editor-layout.invoice-editor-layout.has-preview .editor-preview {
        grid-column: 2;
    }

    .editor-steps {
        grid-column: 1;
        grid-row: 1 / span 2;
    }
}

.editor-layout {
    display: grid;
    grid-template-columns: 1fr;
    flex: 1;
    min-height: 0;
}

@media (min-width: 1024px) {
    .editor-layout {
        grid-template-columns: 200px minmax(0, 1fr);
    }

    .editor-layout.has-preview {
        --editor-preview-width: 520px;
        grid-template-columns: 200px minmax(0, 1fr) minmax(320px, var(--editor-preview-width));
    }

    .editor-layout.invoice-editor-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .editor-layout.invoice-editor-layout.has-preview {
        --editor-preview-width: 520px;
        grid-template-columns: minmax(0, 1fr) minmax(320px, var(--editor-preview-width));
    }

    .editor-layout.invoice-editor-layout .editor-action-bar {
        grid-column: 1;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .editor-layout.invoice-editor-layout .editor-action-bar-buttons {
        flex-wrap: wrap;
        justify-content: flex-end;
        max-width: 100%;
    }

    .editor-layout.invoice-editor-layout .editor-canvas {
        grid-column: 1;
    }
}

.editor-steps {
    border-bottom: 1px solid var(--line);
    background: var(--ui-chrome-bg, #fbfbfc);
    padding: 0.65rem;
    overflow: auto;
}

@media (min-width: 1024px) {
    .editor-steps {
        border-bottom: 0;
        border-right: 1px solid var(--line);
    }
}

.editor-steps button {
    display: flex;
    width: 100%;
    align-items: flex-start;
    gap: 0.55rem;
    border: 0;
    background: transparent;
    border-radius: var(--radius-md);
    padding: 0.5rem 0.55rem;
    text-align: left;
    cursor: pointer;
    color: #334155;
}

.editor-steps button:hover {
    background: #eef1f4;
}

.editor-steps button.is-active {
    background: #fff;
    box-shadow: inset 0 0 0 1px var(--line);
    color: var(--ink);
    font-weight: 650;
}

.editor-step-index {
    display: inline-flex;
    height: 1.5rem;
    width: 1.5rem;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #e2e8f0;
    font-size: 0.7rem;
    font-weight: 700;
}

.editor-step-index .app-ico {
    width: 0.85rem;
    height: 0.85rem;
}

.editor-steps button.is-active .editor-step-index {
    background: var(--ui-accent, #c58f38);
    color: #fff;
}

.editor-step-copy {
    min-width: 0;
}

.editor-step-copy small {
    display: block;
    font-weight: 400;
    color: var(--ink-faint);
    font-size: 0.7rem;
}

.editor-canvas {
    min-width: 0;
    overflow: auto;
    padding: 1rem 1.1rem 2rem;
}

.editor-preview {
    display: none;
    position: relative;
    border-left: 1px solid var(--line);
    background: #ececec;
    min-height: 0;
    min-width: 0;
}

@media (min-width: 1024px) {
    .editor-layout.has-preview .editor-preview {
        display: flex;
        flex-direction: column;
    }
}

.editor-preview-resizer {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 3;
    width: 10px;
    transform: translateX(-50%);
    cursor: col-resize;
    touch-action: none;
}

.editor-preview-resizer::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: transparent;
    transition: background-color var(--motion-fast) ease;
}

.editor-preview-resizer:hover::after,
.editor-preview-resizer:focus-visible::after,
body.is-editor-preview-resizing .editor-preview-resizer::after {
    background: color-mix(in srgb, var(--ui-accent, #c58f38) 55%, #cbd5e1);
}

.editor-preview-viewport {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0.65rem;
    background: #ececec;
}

.editor-preview-frame {
    margin: 0 auto;
    width: 100%;
    max-width: 210mm;
}

.editor-preview-frame iframe {
    display: block;
    width: 100%;
    min-height: 70vh;
    height: 1200px;
    border: 0;
    background: #fff;
    box-shadow: 0 10px 28px rgb(15 23 42 / 0.14);
}

.editor-preview-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border-bottom: 1px solid var(--line);
    background: #fff;
    padding: 0.45rem 0.7rem;
    font-size: 0.75rem;
    color: var(--ink-muted);
}

.editor-preview-bar-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.editor-preview-zoom {
    display: inline-flex;
    align-items: center;
    gap: 0.1rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #f8fafc;
    padding: 0.1rem;
}

.editor-preview-zoom-btn {
    width: 1.75rem;
    height: 1.75rem;
    min-height: 0;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    font-weight: 650;
}

.editor-preview-zoom-value {
    min-width: 2.75rem;
    text-align: center;
    font-size: 0.68rem;
    font-weight: 650;
    color: var(--ink-muted);
}

body.is-editor-preview-resizing {
    cursor: col-resize;
    user-select: none;
}

body.is-editor-preview-resizing iframe {
    pointer-events: none;
}

.draft-form-section h1,
.draft-form-section > h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.draft-form-section > p {
    margin: 0.35rem 0 0;
    color: var(--ink-muted);
    font-size: 0.8125rem;
}

/* Inputs inside app */
.app-main input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="range"]):not([type="color"]),
.app-main select,
.app-main textarea,
.editor-canvas input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="range"]):not([type="color"]),
.editor-canvas select,
.editor-canvas textarea {
    border-radius: var(--radius-md);
}

.editor-canvas input[type="date"],
.editor-canvas input[type="datetime-local"],
.editor-canvas input[type="time"] {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.editor-date-field {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin-top: 0.25rem;
    overflow: hidden;
}

.editor-date-input {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.editor-canvas input[type="date"]::-webkit-date-and-time-value,
.editor-canvas input[type="date"]::-webkit-datetime-edit,
.editor-canvas input[type="date"]::-webkit-datetime-edit-fields-wrapper {
    min-width: 0;
    text-align: left;
}

.editor-canvas input[type="date"]::-webkit-calendar-picker-indicator {
    margin: 0;
    padding: 0;
}

.editor-canvas .grid,
.editor-canvas label.block,
.editor-canvas .app-form-field {
    min-width: 0;
    max-width: 100%;
}

/* Form field + combobox primitives */
.app-form-field {
    display: block;
}

.app-form-label {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
}

.app-form-helper {
    margin: 0.2rem 0 0.45rem;
    font-size: 0.8125rem;
    color: var(--ink-faint);
    line-height: 1.4;
}

.app-combobox {
    position: relative;
    width: 100%;
}

.app-combobox-input {
    width: 100%;
    padding-right: 2.75rem;
}

.app-combobox-toggle {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    min-width: var(--app-touch);
    border: 0;
    border-left: 1px solid var(--line);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    background: #f8fafc;
    color: var(--ink-muted);
    padding: 0;
    cursor: pointer;
}

.app-combobox-toggle:hover {
    background: #f1f5f9;
    color: var(--ink);
}

.app-combobox-toggle svg {
    width: 1.25rem;
    height: 1.25rem;
    pointer-events: none;
}

.app-combobox-list {
    position: absolute;
    z-index: 40;
    top: calc(100% + 0.25rem);
    left: 0;
    right: 0;
    margin: 0;
    padding: 0.25rem 0;
    list-style: none;
    max-height: 14rem;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #fff;
    box-shadow: var(--shadow-sm);
}

.app-combobox-option {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.app-combobox-option:hover,
.app-combobox-option[aria-selected="true"] {
    background: color-mix(in srgb, var(--ui-accent, #c58f38) 8%, #ffffff);
}

/* Activity log — compact mobile event rows */
.mobile-audit-list {
    display: none;
}

.mobile-audit-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: transparent;
    padding: 0.75rem 1rem;
    text-align: left;
    cursor: pointer;
    color: inherit;
    font: inherit;
    min-height: var(--app-touch);
}

.mobile-audit-card:last-child {
    border-bottom: 0;
}

.mobile-audit-card-type {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 650;
    color: var(--ink);
}

.mobile-audit-card-user {
    margin: 0.15rem 0 0;
    font-size: 0.8125rem;
    color: var(--ink-muted);
}

.mobile-audit-card-meta {
    margin: 0.15rem 0 0;
    font-size: 0.75rem;
    color: var(--ink-faint);
    line-height: 1.35;
}

.mobile-audit-card-chevron {
    flex-shrink: 0;
    color: var(--ink-faint);
    font-size: 1.25rem;
    line-height: 1;
}

.day-card,
.pricing-card,
.hotel-row {
    border-radius: var(--radius-md) !important;
}

.app-row-menu {
    position: relative;
}

.app-row-menu > summary {
    list-style: none;
    display: inline-flex;
    height: 1.9rem;
    width: 1.9rem;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: #64748b;
}

.app-row-menu > summary::-webkit-details-marker {
    display: none;
}

.app-row-menu > summary:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.mobile-sidebar {
    display: none;
}

/* Desktop defaults for mobile-only UI */
.mobile-only {
    display: none !important;
}

.desktop-only {
    display: block;
}

.desktop-only-flex {
    display: flex;
}

.desktop-only-grid {
    display: grid;
}

.app-sheet {
    border: 0;
    padding: 0;
    margin: 0;
    max-width: 100%;
    width: 100%;
    max-height: min(85vh, 36rem);
    border-radius: 16px 16px 0 0;
    background: #fff;
    box-shadow: 0 -8px 32px rgb(15 23 42 / 0.18);
}

.app-sheet::backdrop {
    background: rgb(15 23 42 / 0.4);
}

.app-sheet-handle {
    width: 2.25rem;
    height: 0.25rem;
    margin: 0.55rem auto 0.35rem;
    border-radius: 999px;
    background: #cbd5e1;
}

.app-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.35rem 1rem 0.75rem;
}

.app-sheet-body {
    padding: 0.75rem 1rem calc(1rem + var(--app-safe-bottom));
    overflow: auto;
}

.mobile-metrics {
    display: none;
}

.mobile-itinerary-list {
    display: none;
}

.draft-row-actions,
.mobile-itinerary-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.1rem;
    flex-shrink: 0;
}

.draft-row-action-form {
    margin: 0;
    display: inline-flex;
}

.draft-row-action-item {
    display: inline-flex;
}

.draft-row-delete {
    color: #be123c;
}

.draft-row-delete:hover {
    background: #fff1f2;
    color: #9f1239;
}

.draft-row-dropdown-menu {
    min-width: 11rem;
    padding: 0.35rem;
}

.draft-row-dropdown-menu > li {
    margin: 0;
}

.draft-row-dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 0;
    border-radius: calc(var(--radius-md) - 2px);
    background: transparent;
    color: var(--ink);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.35;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
}

.draft-row-dropdown-menu .dropdown-item .app-ico {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    color: #64748b;
}

.draft-row-dropdown-menu button.dropdown-item {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.draft-row-dropdown-menu .dropdown-item:hover,
.draft-row-dropdown-menu .dropdown-item:focus {
    background: #f1f5f9;
    color: var(--ink);
}

.draft-row-hidden-form {
    display: none;
}

.mobile-search-row {
    display: none;
}

.settings-mobile-trigger {
    display: none;
}

.editor-steps-mobile {
    display: none;
}

#draft-unsaved-banner[hidden],
#draft-unsaved-banner:empty,
#draft-unsaved-banner:not(.is-visible) {
    display: none !important;
}

.app-draft-toast {
    position: fixed;
    left: 50%;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    z-index: 1088;
    width: min(34rem, calc(100vw - 2rem));
    transform: translateX(-50%);
    pointer-events: none;
}

.app-draft-toast.is-visible {
    pointer-events: auto;
}

.app-draft-toast.is-visible .app-draft-toast-inner {
    animation: app-draft-toast-in var(--motion) var(--ease-out) both;
}

.app-draft-toast-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    border: 1px solid #fde68a;
    border-radius: var(--radius-lg);
    background: #fffbeb;
    padding: 0.8rem 0.9rem;
    box-shadow: 0 12px 32px rgb(15 23 42 / 0.14);
}

.app-draft-toast-copy {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    min-width: 0;
}

.app-draft-toast-dot {
    width: 0.55rem;
    height: 0.55rem;
    margin-top: 0.35rem;
    border-radius: 999px;
    background: #f59e0b;
    box-shadow: 0 0 0 4px rgb(245 158 11 / 0.16);
    flex-shrink: 0;
}

.app-draft-toast-text {
    min-width: 0;
}

.app-draft-toast-title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.35;
    color: #78350f;
}

.app-draft-toast-recovered {
    margin: 0.2rem 0 0;
    font-size: 0.75rem;
    line-height: 1.3;
    color: #92400e;
}

.app-draft-toast-save {
    flex-shrink: 0;
    min-height: 2.25rem;
    padding: 0.4rem 0.9rem;
    font-size: 0.8125rem;
}

@keyframes app-draft-toast-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 991.98px) {
    .app-draft-toast {
        left: 1rem;
        right: 1rem;
        width: auto;
        max-width: none;
        transform: none;
        bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    }

    .app-draft-toast-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .app-draft-toast-save {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .editor-save-state {
        font-size: 0.7rem;
    }
}

@media (max-width: 991.98px) {
    body.app-body.is-authed {
        overflow: auto;
    }

    .app-shell {
        display: block;
        height: auto;
        min-height: 100%;
    }

    /* Mobile nav uses Bootstrap Offcanvas; do not override transform/visibility. */
    .app-shell.is-collapsed .app-sidebar-brand-text,
    .app-shell.is-collapsed .app-nav-label,
    .app-shell.is-collapsed .app-nav-section-title {
        display: block;
    }

    .app-user-name {
        display: none;
    }

    .app-table {
        min-width: 0;
    }

    .hide-mobile {
        display: none !important;
    }

    .app-topbar {
        padding: 0 0.5rem 0 0.25rem;
        position: sticky;
        top: 0;
        z-index: 30;
    }

    .app-topbar-page {
        max-width: calc(100% - 7.5rem);
    }

    .app-topbar-page-logo {
        width: 1.625rem;
        height: 1.625rem;
    }

    .app-topbar-page-title {
        font-size: 1.0625rem;
    }

    .app-admin-chip {
        display: none;
    }

    .app-main {
        padding: 0.65rem var(--app-page-pad) calc(1rem + var(--app-safe-bottom));
    }

    .app-page-title {
        font-size: 1.75rem;
    }

    .app-section-title,
    .draft-form-section > h2 {
        font-size: 1.25rem;
    }

    .app-form-label {
        font-size: 1rem;
    }

    .app-form-helper {
        font-size: 0.8125rem;
    }

    .app-page-subtitle {
        font-size: 0.8125rem;
    }

    .app-page-header {
        margin-bottom: 0.55rem;
        gap: 0.65rem;
    }

    .app-page-header-actions {
        width: 100%;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 0.45rem;
    }

    .app-page-header-actions .app-btn {
        flex: 1 1 0;
        min-width: 0;
        min-height: var(--app-touch);
        justify-content: center;
    }

    .app-btn {
        min-height: var(--app-touch);
        padding: 0.65rem 0.9rem;
    }

    .app-main input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="range"]):not([type="color"]),
    .app-main select,
    .editor-canvas input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="range"]):not([type="color"]),
    .editor-canvas select {
        min-height: var(--app-control-h);
        font-size: 16px; /* avoid iOS zoom */
    }

    /* Compact metrics strip */
    .app-metric-grid.desktop-only-grid,
    .desktop-only-grid.app-metric-grid {
        display: none;
    }

    .mobile-metrics {
        display: flex;
        flex-wrap: wrap;
        gap: 0.35rem 0.75rem;
        margin-bottom: 0.55rem;
        padding: 0.5rem 0.65rem;
        border: 1px solid var(--line);
        border-radius: var(--radius-lg);
        background: #fff;
        font-size: 0.8125rem;
        color: var(--ink-muted);
    }

    .mobile-metrics a {
        color: inherit;
        text-decoration: none;
        font-weight: 550;
    }

    .mobile-metrics strong {
        color: var(--ink);
        font-weight: 700;
    }

    .mobile-metrics .sep {
        color: #cbd5e1;
    }

    /* Settings: hide full nav card; show compact trigger */
    .settings-layout {
        display: block;
    }

    .settings-nav.desktop-settings-nav {
        display: none;
    }

    .settings-mobile-trigger {
        display: flex;
        width: 100%;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        min-height: var(--app-touch);
        margin-bottom: 0.85rem;
        border: 1px solid var(--line);
        border-radius: var(--radius-md);
        background: #fff;
        padding: 0.65rem 0.85rem;
        font-size: 0.875rem;
        font-weight: 600;
        color: var(--ink);
        cursor: pointer;
        text-align: left;
    }

    .settings-mobile-trigger small {
        display: block;
        margin-top: 0.1rem;
        font-size: 0.7rem;
        font-weight: 500;
        color: var(--ink-faint);
    }

    .app-crumbs {
        margin-bottom: 0.5rem;
    }

    .app-crumbs .crumb-desktop {
        display: none;
    }

    /* Editor: keep topbar as menu + page title + account only */
    .editor-header {
        display: none;
    }

    .editor-layout {
        display: flex;
        flex-direction: column;
    }

    .editor-steps {
        display: none;
    }

    .editor-steps-mobile {
        display: flex;
        flex-wrap: nowrap;
        gap: 0.35rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-bottom: 1px solid var(--line);
        background: #fff;
        padding: 0.5rem var(--editor-page-pad, 0.65rem);
        scrollbar-width: none;
    }

    .editor-steps-mobile::-webkit-scrollbar {
        display: none;
    }

    .editor-steps-mobile button {
        flex: 0 0 auto;
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        min-height: var(--app-touch);
        border: 1px solid var(--line);
        border-radius: 999px;
        background: #fff;
        padding: 0.35rem 0.7rem;
        font-size: 0.8125rem;
        font-weight: 600;
        color: #475569;
        white-space: nowrap;
        cursor: pointer;
    }

    .editor-steps-mobile button.is-active {
        border-color: color-mix(in srgb, var(--ui-accent, #c58f38) 45%, #e2e8f0);
        background: color-mix(in srgb, var(--ui-accent, #c58f38) 12%, #ffffff);
        color: var(--ink);
    }

    .editor-steps-mobile .editor-step-index {
        height: 1.1rem;
        width: 1.1rem;
        font-size: 0.65rem;
    }

    .editor-action-bar {
        position: sticky;
        top: 0;
        z-index: 7;
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-rows: auto auto auto;
        gap: 0.35rem;
        padding: 0.35rem var(--editor-page-pad, 0.65rem);
        margin: 0;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        border-top: 0;
    }

    .editor-section-nav {
        grid-column: 1;
        grid-row: 3;
    }

    .editor-action-save-state {
        display: flex;
        grid-column: 1 / -1;
        grid-row: 2;
        max-width: 100%;
    }

    .editor-action-bar-buttons {
        grid-column: 1 / -1;
        grid-row: 1;
        justify-self: stretch;
        justify-content: flex-end;
        flex-wrap: wrap;
        max-width: 100%;
    }

    .editor-layout.invoice-editor-layout .editor-action-bar {
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-rows: auto;
    }

    .editor-layout.invoice-editor-layout .editor-action-save-state {
        grid-column: 1;
        grid-row: 1;
    }

    .editor-layout.invoice-editor-layout .editor-action-bar-buttons {
        grid-column: 2;
        grid-row: 1;
        flex-wrap: wrap;
        max-width: min(100%, 100vw);
    }

    .editor-section-nav-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .editor-section-nav-btn {
        width: var(--app-touch);
        min-width: var(--app-touch);
        height: var(--app-touch);
        min-height: var(--app-touch);
        padding: 0;
    }

    .editor-section-nav-btn .app-ico {
        width: 1.25rem;
        height: 1.25rem;
    }

    .editor-action-btn {
        flex: 1 1 0;
        min-width: 0;
        min-height: 2.35rem;
        padding: 0.45rem 0.5rem;
        font-size: 0.875rem;
    }

    .editor-action-bar .editor-action-btn .app-ico {
        width: 1.2rem;
        height: 1.2rem;
    }

    .editor-action-label {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .editor-canvas {
        padding: 0.65rem var(--editor-page-pad, 0.65rem) calc(1rem + var(--app-safe-bottom));
        overflow-x: clip;
    }

    body.is-editor .editor-canvas .sm\:col-span-2,
    body.is-editor .editor-canvas .md\:col-span-2 {
        grid-column: 1 / -1 !important;
    }

    body.is-editor .editor-canvas .grid-cols-2,
    body.is-editor .editor-canvas .md\:grid-cols-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    body.is-editor .editor-canvas input[type="date"],
    body.is-editor .editor-canvas .editor-date-input {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding-left: 0.65rem !important;
        padding-right: 0.65rem !important;
    }

    body.is-editor {
        --editor-page-pad: 0.65rem;
    }

    body.is-editor .editor-canvas .p-4 {
        padding: 0.75rem !important;
    }

    body.is-editor .editor-canvas .p-5 {
        padding: 0.85rem !important;
    }

    .editor-canvas input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="range"]):not([type="color"]),
    .editor-canvas select,
    .editor-canvas textarea {
        scroll-margin-bottom: calc(1rem + var(--app-safe-bottom));
    }

    .editor-preview {
        display: none !important;
    }

    .draft-form-section.app-panel {
        border: 0;
        border-radius: 0;
        padding: 0;
        background: transparent;
    }

    .draft-form-section .helper-long {
        display: none;
    }

    /* Progressive disclosure helpers */
    .mobile-collapse-summary {
        display: flex;
        width: 100%;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        min-height: var(--app-touch);
        border: 0;
        background: transparent;
        padding: 0 0 0.5rem;
        margin: 0 0 0.5rem;
        border-bottom: 1px solid var(--line);
        text-align: left;
        cursor: pointer;
        font: inherit;
        appearance: none;
        -webkit-appearance: none;
        color: inherit;
    }

    .day-card.is-collapsed .day-card-body,
    .room-card.is-collapsed .room-card-body,
    .pricing-card.is-collapsed .pricing-card-body {
        display: none;
    }

    .day-card:not(.is-collapsed) .mobile-collapse-summary .day-card-summary-text,
    .room-card:not(.is-collapsed) .mobile-collapse-summary .room-card-summary-text,
    .pricing-card:not(.is-collapsed) .mobile-collapse-summary .pricing-card-summary-text {
        display: none;
    }

    .day-card-summary-text,
    .room-card-summary-text,
    .pricing-card-summary-text {
        font-size: 0.75rem;
        color: var(--ink-faint);
        margin-top: 0.15rem;
    }

    .room-card-body {
        align-items: end;
    }

    .room-card-body > label {
        min-width: 0;
    }
}

@media (min-width: 1024px) {
    .mobile-only {
        display: none !important;
    }

    .audit-detail-sheet {
        width: min(40rem, calc(100vw - 2rem));
        max-height: min(85vh, 40rem);
        margin: auto;
        border-radius: var(--radius-lg, 0.75rem);
        border: 1px solid var(--line);
        padding: 0;
    }
}

@media (max-width: 1023px) {
    .audit-detail-sheet {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        margin: 0;
        border-radius: 0;
    }
}

@media (max-width: 767px) {
    .desktop-only {
        display: none !important;
    }

    .desktop-only-flex {
        display: none !important;
    }

    .desktop-only-grid {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }

    .mobile-only-flex {
        display: flex !important;
    }

    .mobile-itinerary-list {
        display: flex;
        flex-direction: column;
        gap: 0.45rem;
        padding: 0.35rem 0 0.5rem;
        background: transparent;
    }

    .mobile-itinerary-row {
        border: 1px solid var(--line);
        border-radius: var(--radius-md);
        background: #fff;
        padding: 0.75rem 0.6rem;
        box-shadow: none;
        color: inherit;
    }

    .mobile-itinerary-body {
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
    }

    .mobile-itinerary-main {
        min-width: 0;
        text-decoration: none;
        color: inherit;
    }

    .mobile-itinerary-main:hover {
        text-decoration: none;
    }

    .mobile-itinerary-title {
        margin: 0;
        font-size: 0.9375rem;
        font-weight: 650;
        letter-spacing: -0.01em;
        color: var(--ink);
        text-decoration: none;
    }

    .mobile-itinerary-meta {
        margin: 0.1rem 0 0;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.35rem;
        font-size: 0.75rem;
        color: var(--ink-faint);
    }

    .mobile-itinerary-actions {
        display: flex;
        width: 100%;
        align-items: stretch;
        gap: 0.35rem;
    }

    .mobile-itinerary-actions > a,
    .mobile-itinerary-actions > .draft-row-action-form,
    .mobile-itinerary-actions > .draft-row-action-item {
        flex: 1 1 0;
        min-width: 0;
        display: flex;
    }

    .mobile-itinerary-actions .app-icon-btn {
        width: 100%;
        flex: 1;
        border: 1px solid var(--line);
        background: #fff;
    }

    .mobile-itinerary-actions .draft-row-delete {
        border-color: #fecdd3;
        background: #fff1f2;
    }

    .mobile-itinerary-actions .draft-row-action-item.dropdown {
        position: relative;
    }

    .mobile-itinerary-actions .draft-row-dropdown-menu {
        right: 0;
        left: auto;
        min-width: 11.5rem;
    }

    .mobile-audit-list {
        display: block;
    }

    .app-login-panel {
        margin-top: 0.5rem;
        padding: 1.25rem 1rem;
    }

    .mobile-search-row {
        display: flex;
        align-items: stretch;
        gap: 0.5rem;
    }

    .dashboard-mobile-search {
        position: sticky;
        top: var(--app-topbar-height);
        z-index: 12;
        margin: 0 calc(-1 * var(--app-page-pad)) 0.5rem;
        padding: 0.65rem var(--app-page-pad);
        background: var(--page);
        border-bottom: 1px solid var(--line);
    }

    #itineraries.app-panel {
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    #itineraries .itineraries-panel-head {
        display: none;
    }

    #itineraries .mobile-itinerary-list {
        border-top: 0;
    }

    #itineraries > .flex.flex-wrap.items-center.justify-between,
    #itineraries > .border-t {
        padding-left: 0;
        padding-right: 0;
    }

    .mobile-search-row .form-control,
    .mobile-search-row input[type="search"] {
        flex: 1;
        min-width: 0;
        min-height: var(--app-control-h);
        height: var(--app-control-h);
        border: 1px solid var(--line);
        border-radius: var(--radius-md);
        padding: 0 0.75rem;
        font-size: 16px;
        background: #fff;
    }

    .mobile-search-row .btn,
    .mobile-search-row .app-btn {
        flex-shrink: 0;
        min-height: var(--app-control-h);
        height: var(--app-control-h);
        align-self: stretch;
    }

    .mobile-search-row .mobile-search-submit {
        width: var(--app-control-h);
        min-width: var(--app-control-h);
        padding: 0;
        justify-content: center;
    }

    .app-search-bar.desktop-only-flex,
    .app-tabs.desktop-only-flex {
        display: none !important;
    }

    .app-main .sm\:grid-cols-2,
    .editor-canvas .sm\:grid-cols-2,
    .editor-canvas .sm\:grid-cols-3,
    .app-main .md\:grid-cols-2,
    .editor-canvas .md\:grid-cols-2,
    .app-main .md\:grid-cols-3,
    .editor-canvas .md\:grid-cols-3,
    .app-main .lg\:grid-cols-2,
    .app-main .lg\:grid-cols-4 {
        grid-template-columns: minmax(0, 1fr) !important;
    }
}

@media (max-width: 700px) {
    .app-table thead {
        display: none;
    }

    .app-table,
    .app-table tbody,
    .app-table tr,
    .app-table td {
        display: block;
        width: 100%;
        min-width: 0;
    }

    .app-table tr {
        border-bottom: 1px solid var(--line);
        padding: 0.65rem 0.2rem;
        position: relative;
    }

    .app-table--nav tr.app-table-row--nav {
        padding-right: 2.25rem;
    }

    .app-table--nav .app-table-row-go {
        position: absolute;
        top: 50%;
        right: 0.65rem;
        width: auto;
        padding: 0 !important;
        transform: translateY(-50%);
    }

    .app-table--nav .app-table-row-go .app-ico {
        width: 1.1rem;
        height: 1.1rem;
    }

    .app-table td {
        border: 0;
        padding: 0.15rem 0.75rem;
    }

    .app-truncate {
        max-width: none;
        white-space: normal;
    }
}

@media (min-width: 431px) and (max-width: 767px) {
    :root {
        --app-page-pad: 1.25rem;
    }
}

/* ——— Motion system ——— */
@keyframes app-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes app-rise-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes app-sheet-in {
    from {
        opacity: 0.6;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes app-pop-in {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(6px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes app-toast-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes app-toast-out {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(8px);
    }
}

@keyframes app-flash-in {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.app-main > .app-crumbs,
.app-main > section,
.app-main > .settings-layout,
.app-main > .content-page,
.app-main > .settings-page,
.app-main > form,
.app-main > .editor-page,
.app-main > .space-y-4,
.app-main > .space-y-5 {
    animation: app-rise-in var(--motion) var(--ease-out) both;
}

.app-flash-item {
    animation: app-flash-in var(--motion) var(--ease-out) both;
}

.app-nav a,
.app-nav-btn {
    transition:
        background-color var(--motion-fast) ease,
        color var(--motion-fast) ease,
        transform var(--motion-fast) var(--ease-out);
}

.app-nav a:hover,
.app-nav-btn:hover {
    transform: translateX(2px);
}

.app-nav a.is-active:hover {
    transform: none;
}

.app-topbar-page-title {
    transition: color var(--motion-fast) ease;
}

.app-icon-btn {
    transition:
        background-color var(--motion-fast) ease,
        color var(--motion-fast) ease,
        transform var(--motion-fast) var(--ease-out);
}

.app-icon-btn:active {
    transform: scale(0.94);
}

.app-metric {
    transition:
        transform var(--motion) var(--ease-out),
        box-shadow var(--motion) ease,
        border-color var(--motion-fast) ease;
}

.app-metric:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgb(15 23 42 / 0.08);
}

.mobile-itinerary-row,
.app-table tbody tr {
    transition: background-color var(--motion-fast) ease;
}

.app-tabs a,
.editor-steps button,
.editor-steps-mobile button {
    transition:
        background-color var(--motion-fast) ease,
        border-color var(--motion-fast) ease,
        color var(--motion-fast) ease,
        box-shadow var(--motion-fast) ease,
        transform var(--motion-fast) var(--ease-out);
}

.editor-steps-mobile button:active,
.app-tabs a:active {
    transform: scale(0.97);
}

.settings-nav a,
.app-sheet-nav a {
    transition:
        background-color var(--motion-fast) ease,
        color var(--motion-fast) ease,
        transform var(--motion-fast) var(--ease-out);
}

.settings-nav a:hover,
.app-sheet-nav a:hover {
    transform: translateX(2px);
}

@media (max-width: 991.98px) {
    .app-sheet-nav a:hover {
        transform: none;
    }
}

.app-sheet {
    margin-top: auto;
    transition: none;
}

.app-sheet[open] {
    animation: app-sheet-in var(--motion-sheet) var(--ease-snap) both;
}

.app-sheet[open]::backdrop {
    animation: app-fade-in var(--motion-drawer) ease both;
}

.audit-detail-sheet[open] {
    animation: app-pop-in var(--motion) var(--ease-out) both;
}

.editor-action-bar {
    animation: app-rise-in var(--motion) var(--ease-out) both;
}

.draft-form-section:not(.hidden) {
    animation: app-rise-in var(--motion) var(--ease-out) both;
}

.app-menu {
    transform-origin: top right;
    animation: app-pop-in var(--motion-fast) var(--ease-out) both;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .app-btn:active,
    .app-main button[type="submit"]:active,
    a.app-btn:active,
    .app-icon-btn:active,
    .app-metric:hover,
    .app-nav a:hover {
        transform: none;
    }
}

.log-viewer-panel {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    background: #0f172a;
    color: #e2e8f0;
}

.log-line {
    white-space: pre-wrap;
    word-break: break-word;
    padding: 0.15rem 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.log-line-info { color: #e2e8f0; }
.log-line-debug { color: #94a3b8; }
.log-line-warning { color: #fbbf24; }
.log-line-error { color: #f87171; }

.log-ts {
    color: #64748b;
}
