/* --- Page head ---------------------------------------------------------------- */

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

.pagehead h1 {
    margin: 0 0 0.25rem;
}

.pagehead .muted {
    margin: 0;
}

/* --- Badges ------------------------------------------------------------------ */

.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 600;
    background: var(--wash);
    color: var(--muted);
    white-space: nowrap;
}

.badge-new {
    background: #e9f3ff;
    color: #075db4;
}

.badge-triaging,
.badge-in_progress {
    background: #fff1d1;
    color: #715011;
}

.badge-confirmed,
.badge-paid {
    background: #e3f6ec;
    color: #17663c;
}

.badge-rejected,
.badge-duplicate {
    background: #fde8df;
    color: #8f3322;
}

.badge-sla-ok {
    background: #e3f6ec;
    color: #17663c;
}

.badge-sla-breach {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-active {
    background: #e3f6ec;
    color: #17663c;
}

.badge-expired,
.badge-revoked {
    background: var(--wash);
    color: var(--muted);
}

.badge-quarantine {
    background: var(--danger-bg);
    color: var(--danger);
}

.badge-unread {
    background: var(--brand);
    color: #fff;
}

/* --- Hero ------------------------------------------------------------------------ */

.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 1.75rem 2rem;
    margin-bottom: 1.25rem;
    border-radius: var(--radius);
    background: radial-gradient(80% 160% at 85% 10%, #125d79 0%, transparent 60%),
        linear-gradient(113deg, #112c4b, #0b3a5b);
    color: #eaf2fb;
    box-shadow: var(--shadow);
}

.hero h2 {
    margin: 0 0 0.5rem;
    color: #fff;
}

.hero p {
    margin: 0;
    max-width: 60ch;
    color: #c4d6e8;
}

.hero-stat {
    text-align: right;
}

.hero-stat strong {
    display: block;
    font-size: 2.5rem;
    line-height: 1.1;
    color: #a3f6ed;
    font-variant-numeric: tabular-nums;
}

.hero-stat span {
    display: block;
    font-size: 0.875rem;
    color: #c4d6e8;
}

/* --- Toolbar / filters / search ---------------------------------------------------------- */

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.toolbar .search {
    max-width: 320px;
}

.filters {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    min-width: 0;
    margin-bottom: 1rem;
}

.filters select,
.filters input {
    width: auto;
    max-width: none;
}

/* Narrow screens: a select's intrinsic width is set by its longest option
   and can exceed the viewport (e.g. 360px) — let it shrink and wrap. */
@media (max-width: 700px) {
    .filters select,
    .filters input {
        max-width: 100%;
    }
}

/* --- Comments ----------------------------------------------------------------------------- */

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

.comment-list .comment {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--line);
}

.comment-list .comment:last-child {
    border-bottom: none;
}

.comment-meta {
    margin-bottom: 0.35rem;
}

/* Internal notes are visually distinct from public comments. */
.comment-internal {
    background: #fff1d1;
    border: 1px solid #e5c26b;
    border-radius: var(--radius-sm);
    padding-left: 0.75rem;
    padding-right: 0.75rem;
}

.badge-internal {
    background: #fff1d1;
    color: #715011;
}

.comment-form {
    margin-top: 1rem;
}

.comment-form .comment-internal-option {
    display: inline-block;
    margin-bottom: 0.5rem;
    color: #715011;
    font-weight: 600;
}

/* --- Alerts ----------------------------------------------------------------------------------- */

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    border: 1px solid transparent;
}

.alert-success {
    background: #e3f6ec;
    color: #17663c;
}

.alert-error,
.alert-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.alert-info {
    background: #e9f3ff;
    color: #075db4;
}

.alert-warning {
    background: #fff1d1;
    color: #715011;
}

/* --- Home page ------------------------------------------------------------------------------------ */

.home-card h1 {
    font-size: 1.75rem;
}

.home-card p {
    color: var(--muted);
    max-width: 60ch;
    margin-bottom: 0;
}

/* Колокольчик уведомлений в меню */
.nav-bell { position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border: 1px solid var(--line); border-radius: var(--radius-sm);
    color: var(--side-muted); text-decoration: none; background: transparent; }
.nav-bell:hover { background: var(--side-hover); color: var(--ink); }
.nav-bell .badge-unread { position: absolute; top: -6px; right: -8px; min-width: 18px; padding: 0 5px;
    border-radius: 9px; font-size: 0.7rem; line-height: 18px; text-align: center;
    background: #dc2626; color: #fff; }

/* Каркас рабочего кабинета (task D2, docs/07-design.md) */
.shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100dvh; }
.cabinet-main { display: flex; flex-direction: column; min-width: 0; align-self: start; }
.sidebar {
    position: sticky; top: 0; height: 100dvh;
    display: flex; flex-direction: column;
    background: var(--side-bg); color: var(--side-ink);
    border-right: 1px solid var(--side-border);
    padding: 18px 14px;
}
.sidebar .brand {
    display: flex; align-items: center; gap: 10px;
    color: var(--side-ink); font-weight: 700; font-size: 1rem;
    text-decoration: none; padding: 4px 6px 16px;
}
.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 39px; height: 39px; border-radius: 10px;
    background: linear-gradient(135deg, #86ffec, #3ab3f6);
    color: #0b2a45; font-weight: 800; font-size: 1.25rem;
}
.side-nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; }
.side-nav a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 8px;
    color: var(--side-ink); text-decoration: none; font-size: 0.9rem; font-weight: 500;
}
.side-nav a:hover { background: var(--side-hover); color: var(--side-ink); }
.side-nav a.active { background: var(--side-active); color: var(--side-ink); box-shadow: inset 3px 0 0 var(--brand); }
.side-icon { width: 22px; text-align: center; font-size: 1rem; }
.side-portal {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; margin-top: 10px;
    color: var(--side-muted); text-decoration: none; font-size: 0.85rem;
    border-top: 1px solid var(--side-border);
}
.side-portal:hover { color: var(--side-ink); }
.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: var(--paper); border-bottom: 1px solid var(--line);
    padding: 10px 24px;
}
.topbar-title { font-weight: 600; font-size: 0.95rem; color: var(--ink); }
.topbar .nav-actions { gap: 10px; }
.theme-switch { display: inline-flex; gap: 4px; }
.theme-form { margin: 0; }
.theme-btn { min-width: 34px; padding: 0.3rem 0.45rem; line-height: 1; }
.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--brand); color: #fff;
    font-weight: 700; font-size: 0.9rem; text-transform: uppercase;
}
/* Fluid cabinet content: full width, clamp side padding, capped at 1600px. */
.content {
    padding: 27px clamp(16px, 3vw, 40px) 40px;
    max-width: 1600px; margin: 0 auto; width: 100%;
}
.footnav { display: none; }
@media (max-width: 700px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .content { padding: 18px 16px 76px; }
    .topbar { padding: 8px 12px; }
    .topbar-title { display: none; }
    .footnav {
        position: sticky; bottom: 0; left: 0; right: 0; z-index: 20;
        display: flex; justify-content: space-around; gap: 4px;
        background: var(--side-bg); border-top: 1px solid var(--side-border);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    }
    .footnav a {
        display: flex; flex-direction: column; align-items: center; gap: 2px;
        padding: 4px 8px; border-radius: 8px;
        color: var(--side-ink); text-decoration: none;
        font-size: 0.65rem; line-height: 1.1;
    }
    .footnav a.active { background: var(--side-active); color: var(--side-ink); }
    .foot-icon { font-size: 1.05rem; }
}

