/* Farwater shell. Loaded after app.css so every screen shares one grid. */
:root { --app-width: 1440px; --app-pad: 26px; }
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

body.app-body {
    min-height: 100vh;
    margin: 0;
    background: var(--bg-body);
    font-size: 13px;
    letter-spacing: -.15px;
}

.fw-shell {
    display: grid;
    grid-template-columns: 192px minmax(0, 1fr);
    min-height: 100vh;
}
.fw-sidebar {
    background: var(--sidebar, #192322);
    color: #d8e2de;
    padding: 28px 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: auto;
}
.fw-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff !important;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -.5px;
    padding: 0 10px;
    text-decoration: none;
}
.fw-brand small {
    display: block;
    font-size: 8px;
    letter-spacing: 2.4px;
    font-weight: 400;
    color: #9aaea5;
}
.fw-mark {
    width: 30px;
    height: 33px;
    display: grid;
    place-items: center;
    background: var(--lime, #dcf6a5);
    border-radius: 9px;
    color: #192322;
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
    flex-shrink: 0;
}
.fw-workspace {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #364440;
    border-radius: 9px;
    padding: 10px;
    font-size: 11px;
    color: #eff4f1;
}
.fw-workspace small { display: block; color: #92a59d; font-size: 9px; margin-top: 2px; }
.fw-workspace-icon {
    width: 26px;
    height: 27px;
    display: grid;
    place-items: center;
    background: #33463d;
    border-radius: 6px;
    font-size: 13px;
    color: var(--lime, #dcf6a5);
    flex-shrink: 0;
}
.fw-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 4px 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--lime, #dcf6a5);
    color: #223326 !important;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}
.fw-add:hover { filter: brightness(1.04); color: #223326 !important; }
.fw-nav-label {
    font-size: 9px;
    color: #8d9f98;
    letter-spacing: 1.1px;
    margin: 0 12px 8px;
    text-transform: uppercase;
}
.fw-nav-section { margin-top: 20px; }
.fw-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    width: 100%;
    text-align: left;
    border-radius: 8px;
    color: #bdccc4 !important;
    font-size: 12px;
    min-height: 39px;
    background: transparent;
    border: 0;
    text-decoration: none;
}
.fw-nav i { font-size: 14px; }
.fw-nav:hover { background: #26342e; color: #fff !important; }
.fw-nav.is-active { background: var(--lime, #dcf6a5); color: #223326 !important; font-weight: 600; }
.fw-nav .fw-count, .fw-nav .badge { margin-left: auto; }
.fw-nav .fw-chevron { margin-left: auto; font-size: 11px; }
.fw-sidebar .dropdown { width: 100%; }
.fw-sidebar .dropdown-menu {
    background: #24332d;
    border: 1px solid #36463e;
    border-radius: 8px;
    padding: 4px;
    min-width: 180px;
}
.fw-sidebar .dropdown-item {
    color: #aebfb5;
    font-size: 11px;
    border-radius: 6px;
    padding: 7px 8px;
}
.fw-sidebar .dropdown-item:hover,
.fw-sidebar .dropdown-item.active { background: #304435; color: var(--lime, #dcf6a5); }
.fw-side-bottom { margin-top: auto; padding-top: 24px; }
.fw-account {
    display: flex;
    width: 100%;
    gap: 9px;
    align-items: center;
    padding: 16px 7px;
    border-top: 1px solid #33413a;
    text-decoration: none;
    color: inherit;
}
.fw-account strong { display: block; font-size: 12px; color: #fff; font-weight: 500; }
.fw-account small { display: block; font-size: 10px; color: #90a69a; }
.fw-avatar {
    display: inline-grid;
    place-items: center;
    width: 33px;
    height: 33px;
    border-radius: 50%;
    background: #deeadf;
    color: #485d4e;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}
.fw-avatar-small { width: 28px; height: 28px; font-size: 10px; }
.fw-work { min-width: 0; display: flex; flex-direction: column; background: var(--bg-body); }
.fw-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 17px 26px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}
.fw-breadcrumb { display: flex; align-items: center; gap: 10px; font-size: 10px; min-width: 0; color: var(--text-muted); }
.fw-breadcrumb strong { font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fw-top-actions { display: flex; align-items: center; gap: 9px; }
.fw-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    color: var(--text-muted);
    position: relative;
    text-decoration: none;
}
.fw-icon:hover { background: var(--bg-elevated); color: var(--accent); }
.fw-icon .badge { position: absolute; top: -4px; right: -4px; }
.fw-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 26px 20px;
    font-size: 8px;
    color: var(--text-muted);
}

.app-content {
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 28px 26px 24px;
    min-width: 0;
    flex: 1;
}

body.is-login .app-content { max-width: none; padding: 0; }
.login-theme { position: fixed; top: 16px; right: 16px; z-index: 5; }
.fw-login { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.fw-login-art { padding: 48px 40px; background: var(--promo, #213e33); color: #f1f8ec; display: flex; flex-direction: column; justify-content: space-between; }
.fw-login-art h2 { font-size: 30px; letter-spacing: -1px; line-height: 1.25; font-weight: 500; }
.fw-login-art p { font-size: 13px; color: #c5d9c7; margin-top: 16px; max-width: 28rem; }
.fw-login-form { padding: 48px 40px; display: flex; flex-direction: column; justify-content: center; max-width: 480px; margin: 0 auto; width: 100%; }

@media (min-width: 1250px) {
    .fw-shell { grid-template-columns: 220px minmax(0, 1fr); }
    .app-content { padding: 34px; }
    .fw-sidebar { padding-left: 18px; padding-right: 18px; }
    .fw-nav { font-size: 13px; }
}
@media (max-width: 850px) {
    .fw-shell { grid-template-columns: 166px minmax(0, 1fr); }
    .app-content { padding: 22px 18px; }
    .fw-topbar { padding: 15px 18px; }
}
@media (max-width: 640px) {
    .fw-shell { display: block; }
    .fw-sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(280px, 88vw);
        transform: translateX(-110%);
        z-index: 1040;
        height: 100vh;
    }
    body.sidebar-open .fw-sidebar { transform: none; box-shadow: var(--shadow); }
    body.sidebar-open::after {
        content: "";
        position: fixed;
        inset: 0;
        background: #10241b55;
        z-index: 1035;
    }
    .app-content { padding: 22px 16px; }
    .fw-login { grid-template-columns: 1fr; }
    .fw-login-art { min-height: 220px; padding: 24px; }
}

.fw-chatlayout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    min-height: 520px;
    overflow: clip;
}
.fw-chatlist { border-right: 1px solid var(--border); min-width: 0; overflow: auto; max-height: 70vh; }
.fw-ticket {
    display: block;
    padding: 16px;
    width: 100%;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--border);
}
.fw-ticket:hover { background: var(--bg-elevated); color: inherit; }
.fw-ticket.is-active { background: var(--accent-soft); }
.fw-ticket small { display: block; font-size: 12px; color: var(--text-muted); }
.fw-ticket strong { display: block; font-size: 14px; font-weight: 600; margin: 6px 0 4px; }
.fw-ticket p { margin: 0; font-size: 13px; color: var(--text-muted); }
.fw-conversation { display: flex; flex-direction: column; min-width: 0; min-height: 520px; }
.fw-chathead {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}
.fw-chathead h2 { font-size: 16px; margin: 0; font-weight: 600; }
.fw-chat-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: end;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    margin: 0;
}
.fw-chat-meta label { font-size: 12px; color: var(--text-muted); margin: 0; }
.fw-messages {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 22px 20px;
    flex: 1;
    overflow: auto;
}
.fw-message {
    max-width: 86%;
    padding: 12px 14px;
    border-radius: 12px 12px 12px 2px;
    background: var(--bg-elevated);
    font-size: 14px;
    line-height: 1.55;
}
.fw-message.is-mine {
    align-self: flex-end;
    background: var(--accent-soft);
    border-radius: 12px 12px 2px 12px;
}
.fw-message small { display: block; text-align: right; font-size: 11px; margin-top: 6px; color: var(--text-muted); }
.fw-messageform {
    padding: 14px 16px;
    display: flex;
    gap: 8px;
    border-top: 1px solid var(--border);
    margin: 0;
    align-items: end;
}
.fw-messageform textarea {
    flex: 1;
    min-height: 44px;
    max-height: 140px;
    resize: vertical;
    margin: 0;
}
.fw-new-ticket { padding: 20px; }
.fw-new-ticket input, .fw-new-ticket select, .fw-new-ticket textarea {
    width: 100%;
    margin-bottom: 10px;
}
.fw-pill {
    display: inline-flex;
    align-items: center;
    border-radius: 6px;
    padding: 4px 8px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 12px;
    white-space: nowrap;
}
.fw-pill-green { background: var(--accent-soft); color: var(--accent); }
.fw-pill-amber { background: var(--warning-soft); color: var(--warning); }
@media (max-width: 850px) {
    .fw-chatlayout { grid-template-columns: 1fr; min-height: 0; }
    .fw-chatlist { max-height: 220px; border-right: 0; border-bottom: 1px solid var(--border); }
}

.app-navbar .navbar-toggler {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    min-height: 38px;
    color: var(--text);
    border-color: var(--border) !important;
    border-radius: 10px;
    font-size: .85rem;
}

.app-navbar .navbar-toggler-icon {
    width: 1rem;
    height: 1rem;
    background-image: none;
    border-block: 2px solid currentColor;
    position: relative;
}

.app-navbar .navbar-toggler-icon::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: calc(50% - 1px);
    border-top: 2px solid currentColor;
}

.app-navbar .theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    padding: 0;
    border-radius: 10px;
    font-size: 1rem;
}

.app-navbar .nav-link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    min-height: 36px;
    border-radius: 9px;
    font-size: .86rem;
    font-weight: 600;
}

.app-navbar .dropdown-menu {
    border-radius: 12px;
    padding: .35rem;
}

.app-navbar .dropdown-item { border-radius: 8px; }

.app-navbar .app-nav-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .45rem;
}

.app-navbar .app-nav-tools form { margin: 0; }

.app-navbar .account-link {
    font-weight: 700;
    color: var(--text) !important;
}

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

.app-content > .container,
.app-content > .container.app-container {
    width: auto;
    max-width: none;
    margin: 0;
    padding-inline: 0;
}

.app-content > table,
.app-content > .table-responsive,
.app-content form > .table-responsive {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: auto;
}
.app-content button:not(.btn):not([class]),
.app-content form > button:not(.btn) {
    min-height: 38px;
    padding: .5rem .9rem;
    border-radius: 8px;
    border: 0;
    background: var(--action-bg);
    color: #fff;
    font-weight: 500;
}
html[data-theme="dark"] .app-content button:not(.btn):not([class]),
html[data-theme="dark"] .app-content form > button:not(.btn) { color: #122b20; }
.app-content a.btn + a, .app-content h1 + p a { font-weight: 500; }
.fw-eyebrow { display: flex; align-items: center; gap: 6px; color: var(--accent); text-transform: uppercase; letter-spacing: 1.3px; font-size: 9px; font-weight: 600; margin-bottom: 9px; }
.app-content :where(h1, .h3) {
    margin: 0 0 .35rem;
    font-size: 27px;
    font-weight: 600;
    letter-spacing: -1px;
    line-height: 1.25;
}

.app-content h2,
.app-content .h4,
.app-content .h5 {
    margin: 1.35rem 0 .7rem;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.app-content > h1 + p {
    margin: 0 0 1rem;
    color: var(--text-muted);
}

.app-content > h1 + p a { font-weight: 600; }

.app-content .d-flex.justify-content-between,
.app-content > .d-flex {
    align-items: center;
    gap: .75rem 1rem;
}

.app-content .d-flex.justify-content-between h1,
.app-content .d-flex .h3 { margin-bottom: 0; }

.app-content :where(p, label, article, td, li) { overflow-wrap: anywhere; }
.app-content :where(.row, .card, section, form, article) { min-width: 0; }
.app-content :where(img, video, canvas) { max-width: 100%; height: auto; }

.app-content > .alert { margin-bottom: 1rem; border-radius: 12px; }

.app-content .card {
    border-radius: 14px;
    overflow: hidden;
}

.app-content .card.p-3 { padding: .95rem 1.05rem !important; }
.app-content .card.p-4 { padding: 1.15rem 1.2rem !important; }

.app-content .row > .card > span.text-muted,
.app-content .row .card.p-3 > span.text-muted,
.app-content .row .card.p-4 > span.text-muted {
    display: block;
    font-size: .78rem;
    line-height: 1.3;
}

.app-content .row .card > strong,
.app-content .card > strong.fs-3,
.app-content .card > strong.fs-4 {
    display: block;
    margin-top: .15rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: -1px;
    line-height: 1.15;
    font-size: 25px;
    font-weight: 600;
}
.fw-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 17px;
}
.fw-stat {
    padding: 17px 16px;
    min-width: 0;
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    display: block;
}
a.fw-stat:hover {
    color: inherit;
    box-shadow: 0 10px 28px rgba(16, 35, 27, .08);
    transform: translateY(-1px);
}
.fw-stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    color: var(--text-muted);
    font-size: 10px;
}
.fw-stat-value {
    font-size: 25px;
    font-weight: 600;
    letter-spacing: -1px;
    line-height: 1.2;
    margin: 12px 0 9px;
    overflow-wrap: anywhere;
    font-variant-numeric: tabular-nums;
}
.fw-stat-hint { font-size: 9px; color: var(--text-muted); }
.app-content .card.fw-stat-featured,
html[data-theme="light"] .card.fw-stat-featured,
html[data-theme="dark"] .card.fw-stat-featured {
    background: #203e32;
    color: #f3f9ef;
    border-color: transparent;
}
.app-content .card.fw-stat-featured .fw-stat-top,
.app-content .card.fw-stat-featured .fw-stat-hint,
.app-content .card.fw-stat-featured .text-muted { color: #b3ccb8 !important; }
.fw-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 20px 8px;
    margin-bottom: 20px;
}
.fw-strip > a, .fw-strip > div { padding: 0 18px; border-right: 1px solid var(--border); min-width: 0; display: block; text-decoration: none; color: inherit; }
.fw-strip > a:last-child, .fw-strip > div:last-child { border: 0; }
.fw-strip > a:hover strong { color: var(--accent); }
.fw-strip small { display: block; color: var(--text-muted); font-size: 13px; font-weight: 500; }
.fw-strip strong { display: block; margin-top: 8px; font-size: 18px; font-weight: 600; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
@media (max-width: 850px) {
    .fw-stats { grid-template-columns: 1fr 1fr; }
    .fw-strip { grid-template-columns: 1fr 1fr; gap: 12px 0; }
    .fw-strip > div { border-right: 0; padding: 8px 13px; }
    .fw-stat-value { font-size: 21px; }
}
@media (min-width: 1250px) {
    .fw-stat-value { font-size: 30px; }
}

.app-content > .row > section:not(.card) {
    height: 100%;
    margin-bottom: 1rem;
    padding: 1rem 1.1rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-surface);
}

.app-content > .row > section:not(.card) > :where(h2, .h4) { margin-top: 0; }

.app-content label {
    display: block;
    margin: 0 0 .35rem;
    color: var(--text);
    font-size: .8rem;
    font-weight: 650;
}

.app-content label:has(input[type="checkbox"]),
.app-content label:has(input[type="radio"]) {
    display: inline-flex;
    flex: 0 0 auto;
    flex-direction: row;
    align-items: center;
    gap: .45rem;
    width: auto;
    min-width: max-content;
    margin: 0;
    font-size: .875rem;
    font-weight: 550;
    white-space: nowrap;
    overflow-wrap: normal;
}

.app-content form p { margin-bottom: .9rem; }
.app-content .helptext,
.app-content .errorlist { font-size: .8rem; }
.app-content .errorlist { color: var(--danger); list-style: none; padding: 0; margin: .3rem 0 0; }

.app-content :where(
    input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="file"]),
    select,
    textarea
) {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: .5rem .75rem;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    background: var(--bg-input);
    color: var(--text);
    font: inherit;
    font-size: .9rem;
}

.app-content :where(input, select, textarea):focus {
    border-color: var(--accent);
    box-shadow: var(--ring);
    outline: none;
}

.app-content textarea { min-height: 110px; resize: vertical; }
.app-content :where(input[type="checkbox"], input[type="radio"]) {
    width: 1rem;
    height: 1rem;
    margin: 0;
    accent-color: var(--action-bg);
}

.app-content form[method="get"]:not(.row):not(.card) {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: .75rem 1rem;
    margin: 0 0 1.15rem;
    padding: .9rem 1rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
}

.app-content form[method="get"]:not(.row):not(.card) > div {
    flex: 1 1 160px;
    min-width: min(100%, 150px);
    margin: 0;
}

.app-content form[method="get"] > .filter-actions {
    display: flex;
    flex: 1 0 100%;
    align-items: center;
    gap: .75rem;
    min-width: 0;
    max-width: none;
}

.app-content form[method="get"]:not(.row):not(.card) > :where(button, a, label) {
    flex: 0 0 auto;
    margin: 0;
}

.app-content form[method="get"].row,
.app-content .card form[method="get"].row {
    border: 0;
    background: transparent;
    box-shadow: none;
    margin: 0;
}

.app-content form.d-flex {
    flex-flow: row wrap;
    align-items: flex-end;
    justify-content: flex-start;
    width: 100%;
}

.app-content form.d-flex > :where(.form-select, .form-control, label, select) {
    flex: 1 1 220px;
    align-self: flex-end;
    width: auto;
    height: auto;
    min-width: min(100%, 160px);
    max-width: 320px;
    margin: 0;
}

.app-content form.d-flex > :where(select, .form-select) {
    min-height: 40px;
    max-height: 3rem;
}

.app-content form.d-flex > label :where(.form-control, .form-select, input, select) {
    width: 100%;
    max-width: none;
    margin-top: .35rem;
}

.app-content form.d-flex > .btn { flex: 0 0 auto; }

.app-content .d-flex > select,
.app-content .d-flex > input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="submit"]) {
    width: auto;
    flex: 1 1 200px;
    min-width: min(100%, 160px);
    max-width: 280px;
}

.app-content :where(button:not(.btn):not(.navbar-toggler):not(.nav-link), input[type="submit"]:not(.btn)) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    min-height: 40px;
    padding: .5rem .95rem;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--action-bg);
    color: #fff;
    font: inherit;
    font-size: .84rem;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
}

.app-content :where(button:not(.btn), input[type="submit"]:not(.btn)):hover {
    background: var(--action-hover);
    color: #fff;
}

.app-content form[method="get"] > a:not(.btn) {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: .5rem .9rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-elevated);
    color: var(--text);
    font-weight: 650;
}

.btn,
.btn-primary,
.btn-primary:hover,
.btn-primary:active { transform: none; }

.app-content .table-responsive {
    max-width: 100%;
    margin-bottom: 1.15rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
}

.app-content .card > .table-responsive,
.app-content .card.table-responsive,
.app-content .card .table-responsive,
.app-content section.card .table-responsive {
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.app-content .table {
    width: 100%;
    margin: 0;
    font-size: .875rem;
    font-variant-numeric: tabular-nums;
}

.app-content .table.has-medium-columns { min-width: 680px; }
.app-content .table.has-many-columns { min-width: 1040px; }
.app-content .table.is-empty,
.app-content .table.is-empty.has-medium-columns,
.app-content .table.is-empty.has-many-columns { min-width: 0; }

.app-content .table :is(th, td) {
    min-width: 0;
    padding: .72rem .85rem;
    vertical-align: middle;
    overflow-wrap: anywhere;
    word-break: normal;
}

.app-content .table thead th {
    font-size: .75rem;
    font-weight: 700;
    white-space: nowrap;
}

.app-content .table td:has(form, .btn, .table-actions),
.app-content .table-actions { min-width: 0; }

.app-content .table td > form,
.app-content .table-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    margin: 0;
}

.app-content .table td > :where(a.btn, button) { margin: 0; }

.app-content .table td[colspan] {
    padding: 1.6rem 1rem;
    text-align: center;
    color: var(--text-muted);
}

.app-content table :where(input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select) {
    display: inline-block;
    width: auto;
    max-width: 11rem;
    min-height: 34px;
}

.app-content .list-group {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.app-content .list-group-item {
    padding: .8rem 1rem;
    background: var(--bg-surface);
    color: var(--text);
    border-color: var(--border);
}

.app-content nav[aria-label="Страницы"] {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin: .25rem 0 1rem;
}

.app-content nav[aria-label="Страницы"] a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 .85rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-surface);
    color: var(--text);
    font-weight: 700;
}

.app-content nav[aria-label="Страницы"] a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.app-content progress {
    width: min(100%, 180px);
    height: 8px;
    vertical-align: middle;
    accent-color: var(--accent);
}

.app-content details {
    margin-top: .25rem;
}

.app-content summary { cursor: pointer; font-weight: 650; }

.app-content pre {
    margin-top: .45rem;
    padding: .75rem .85rem;
    border-radius: 10px;
    background: var(--bg-elevated);
    white-space: pre-wrap;
}

.app-content > section.card {
    margin-top: max(4vh, 1rem);
}

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

@media (min-width: 1400px) {
    .app-navbar .navbar-toggler { display: none; }
    .app-navbar .navbar-collapse {
        display: flex !important;
        flex: 1 1 auto;
        align-items: center;
        min-width: 0;
    }
    .app-navbar .app-nav-primary { flex-wrap: nowrap; }
    .app-navbar .app-nav-tools {
        flex-wrap: nowrap;
        margin-left: auto;
        padding: 0 0 0 .65rem;
        border: 0;
        border-left: 1px solid var(--border);
    }
    .app-navbar .theme-toggle { order: 3; }
    .app-navbar .account-link { margin-left: 0; }
}

@media (max-width: 1399.98px) {
    .app-navbar .navbar-collapse {
        flex-basis: 100%;
        max-height: calc(100dvh - 72px);
        overflow-y: auto;
        padding: .35rem 0 .2rem;
    }
    .app-navbar .app-nav-primary .nav-link { display: flex; width: 100%; }
    .app-navbar .dropdown-menu { position: static; width: 100%; margin: .15rem 0 .35rem; box-shadow: none; }
    .app-navbar .app-nav-tools {
        margin-top: .45rem;
        padding-top: .65rem;
        border-top: 1px solid var(--border);
    }
    .app-navbar .account-link { margin-left: 0; }
}

@media (max-width: 575.98px) {
    :root { --app-pad: .85rem; }
    .app-content { padding-top: 1rem; padding-bottom: 2rem; }
    .app-navbar .navbar-brand { font-size: 1rem; }
    .app-content form[method="get"]:not(.row):not(.card) > div,
    .app-content form.d-flex > :where(.form-select, .form-control, label) {
        flex-basis: 100%;
        max-width: none;
    }
    .app-content .card.p-4 { padding: 1rem !important; }
}

[hidden] { display: none !important; }

html.crm-busy { cursor: progress; }
html.crm-busy::before {
    content: "";
    position: fixed;
    z-index: 2000;
    top: 0;
    left: 0;
    width: 34%;
    height: 3px;
    background: var(--accent);
    pointer-events: none;
    animation: crm-busy .9s ease-in-out infinite;
}

@keyframes crm-busy {
    from { transform: translateX(-40%); }
    to { transform: translateX(320%); }
}

.crm-card {
    width: min(420px, calc(100vw - 2rem));
    max-height: min(88vh, 720px);
    margin: auto;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-surface);
    color: var(--text);
    box-shadow: 0 22px 70px rgba(16, 35, 27, .18);
}

.crm-card[open] {
    display: flex;
    flex-direction: column;
}

.crm-card::backdrop { background: #10241b55; }

.crm-card-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px 12px;
    background: transparent;
    border-bottom: 0;
}

.crm-card-bar strong {
    min-width: 0;
    overflow: hidden;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -.4px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.crm-card .app-content {
    max-width: none;
    margin: 0;
    padding: 8px 24px 24px;
    overflow: auto;
}
.crm-card .fw-panel-chrome { display: none; }
.crm-card .app-content h1,
.crm-card .app-content .h3 { font-size: 18px; letter-spacing: -.4px; }
.fw-notice-toolbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: end; margin-bottom: 14px; }
.fw-notice-list { display: flex; flex-direction: column; gap: 10px; }
.fw-notice {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-surface);
}
.fw-notice.is-unread { border-color: var(--accent); background: var(--accent-soft); }
.fw-notice strong { display: block; font-size: 14px; }
.fw-notice p { margin: 6px 0; font-size: 13px; }
.fw-notice small { color: var(--text-muted); }
.fw-notice-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: start; }
.fw-notice-prefs { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.fw-notice-prefs h2 { font-size: 15px; margin-bottom: 8px; }
.crm-card { width: min(520px, calc(100vw - 2rem)); }
.crm-card .app-content .card { border: 0; box-shadow: none; padding: 0; }

@media (prefers-reduced-motion: reduce) {
    html.crm-busy::before { animation: none; width: 100%; }
}
