/* ==========================================================================
   e-HadirGo — interface redesign layer
   Loaded after app.css so the shared design system wins over legacy rules.
   ========================================================================== */

:root {
    --navy: #183b70;
    --navy-strong: #102b55;
    --primary: #315f9b;
    --primary-hover: #274f83;
    --blue-light: #e7f0fc;
    --blue-lighter: #f3f7fd;
    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-muted: #f8fafd;
    --text: #172033;
    --text-soft: #3e4a61;
    --muted: #66738c;
    --line: #e3e8f1;
    --line-strong: #d3dce9;

    --ok: #19724a;
    --ok-soft: #e8f6ee;
    --warn: #965f00;
    --warn-soft: #fdf3e0;
    --bad: #b42318;
    --bad-soft: #fdecea;
    --info: #2463a8;
    --info-soft: #e9f2fd;

    --radius-xs: 8px;
    --radius-sm: 10px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-xs: 0 1px 2px rgba(17, 33, 63, .05);
    --shadow-sm: 0 1px 2px rgba(17, 33, 63, .04), 0 6px 18px rgba(17, 33, 63, .04);
    --shadow-md: 0 2px 4px rgba(17, 33, 63, .04), 0 14px 34px rgba(17, 33, 63, .07);
    --shadow-lg: 0 24px 60px rgba(11, 27, 54, .18);

    --sidebar-width: 264px;
    --sidebar-compact: 84px;
    --topbar-height: 68px;
    --content-max: 1320px;
    --font-sans: "Inter", "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system,
        BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

/* --------------------------------------------------------------- base ----- */
html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body.app-body,
body.public-page,
body.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.app-body {
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    color: var(--navy);
    font-weight: 700;
    letter-spacing: -.015em;
    line-height: 1.3;
}

h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }

p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

a { color: var(--primary); }
a:hover { color: var(--navy); }

img { max-width: 100%; }

button, input, select, textarea {
    font: inherit;
}

:focus-visible {
    outline: 3px solid rgba(49, 95, 155, .38);
    outline-offset: 2px;
}

::selection {
    background: var(--blue-light);
    color: var(--navy);
}

[id] { scroll-margin-top: calc(var(--topbar-height) + 24px); }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.hidden { display: none !important; }

hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 22px 0;
}

/* ---------------------------------------------------------- app shell ----- */
.app-shell {
    position: relative;
    display: flex;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
}

.app-frame {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
    margin-left: var(--sidebar-width);
    transition: margin-left .22s cubic-bezier(.2, .7, .3, 1);
}

/* ------------------------------------------------------------ sidebar ----- */
.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 70;
    display: flex;
    flex-direction: column;
    width: var(--sidebar-width);
    border-right: 1px solid var(--line);
    background: var(--surface);
    box-shadow: 1px 0 0 rgba(17, 33, 63, .02);
    transition: width .22s cubic-bezier(.2, .7, .3, 1), transform .22s cubic-bezier(.2, .7, .3, 1);
}

.sidebar-head {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: var(--topbar-height);
    height: var(--topbar-height);
    padding: 10px 18px;
    border-bottom: 1px solid var(--line);
}

.app-sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: var(--navy);
}

.app-sidebar .brand:hover { text-decoration: none; }

.app-sidebar .brand-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    object-fit: contain;
}

.brand-copy {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.app-sidebar .brand-word {
    display: block;
    width: auto;
    max-width: 150px;
    height: 26px;
    object-fit: contain;
    object-position: left center;
}

.brand-sub {
    overflow: hidden;
    color: var(--muted);
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .045em;
    line-height: 1.2;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.sidebar-toggle,
.sidebar-close {
    display: none;
}

.sidebar-toggle {
    position: absolute;
    top: 88px;
    right: -14px;
    z-index: 2;
    width: 28px;
    height: 28px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
    color: var(--primary);
    box-shadow: var(--shadow-xs);
    cursor: pointer;
}

.sidebar-toggle:hover {
    border-color: #bdd0ea;
    background: var(--blue-lighter);
    color: var(--navy);
}

.sidebar-toggle .icon { width: 15px; height: 15px; }

.sidebar-nav {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 3px;
    min-height: 0;
    padding: 18px 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.nav-caption {
    padding: 0 12px 8px;
    color: #8b97ab;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    min-height: 44px;
    padding: 9px 12px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: #4d5b73;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-align: left;
    cursor: pointer;
    transition: background .16s ease, color .16s ease;
}

.nav-item:hover {
    background: var(--blue-lighter);
    color: var(--navy);
    text-decoration: none;
}

.nav-item.active {
    background: var(--blue-light);
    color: var(--navy);
    font-weight: 700;
}

.nav-item.active::before {
    content: "";
    position: absolute;
    top: 10px;
    bottom: 10px;
    left: 0;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--navy);
}

.nav-item .icon {
    width: 19px;
    height: 19px;
    flex: 0 0 auto;
    color: #6b7a91;
}

.nav-item.active .icon { color: var(--navy); }
.nav-item > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-count {
    display: grid;
    min-width: 22px;
    height: 20px;
    margin-left: auto;
    padding: 0 6px;
    place-items: center;
    border-radius: 999px;
    background: var(--navy);
    color: #fff;
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1;
}

.nav-group { position: relative; }

.nav-group > summary {
    list-style: none;
}

.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary .nav-caret {
    width: 15px;
    height: 15px;
    margin-left: auto;
    color: #8b97ab;
    transition: transform .18s ease;
}

.nav-group[open] > summary .nav-caret { transform: rotate(180deg); }

.nav-sub {
    display: grid;
    gap: 2px;
    padding: 3px 0 5px 23px;
}

.nav-sub a {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    padding: 7px 10px;
    border-radius: var(--radius-xs);
    color: #5c6980;
    font-size: 13px;
    font-weight: 600;
}

.nav-sub a:hover {
    background: var(--blue-lighter);
    color: var(--navy);
    text-decoration: none;
}

.nav-sub a.active {
    background: #f0f5fc;
    color: var(--navy);
    font-weight: 700;
}

.nav-sub .icon { width: 16px; height: 16px; flex: 0 0 auto; }

.sidebar-foot {
    display: grid;
    gap: 10px;
    padding: 14px 16px 18px;
    border-top: 1px solid var(--line);
    background: var(--surface);
}

.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 7px;
    border-radius: var(--radius-sm);
    color: var(--text);
}

.sidebar-profile:hover {
    background: var(--blue-lighter);
    text-decoration: none;
}

.sidebar-profile .avatar {
    width: 38px;
    height: 38px;
    font-size: 15px;
}

.sidebar-profile-copy {
    display: grid;
    min-width: 0;
    gap: 1px;
}

.sidebar-profile-copy strong {
    overflow: hidden;
    color: var(--navy);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-profile-copy small {
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-version {
    padding: 0 8px;
    color: #96a1b3;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .03em;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 65;
    background: rgba(11, 26, 51, .42);
    backdrop-filter: blur(2px);
}

.sidebar-backdrop[hidden] { display: none; }

/* ------------------------------------------------------------ topbar ------ */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 55;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: var(--topbar-height);
    padding: 10px 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(10px);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.topbar-title {
    display: grid;
    min-width: 0;
    gap: 0;
    line-height: 1.25;
}

.topbar-title span {
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.topbar-title strong {
    overflow: hidden;
    color: var(--navy);
    font-size: 16px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.nav-toggle,
.mobile-brand {
    display: none;
}

.nav-toggle {
    width: 40px;
    height: 40px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--navy);
    cursor: pointer;
}

.nav-toggle:hover { background: var(--blue-lighter); }
.nav-toggle .icon { width: 20px; height: 20px; }

.langswitch {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-muted);
    font-size: 11px;
    font-weight: 800;
}

.langswitch a {
    padding: 5px 8px;
    border-radius: 999px;
    color: var(--muted);
    line-height: 1;
}

.langswitch a:hover { color: var(--navy); text-decoration: none; }
.langswitch a.active {
    background: var(--surface);
    color: var(--navy);
    box-shadow: var(--shadow-xs);
}

.icon-btn {
    position: relative;
    display: grid;
    width: 40px;
    height: 40px;
    padding: 0;
    place-items: center;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: #58667e;
    cursor: pointer;
}

.icon-btn:hover {
    border-color: var(--line);
    background: var(--blue-lighter);
    color: var(--navy);
    text-decoration: none;
}

.icon-btn .icon { width: 20px; height: 20px; }

.badge {
    position: absolute;
    top: 2px;
    right: 2px;
    display: grid;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    place-items: center;
    border: 2px solid var(--surface);
    border-radius: 999px;
    background: #d92d20;
    color: #fff;
    font-size: 9.5px;
    font-weight: 800;
    line-height: 1;
}

.topbar-sep {
    width: 1px;
    height: 26px;
    margin: 0 2px;
    background: var(--line);
}

.usermenu { position: relative; }

.usermenu > summary {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 4px 7px 4px 4px;
    border-radius: 999px;
    list-style: none;
    cursor: pointer;
}

.usermenu > summary::-webkit-details-marker { display: none; }
.usermenu > summary:hover { background: var(--blue-lighter); }

.usermenu .avatar {
    width: 34px;
    height: 34px;
    font-size: 13px;
}

.usermenu-copy {
    display: grid;
    max-width: 160px;
    gap: 0;
    line-height: 1.2;
}

.usermenu-copy strong {
    overflow: hidden;
    color: var(--navy);
    font-size: 12.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.usermenu-copy small {
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
}

.usermenu-caret {
    width: 14px;
    height: 14px;
    color: #8390a3;
}

.usermenu-pop {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 80;
    width: 250px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
}

.usermenu-head {
    display: grid;
    gap: 2px;
    margin-bottom: 4px;
    padding: 10px 11px 12px;
    border-bottom: 1px solid var(--line);
}

.usermenu-head strong {
    color: var(--navy);
    font-size: 13.5px;
}

.usermenu-head span {
    overflow: hidden;
    color: var(--muted);
    font-size: 11.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.usermenu-pop a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 11px;
    border-radius: var(--radius-xs);
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 600;
}

.usermenu-pop a:hover {
    background: var(--blue-lighter);
    color: var(--navy);
    text-decoration: none;
}

.usermenu-pop a.logout-link { color: var(--bad); }
.usermenu-pop a.logout-link:hover { background: var(--bad-soft); color: #8f1c13; }
.usermenu-pop .icon { width: 17px; height: 17px; }

/* ------------------------------------------------------ content + foot ---- */
.wrap {
    flex: 1 0 auto;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 28px 28px 48px;
}

.app-frame .wrap { padding-top: 28px; }

.page-skeleton {
    display: none;
    gap: 16px;
}

.page-transition-loading .page-skeleton {
    display: grid;
}

.page-transition-loading .page-content {
    visibility: hidden;
}

.page-skeleton > span,
.skeleton-stats > span,
.skeleton-content > span {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: var(--radius);
    background: #e8edf5;
}

.page-skeleton > span::after,
.skeleton-stats > span::after,
.skeleton-content > span::after {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.72), transparent);
    content: "";
    transform: translateX(-100%);
    animation: skeleton-shimmer 1.25s ease-in-out infinite;
}

.skeleton-heading { width: min(280px, 42%); height: 28px; }
.skeleton-description { width: min(420px, 60%); height: 16px; }
.skeleton-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}
.skeleton-stats > span { min-height: 118px; }
.skeleton-content {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    gap: 20px;
}
.skeleton-content > span { min-height: 280px; }

@keyframes skeleton-shimmer {
    to { transform: translateX(100%); }
}

.foot {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 20px 28px 28px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
}

.foot strong { color: var(--navy); font-weight: 700; }
.foot .muted { color: #8994a6; }

/* ---------------------------------------------------------- page banner --- */
.page-banner {
    position: static;
    overflow: visible;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.page-banner::before { display: none; content: none; }

.page-banner-inner {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    padding: 20px 28px 22px;
}

.page-banner-text { min-width: 0; }

.page-banner h1 {
    margin: 4px 0 0;
    color: var(--navy);
    font-size: 26px;
    line-height: 1.2;
    letter-spacing: -.025em;
}

.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
}

.breadcrumb a { color: var(--primary); }
.breadcrumb a:hover { color: var(--navy); text-decoration: none; }
.breadcrumb .crumb-sep { display: inline-flex; color: #a9b3c2; }
.breadcrumb .crumb-sep .icon { width: 12px; height: 12px; }

/* ---------------------------------------------------------- page head ----- */
.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-head > div {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.app-body .page-head h1 { display: none; }
.app-body .page-head .muted {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.app-body .page-head .back {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
}

/* -------------------------------------------------------------- cards ----- */
.card {
    position: relative;
    margin: 0 0 20px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.card > h2 { margin-bottom: 16px; }
.card > h3 { margin-bottom: 12px; }
.card > h2:last-child,
.card > h3:last-child { margin-bottom: 0; }

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.section-heading h2 {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0;
}

.section-heading h2 .icon { width: 18px; height: 18px; color: var(--primary); }
.section-heading .muted { font-size: 12.5px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }

.stat {
    display: grid;
    align-content: center;
    gap: 5px;
    min-height: 92px;
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.stat strong {
    color: var(--navy);
    font-size: 26px;
    font-weight: 800;
    line-height: 1.1;
}

.stat span { color: var(--muted); font-size: 12px; font-weight: 600; }

/* ------------------------------------------------------------- buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--navy);
    font-size: 13.5px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    box-shadow: var(--shadow-xs);
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.btn:hover {
    border-color: #b6c7dd;
    background: var(--blue-lighter);
    color: var(--navy);
    text-decoration: none;
}

.btn:disabled,
.btn[disabled] {
    opacity: .55;
    cursor: not-allowed;
    box-shadow: none;
}

.btn .icon { width: 17px; height: 17px; flex: 0 0 auto; }

.btn-primary {
    border-color: var(--navy);
    background: var(--navy);
    color: #fff;
    box-shadow: 0 6px 14px rgba(24, 59, 112, .18);
}

.btn-primary:hover {
    border-color: var(--navy-strong);
    background: var(--navy-strong);
    color: #fff;
    box-shadow: 0 8px 18px rgba(24, 59, 112, .24);
}

.btn-secondary,
.btn-soft {
    border-color: #c8d8ee;
    background: var(--blue-light);
    color: var(--navy);
}

.btn-secondary:hover,
.btn-soft:hover { border-color: #a9c3e4; background: #dbe9fb; color: var(--navy); }

.btn-ghost {
    border-color: transparent;
    background: transparent;
    color: var(--muted);
    box-shadow: none;
}

.btn-ghost:hover {
    border-color: var(--line);
    background: var(--surface-muted);
    color: var(--navy);
}

.btn-danger {
    border-color: var(--bad);
    background: var(--bad);
    color: #fff;
    box-shadow: 0 6px 14px rgba(180, 35, 24, .15);
}

.btn-danger:hover { border-color: #8f1c13; background: #8f1c13; color: #fff; }

.btn-danger-soft {
    border-color: #f2c9c5;
    background: var(--bad-soft);
    color: #922f29;
}

.btn-danger-soft:hover { border-color: #e7b0aa; background: #fbdedb; color: #7d261f; }

.btn-success-soft {
    border-color: #c4e7d4;
    background: var(--ok-soft);
    color: #17653f;
}

.btn-success-soft:hover { border-color: #a4d8bb; background: #d8f1e4; }

.btn-sm { min-height: 32px; padding: 5px 10px; font-size: 12.5px; border-radius: var(--radius-xs); }
.btn-sm .icon { width: 14px; height: 14px; }
.btn-block { width: 100%; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; flex-wrap: wrap; }

/* Base app.css forces a pale blue fill on all secondary buttons. */
.app-body .btn.btn-ghost,
.auth-page .btn.btn-ghost,
body .btn.btn-ghost {
    border-color: transparent !important;
    background: transparent !important;
    color: var(--muted);
}

body .btn.btn-ghost:hover {
    border-color: var(--line) !important;
    background: var(--surface-muted) !important;
    color: var(--navy);
}

body .btn.btn-soft,
body .btn.btn-secondary {
    border-color: #c8d8ee !important;
    background: var(--blue-light) !important;
    color: var(--navy);
}

body .btn.btn-danger-soft {
    border-color: #f2c9c5 !important;
    background: var(--bad-soft) !important;
    color: #922f29;
}

body .btn.btn-success-soft {
    border-color: #c4e7d4 !important;
    background: var(--ok-soft) !important;
    color: #17653f;
}

/* ------------------------------------------------------------- forms ------ */
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    font-size: 13.5px;
}

.field > span,
.field > label,
.field > .field-label {
    color: var(--text-soft);
    font-size: 12.5px;
    font-weight: 700;
}

.field small,
.field .muted { font-size: 11.5px; line-height: 1.45; }

.field-inline {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 150px;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 700;
}

label { color: var(--text-soft); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="search"],
input[type="url"],
select,
textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    line-height: 1.35;
    box-shadow: var(--shadow-xs);
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

select {
    padding-right: 34px;
    appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, #6f7d93 50%),
        linear-gradient(135deg, #6f7d93 50%, transparent 50%);
    background-position:
        calc(100% - 17px) calc(50% + 1px),
        calc(100% - 12px) calc(50% + 1px);
    background-repeat: no-repeat;
    background-size: 5px 5px, 5px 5px;
}

textarea { min-height: 96px; resize: vertical; }

input:hover,
select:hover,
textarea:hover { border-color: #b9c6d8; }

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(49, 95, 155, .13);
    outline-offset: 0;
    background: var(--surface);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: #f4f6fa;
    color: var(--muted);
    cursor: not-allowed;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
}

.check input { min-height: 0; width: auto; margin-top: 3px; }

.filters {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0 0 18px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-muted);
}

.filters .field-inline { flex: 0 1 190px; }
.filters .btn { margin-left: 0; }
.filter-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-search { flex: 1 1 260px; min-width: 0; }
.filter-search input { padding-left: 38px; }
.search-field { position: relative; }

.search-field > .icon {
    position: absolute;
    top: 50%;
    left: 12px;
    width: 16px;
    height: 16px;
    transform: translateY(-50%);
    color: #8b97ab;
    pointer-events: none;
}

/* ------------------------------------------------------------- tables ----- */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13.5px;
}

.table th {
    padding: 10px 14px;
    border: 0;
    border-bottom: 1px solid var(--line);
    background: var(--surface-muted);
    color: #7c889c;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .07em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.table th:first-child { border-radius: var(--radius-xs) 0 0 var(--radius-xs); }
.table th:last-child { border-radius: 0 var(--radius-xs) var(--radius-xs) 0; }

.table td {
    padding: 13px 14px;
    border: 0;
    border-bottom: 1px solid #eef1f6;
    color: var(--text-soft);
    vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .14s ease; }
.table tbody tr:hover { background: #fafcff; }
.table td a { font-weight: 600; }
.table td .btn + .btn { margin-left: 4px; }
.table-compact td { padding: 10px 12px; }
.table-compact th { padding: 9px 12px; }

/* -------------------------------------------------------------- pills ----- */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 24px;
    padding: 3px 9px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
}

.pill::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: .7;
}

.pill-ok { border-color: #c9e8d7; background: var(--ok-soft); color: var(--ok); }
.pill-warn { border-color: #f0dcb8; background: var(--warn-soft); color: var(--warn); }
.pill-bad { border-color: #f4ccc8; background: var(--bad-soft); color: var(--bad); }
.pill-info { border-color: #cbdcf5; background: var(--info-soft); color: var(--info); }
.pill-muted { border-color: #e1e6ee; background: #f1f4f8; color: #66738c; }

/* ------------------------------------------------------------ flash ------- */
.flash {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    padding: 12px 15px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: 13.5px;
    font-weight: 600;
}

.flash-ok { border-color: #c5e6d4; background: var(--ok-soft); color: #175d3e; }
.flash-warn { border-color: #f0dcb8; background: var(--warn-soft); color: #774c00; }
.flash-error { border-color: #f2c9c5; background: var(--bad-soft); color: #8d241c; }
.flash-info { border-color: #c8daf2; background: var(--info-soft); color: #1d548f; }
.flash-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ------------------------------------------------------------ empty ------- */
.empty-state {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 10px;
    min-height: 156px;
    padding: 24px;
    border: 1px dashed #d6dfeb;
    border-radius: var(--radius);
    background: #fbfcff;
    color: var(--muted);
    text-align: center;
}

.empty-state > span {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border-radius: 50%;
    background: var(--blue-light);
    color: var(--primary);
}

.empty-state .icon { width: 22px; height: 22px; }
.empty-state p { margin: 0; font-size: 13.5px; }
.empty-state strong { color: var(--navy); }

/* --------------------------------------------------------- pagination ----- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
}

.pagination-summary,
.pagination-current {
    color: var(--muted);
    font-size: 12px;
}

.pagination-actions { display: flex; align-items: center; gap: 8px; }

/* --------------------------------------------------------------- misc ----- */
.kv {
    display: grid;
    grid-template-columns: 150px minmax(0, 1fr);
    gap: 9px 16px;
    margin: 0 0 18px;
    font-size: 13.5px;
}

.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; color: var(--text-soft); }

.channel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
}

.channel:last-of-type { border-bottom: 0; }
.channel > div:first-child { display: grid; gap: 4px; min-width: 0; }
.channel strong { color: var(--navy); font-size: 14px; }
.channel .row { justify-content: flex-end; }

.legend { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 12px; color: var(--muted); font-size: 12.5px; }
.dot { display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%; }
.dot-ok { background: var(--ok); }
.dot-warn { background: #d98b00; }
.dot-bad { background: var(--bad); }
.dot-muted { background: #8b97ab; }

.error-page { padding: 70px 20px; text-align: center; }
.error-code { margin-bottom: 8px; color: var(--navy); font-size: 72px; font-weight: 800; line-height: 1; }

/* -------------------------------------------------------- mobile nav ------ */
.bottom-nav { display: none; }

.sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(11, 26, 51, .4);
    backdrop-filter: blur(2px);
}

.sheet-backdrop[hidden] { display: none; }

.more-sheet {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 95;
    display: grid;
    gap: 2px;
    padding: 10px 14px calc(18px + env(safe-area-inset-bottom));
    border-radius: 22px 22px 0 0;
    background: var(--surface);
    box-shadow: 0 -18px 50px rgba(11, 27, 54, .2);
    transform: translateY(105%);
    transition: transform .25s cubic-bezier(.2, .7, .3, 1);
}

.more-sheet.is-open { transform: translateY(0); }

.sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 4px 10px;
    border-bottom: 1px solid var(--line);
}

.sheet-head strong { color: var(--navy); font-size: 16px; }

.sheet-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 50px;
    padding: 10px 6px;
    border-bottom: 1px solid #eef1f6;
    color: var(--text-soft);
    font-size: 14px;
    font-weight: 600;
}

.sheet-link:hover { color: var(--navy); text-decoration: none; }
.sheet-link .icon { width: 19px; height: 19px; color: var(--primary); }
.sheet-link span { flex: 1 1 auto; }
.sheet-link .icon:last-child { width: 16px; height: 16px; color: #a1abbb; }
.sheet-link-danger { color: var(--bad); }
.sheet-link-danger .icon { color: var(--bad); }

/* --------------------------------------------------- confirmation modal --- */
.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    padding: 20px;
    place-items: center;
    background: rgba(11, 26, 51, .48);
    backdrop-filter: blur(3px);
}

.confirm-dialog {
    width: min(100%, 430px);
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    animation: confirm-enter .18s ease both;
}

.confirm-dialog h2 { margin-bottom: 8px; font-size: 18px; }
.confirm-dialog p { color: var(--muted); font-size: 13.5px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

@keyframes confirm-enter {
    from { opacity: 0; transform: translateY(8px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --------------------------------------------------------- breakpoints ---- */
@media (min-width: 1200px) {
    .sidebar-toggle { display: grid; }

    html.sidebar-collapsed .app-sidebar { width: var(--sidebar-compact); }
    html.sidebar-collapsed .app-frame { margin-left: var(--sidebar-compact); }

    html.sidebar-collapsed .sidebar-head {
        justify-content: center;
        padding-inline: 10px;
    }

    html.sidebar-collapsed .brand-copy,
    html.sidebar-collapsed .nav-caption,
    html.sidebar-collapsed .nav-item > span,
    html.sidebar-collapsed .nav-caret,
    html.sidebar-collapsed .nav-count,
    html.sidebar-collapsed .sidebar-profile-copy,
    html.sidebar-collapsed .sidebar-version {
        display: none;
    }

    html.sidebar-collapsed .sidebar-nav { padding-inline: 10px; }
    html.sidebar-collapsed .nav-item {
        width: 48px;
        min-height: 44px;
        margin-inline: auto;
        padding: 0;
        justify-content: center;
    }

    html.sidebar-collapsed .nav-item.active::before { display: none; }
    html.sidebar-collapsed .sidebar-profile { justify-content: center; padding: 7px 0; }
    html.sidebar-collapsed .sidebar-foot { padding-inline: 10px; }

    html.sidebar-collapsed .nav-group > .nav-sub {
        position: absolute;
        top: 0;
        left: calc(100% + 8px);
        z-index: 80;
        width: 214px;
        padding: 8px;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background: var(--surface);
        box-shadow: var(--shadow-md);
    }

    html.sidebar-collapsed .nav-group:not([open]) > .nav-sub { display: none; }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .app-sidebar {
        width: var(--sidebar-compact);
        box-shadow: 4px 0 20px rgba(17, 33, 63, .04);
    }

    .app-frame { margin-left: var(--sidebar-compact); }
    .sidebar-head { justify-content: center; padding-inline: 10px; }

    .brand-copy,
    .nav-caption,
    .nav-item > span,
    .nav-caret,
    .nav-count,
    .sidebar-profile-copy,
    .sidebar-version {
        display: none;
    }

    .sidebar-nav { padding-inline: 10px; }

    .nav-item {
        width: 48px;
        min-height: 44px;
        margin-inline: auto;
        padding: 0;
        justify-content: center;
    }

    .nav-item.active::before { display: none; }

    .sidebar-profile { justify-content: center; padding: 7px 0; }
    .sidebar-foot { padding-inline: 10px; }

    .nav-toggle { display: grid; }
    .sidebar-toggle { display: grid; top: 88px; }

    .nav-group > .nav-sub {
        position: absolute;
        top: 0;
        left: calc(100% + 8px);
        z-index: 80;
        width: 214px;
        padding: 8px;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background: var(--surface);
        box-shadow: var(--shadow-md);
    }

    html.sidebar-expanded .app-sidebar { width: var(--sidebar-width); box-shadow: var(--shadow-lg); }
    html.sidebar-expanded .sidebar-head { justify-content: flex-start; padding-inline: 18px; }
    html.sidebar-expanded .brand-copy,
    html.sidebar-expanded .nav-caption,
    html.sidebar-expanded .nav-item > span,
    html.sidebar-expanded .nav-caret,
    html.sidebar-expanded .nav-count,
    html.sidebar-expanded .sidebar-profile-copy,
    html.sidebar-expanded .sidebar-version {
        display: grid;
    }

    html.sidebar-expanded .nav-item {
        width: 100%;
        justify-content: flex-start;
        padding: 9px 12px;
    }

    html.sidebar-expanded .nav-item.active::before { display: block; }
    html.sidebar-expanded .sidebar-profile { justify-content: flex-start; padding: 7px; }
    html.sidebar-expanded .nav-group > .nav-sub {
        position: static;
        width: auto;
        padding: 3px 0 5px 23px;
        border: 0;
        background: transparent;
        box-shadow: none;
    }
}

@media (max-width: 767px) {
    .app-sidebar {
        width: min(290px, 86vw);
        transform: translateX(-105%);
        border-right: 0;
        box-shadow: var(--shadow-lg);
    }

    html.sidebar-open .app-sidebar { transform: translateX(0); }
    .app-frame { margin-left: 0; }

    .sidebar-head { justify-content: flex-start; padding-inline: 16px; }
    .brand-copy { display: grid; }

    .sidebar-close {
        display: grid;
        width: 36px;
        height: 36px;
        margin-left: auto;
        padding: 0;
        place-items: center;
        border: 1px solid var(--line);
        border-radius: var(--radius-sm);
        background: var(--surface);
        color: var(--muted);
        cursor: pointer;
    }

    .sidebar-close .icon { width: 18px; height: 18px; }
    .sidebar-toggle { display: none; }

    .app-topbar {
        min-height: 60px;
        padding: 8px 16px;
        padding-top: calc(8px + env(safe-area-inset-top));
    }

    .nav-toggle { display: grid; }
    .mobile-brand {
        display: flex;
        align-items: center;
        gap: 7px;
        min-width: 0;
    }

    .mobile-brand:hover { text-decoration: none; }
    .mobile-brand img { width: 32px; height: 32px; flex: 0 0 auto; object-fit: contain; }
    .mobile-brand .mobile-brand-word {
        width: auto;
        max-width: 112px;
        height: 24px;
        object-fit: contain;
        object-position: left center;
    }

    .topbar-title { display: none; }
    .topbar-left { gap: 9px; min-width: 0; }
    .topbar-actions { gap: 2px; }
    .langswitch,
    .topbar-sep,
    .usermenu-copy,
    .usermenu-caret { display: none; }
    .usermenu > summary { padding: 2px; }
    .icon-btn { width: 38px; height: 38px; }
    .usermenu .avatar { width: 36px; height: 36px; }
    .usermenu-pop { right: -4px; }

    .page-banner-inner { padding: 16px 16px 18px; }
    .page-banner h1 { font-size: 22px; }
    .breadcrumb { font-size: 11px; }

    .wrap { padding: 18px 16px 96px; }
    .app-frame .wrap { padding-top: 18px; }

    .foot {
        padding: 16px 16px calc(88px + env(safe-area-inset-bottom));
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        font-size: 11px;
    }

    .card { padding: 17px; border-radius: var(--radius); margin-bottom: 16px; }
    .page-head { margin-bottom: 16px; }
    .page-head > div { width: 100%; }
    .page-head > .btn { width: 100%; }

    .grid { gap: 16px; }
    .grid-2,
    .grid-4,
    .grid-main,
    .stats-grid { grid-template-columns: minmax(0, 1fr); }

    .stats-grid { gap: 12px; }

    .filters {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        align-items: stretch;
        gap: 10px;
        padding: 12px;
    }

    .filters .field-inline,
    .filters .filter-search,
    .filters .btn { width: 100%; }

    .filter-actions { width: 100%; }
    .filter-actions .btn { flex: 1 1 0; }

    .row { align-items: stretch; }
    .row > .btn { flex: 1 1 auto; }

    .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
    .kv dt { margin-top: 9px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
    .kv dd { margin-bottom: 3px; }

    .channel { align-items: flex-start; flex-direction: column; gap: 10px; }
    .channel .row { width: 100%; justify-content: flex-start; }

    .pagination { align-items: flex-start; }
    .pagination-actions { width: 100%; }
    .pagination-actions .btn { flex: 1 1 0; }

    .empty-state { min-height: 132px; padding: 20px 16px; }

    .bottom-nav {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 88;
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        min-height: 66px;
        padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--line);
        background: rgba(255, 255, 255, .97);
        backdrop-filter: blur(12px);
        box-shadow: 0 -6px 24px rgba(17, 33, 63, .07);
    }

    .bottom-nav a,
    .bottom-nav button {
        display: grid;
        align-content: center;
        justify-items: center;
        gap: 3px;
        min-width: 0;
        min-height: 48px;
        padding: 4px;
        border: 0;
        border-radius: var(--radius-sm);
        background: transparent;
        color: #6d7a91;
        font-size: 10.5px;
        font-weight: 700;
        cursor: pointer;
    }

    .bottom-nav a:hover,
    .bottom-nav button:hover { background: var(--blue-lighter); text-decoration: none; }
    .bottom-nav a.active,
    .bottom-nav button.active { background: var(--blue-light); color: var(--navy); }
    .bottom-nav .icon { width: 20px; height: 20px; }

    .table { display: block; overflow-x: auto; white-space: nowrap; }

    input, select, textarea { font-size: 16px; }
}

@media (max-width: 380px) {
    .app-topbar { padding-inline: 12px; }
    .mobile-brand .mobile-brand-word { max-width: 92px; height: 21px; }
    .wrap { padding-inline: 12px; }
    .page-banner-inner { padding-inline: 14px; }
}

@media print {
    .app-sidebar,
    .app-topbar,
    .page-banner,
    .bottom-nav,
    .more-sheet,
    .sheet-backdrop,
    .sidebar-backdrop,
    .foot { display: none !important; }

    .app-frame { margin-left: 0 !important; }
    .wrap { max-width: none; padding: 0; }
}

/* ==========================================================================
   Dashboard
   ========================================================================== */

.dashboard {
    display: grid;
    gap: 16px;
}

.dashboard-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

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

.dashboard-eyebrow {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
    margin-bottom: 6px;
    color: var(--primary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
    white-space: nowrap;
}

.dashboard-hero h1 {
    margin: 0 0 4px;
    color: var(--navy);
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: -.03em;
}

.dashboard-hero .welcome-line {
    margin: 0 0 4px;
    color: var(--text-soft);
    font-size: 14.5px;
    font-weight: 600;
    white-space: nowrap;
}

.dashboard-description {
    position: relative;
    margin: 0 0 5px;
    padding-left: 20px;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.45;
    white-space: nowrap;
}

.dashboard-description .icon {
    position: absolute;
    top: 2px;
    left: 0;
    width: 14px;
    height: 14px;
    color: var(--primary);
}

.dashboard-date {
    display: inline-flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
    color: var(--muted);
    font-size: 12.5px;
    white-space: nowrap;
}

.dashboard-date .icon { width: 14px; height: 14px; }

.dashboard-hero .breadcrumb { margin-bottom: 10px; }

.hero-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin: 0;
}

.summary-card {
    display: grid;
    gap: 0;
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    color: var(--text);
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.summary-card:hover {
    border-color: #bcd0ea;
    box-shadow: var(--shadow-sm);
    color: var(--text);
    text-decoration: none;
    transform: translateY(-1px);
}

.summary-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.summary-icon {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: var(--radius-sm);
    background: var(--blue-light);
    color: var(--navy);
}

.summary-icon .icon { width: 20px; height: 20px; }

.summary-arrow {
    display: grid;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 50%;
    background: var(--surface-muted);
    color: #9aa5b6;
}

.summary-arrow .icon { width: 14px; height: 14px; }

.summary-value {
    color: var(--navy);
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -.04em;
    line-height: 1;
}

.summary-label {
    margin-top: 7px;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.summary-note {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.summary-pending .summary-icon { background: var(--warn-soft); color: var(--warn); }
.summary-completed .summary-icon { background: var(--ok-soft); color: var(--ok); }
.summary-overdue .summary-icon { background: var(--bad-soft); color: var(--bad); }

.telegram-notice {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    margin: 0;
    padding: 15px 17px;
    border: 1px solid #f0dcb5;
    border-radius: var(--radius-lg);
    background: var(--warn-soft);
}

.telegram-notice-copy { display: grid; gap: 2px; min-width: 0; }
.telegram-notice strong { color: #6f4d06; font-size: 13.5px; }
.telegram-notice-copy span { color: #7b673e; font-size: 12.5px; line-height: 1.45; white-space: nowrap; }

.telegram-notice-icon {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border-radius: var(--radius-sm);
    background: #f6e2b9;
    color: #94671b;
}

.telegram-notice-icon .icon { width: 23px; height: 23px; }
.telegram-notice .btn { flex: 0 0 auto; }

.telegram-connected {
    grid-template-columns: 46px minmax(0, 1fr);
    border-color: #c9e6d6;
    background: var(--ok-soft);
}

.telegram-connected strong { color: var(--ok); }
.telegram-connected span { color: #47755e; }
.telegram-connected .telegram-notice-icon { background: #d8efdf; color: var(--ok); }

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr);
    gap: 20px;
    align-items: start;
}

.dashboard-grid > .dashboard-primary > .card,
.dashboard-grid > .dashboard-aside > .card {
    padding: 18px;
}

.dashboard-primary {
    display: grid;
    gap: 20px;
    min-width: 0;
}

.dashboard-primary .card,
.dashboard-aside .card { margin-bottom: 0; }

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

/* Today's task rows */
.task-list {
    display: grid;
    gap: 10px;
}

.task-item {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    transition: border-color .16s ease, background .16s ease;
}

.task-item:hover { border-color: #c8d8ec; background: #fcfdff; }

.task-time {
    display: grid;
    gap: 1px;
    padding-right: 12px;
    border-right: 1px solid var(--line);
}

.task-time strong {
    color: var(--navy);
    font-size: 16px;
    font-weight: 800;
    line-height: 1.1;
}

.task-time span { color: var(--muted); font-size: 11px; }

.task-body { display: grid; gap: 4px; min-width: 0; }
.task-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-title h3 {
    min-width: 0;
    margin: 0;
    color: var(--navy);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.task-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 11.5px;
    flex-wrap: wrap;
}

.task-meta .icon { width: 13px; height: 13px; }
.task-item .btn { flex: 0 0 auto; }

/* Upcoming schedule rows */
.schedule-list { display: grid; gap: 2px; }

.schedule-item {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr) auto;
    align-items: center;
    gap: 13px;
    padding: 12px 4px;
    border-bottom: 1px solid #eef1f6;
}

.schedule-item:last-child { border-bottom: 0; }

.schedule-date {
    display: grid;
    justify-items: center;
    gap: 0;
    padding: 3px 6px;
    border-radius: var(--radius-xs);
    background: var(--blue-lighter);
    color: var(--navy);
    line-height: 1.1;
}

.schedule-date strong { font-size: 17px; font-weight: 800; }
.schedule-date span {
    color: var(--muted);
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.schedule-body { display: grid; gap: 2px; min-width: 0; }
.schedule-body strong {
    color: var(--text-soft);
    font-size: 13.5px;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.schedule-body span {
    color: var(--muted);
    font-size: 11.5px;
}

.schedule-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.schedule-action .icon { width: 14px; height: 14px; }

/* Activity timeline */
.activity-list {
    display: grid;
    gap: 0;
}

.activity-item {
    position: relative;
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 11px;
    padding: 0 0 18px;
}

.activity-item:last-child { padding-bottom: 0; }

.activity-item::before {
    content: "";
    position: absolute;
    top: 30px;
    bottom: 0;
    left: 14px;
    width: 1px;
    background: var(--line);
}

.activity-item:last-child::before { display: none; }

.activity-icon {
    display: grid;
    width: 30px;
    height: 30px;
    place-items: center;
    border-radius: 50%;
    background: var(--blue-light);
    color: var(--primary);
}

.activity-icon .icon { width: 15px; height: 15px; }
.activity-icon.activity-ok { background: var(--ok-soft); color: var(--ok); }
.activity-icon.activity-warn { background: var(--warn-soft); color: var(--warn); }
.activity-icon.activity-info { background: var(--info-soft); color: var(--info); }

.activity-body { display: grid; gap: 1px; min-width: 0; padding-top: 1px; }

.activity-body strong {
    color: var(--text-soft);
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.activity-body span {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.activity-time {
    color: #8e99aa !important;
    font-size: 10.5px !important;
    font-weight: 600;
}

.activity-foot {
    margin-top: 16px;
    padding-top: 13px;
    border-top: 1px solid var(--line);
}

.activity-foot .btn { width: 100%; }

/* ==========================================================================
   Module refinements
   ========================================================================== */

.back {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
}

.btn[href*="sup.report.pdf"],
.export-btn {
    gap: 8px;
}

.review {
    border-left: 0;
    overflow: hidden;
}

.review::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--primary);
}

.review .review-head {
    align-items: flex-start;
    gap: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--line);
}

.review .review-head h3 { margin-bottom: 3px; font-size: 15px; }
.review .review-head .small { font-size: 11.5px; }
.review .review-head > div:last-child { display: flex; gap: 5px; flex-wrap: wrap; }
.review .kv { margin: 14px 0 16px; }
.review form { gap: 13px; }
.review .row { gap: 9px; }
.review .btn-danger { margin-left: 0; }

.table-compact { font-size: 13px; }
.table-compact td { font-size: 12.5px; }

.report-status,
.pdf-report-actions { margin-bottom: 18px; }

.pdf-report-head { margin-bottom: 18px; }

.settings-tabs {
    display: flex;
    gap: 6px;
    margin: 0 0 20px;
    padding: 5px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    overflow-x: auto;
    scrollbar-width: thin;
}

.settings-tabs a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-xs);
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
}

.settings-tabs a:hover { background: var(--blue-lighter); color: var(--navy); text-decoration: none; }
.settings-tabs a .icon { width: 15px; height: 15px; }

.settings-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.settings-card-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; }
.settings-card-head h2 .icon { width: 18px; height: 18px; color: var(--primary); }
.settings-card-head p { margin: 0; color: var(--muted); font-size: 12.5px; }

.notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid #d3e2f5;
    border-radius: var(--radius);
    background: var(--blue-lighter);
    color: #3e587a;
    font-size: 12.5px;
}

.notice .icon { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; color: var(--primary); }

.telegram-link-box {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pwa-install {
    overflow: hidden;
    border-color: #d2e3f7;
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(49, 95, 155, .09), transparent 58%),
        linear-gradient(120deg, #fbfdff 0%, #f3f8ff 58%, #edf5ff 100%);
}

.pwa-install::after { display: none; }
.pwa-install-head { gap: 14px; }
.pwa-install-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius);
    background: var(--navy);
    color: #fff;
    box-shadow: 0 8px 18px rgba(24, 59, 112, .18);
}

.pwa-badge {
    border-color: #cfe0f5;
    background: #fff;
    color: var(--primary);
    font-size: 9.5px;
    letter-spacing: .08em;
}

.pwa-chips { margin-left: 60px; }
.pwa-actions { margin-left: 60px; }
.pwa-help,
.pwa-note { margin-left: 60px; }
.pwa-chip { border-color: #d6e4f5; background: rgba(255, 255, 255, .9); }
.pwa-help { border-color: #d9e5f4; }

/* Auth screens ------------------------------------------------------------- */
.auth-topbar {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 78px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .24);
    background: rgba(255, 255, 255, .96);
}

.auth-topbar .brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--navy);
}

.auth-topbar .brand:hover { text-decoration: none; }
.auth-topbar .brand-icon { width: 40px; height: 40px; object-fit: contain; }
.auth-topbar .brand-divider { width: 1px; height: 30px; background: var(--line); }
.auth-topbar .brand-word { width: auto; height: 32px; object-fit: contain; }

body.auth-page {
    background:
        radial-gradient(circle at 12% 10%, rgba(69, 132, 204, .5), transparent 32rem),
        radial-gradient(circle at 88% 22%, rgba(38, 95, 168, .36), transparent 30rem),
        linear-gradient(145deg, #1c5f9f 0%, #2b74b5 48%, #173f76 100%);
    background-attachment: fixed;
}

body.auth-page .auth-wrap {
    display: grid;
    align-content: center;
    width: 100%;
    min-height: calc(100dvh - 76px);
    padding: 38px 20px;
}

.auth {
    width: 100%;
    max-width: 472px;
    margin: 0 auto;
}

.auth-card {
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, .75);
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 26px 70px rgba(7, 26, 54, .24);
}

.auth-card .auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    margin: -4px 0 22px;
}
.auth-card .auth-brand-icon {
    width: 72px;
    height: 72px;
    margin: 0;
    object-fit: contain;
}
.auth-card .auth-brand-word {
    display: block;
    width: min(280px, 100%);
    height: auto;
    object-fit: contain;
}

.auth-card h1 { font-size: 26px; }
.auth-card h2 { font-size: 20px; }
.auth-links {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    flex-wrap: wrap;
    font-size: 13px;
}

.auth-foot {
    border-top: 1px solid rgba(255, 255, 255, .2);
    color: rgba(255, 255, 255, .78);
    max-width: 100%;
    padding-inline: 24px;
}

.auth-foot .muted { color: rgba(255, 255, 255, .62); }

@media (max-width: 1199px) {
    .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
    .dashboard-aside { margin-top: 0; }
}

@media (max-width: 1023px) {
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .skeleton-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .skeleton-content { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 767px) {
    .dashboard { gap: 16px; }
    .page-skeleton { gap: 12px; }
    .skeleton-stats { gap: 10px; }
    .skeleton-stats > span { min-height: 92px; }
    .skeleton-content > span { min-height: 190px; }
    .dashboard-hero { align-items: flex-start; gap: 14px; }
    .dashboard-hero h1 { font-size: 23px; }
    .dashboard-hero .welcome-line { font-size: 13.5px; }
    .dashboard-hero .welcome-line,
    .dashboard-description,
    .dashboard-date { white-space: normal; }
    .dashboard-description { max-width: 100%; }
    .dashboard-grid > .dashboard-primary > .card,
    .dashboard-grid > .dashboard-aside > .card { padding: 16px; }
    .hero-actions { width: 100%; }
    .hero-actions .btn { width: 100%; }

    .summary-grid { gap: 10px; }
    .summary-card { padding: 14px; }
    .summary-icon { width: 35px; height: 35px; }
    .summary-icon .icon { width: 18px; height: 18px; }
    .summary-value { font-size: 25px; }
    .summary-label { font-size: 12px; }
    .summary-note { font-size: 10.5px; }
    .summary-top { margin-bottom: 10px; }

    .telegram-notice {
        grid-template-columns: 40px minmax(0, 1fr);
        padding: 13px;
        gap: 11px;
    }

    .telegram-notice-icon { width: 40px; height: 40px; }
    .telegram-notice .btn { grid-column: 1 / -1; width: 100%; }
    .telegram-notice-copy span { white-space: normal; }
    .telegram-connected { grid-template-columns: 40px minmax(0, 1fr); }

    .task-item {
        grid-template-columns: 58px minmax(0, 1fr);
        align-items: start;
        gap: 11px;
        padding: 12px;
    }

    .task-time { padding-right: 9px; }
    .task-time strong { font-size: 14px; }
    .task-item .btn { grid-column: 1 / -1; width: 100%; }
    .task-title h3 { font-size: 13.5px; }

    .schedule-item { grid-template-columns: 48px minmax(0, 1fr); gap: 11px; }
    .schedule-action { grid-column: 2; justify-self: start; }
    .schedule-date strong { font-size: 15px; }

    .pwa-chips,
    .pwa-actions,
    .pwa-help,
    .pwa-note { margin-left: 0; }
    .pwa-install-head { gap: 11px; }

    .settings-tabs { margin-bottom: 16px; }

    body.auth-page .auth-wrap { padding: 22px 14px 26px; }
    .auth-card { padding: 22px; }
    .auth-card .auth-brand {
        gap: 8px;
        margin-bottom: 18px;
    }
    .auth-card .auth-brand-icon { width: 58px; height: 58px; }
    .auth-card .auth-brand-word { width: min(230px, 100%); }
}

@media (max-width: 420px) {
    .summary-card { padding: 12px; gap: 0; }
    .summary-icon { width: 32px; height: 32px; }
    .summary-value { font-size: 23px; }
    .summary-note { display: none; }
}

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