:root {
    --canvas: #f4f5f3;
    --surface: #ffffff;
    --surface-muted: #f8f9f7;
    --ink: #171a1d;
    --ink-soft: #5d6460;
    --ink-faint: #7f8782;
    --line: #dfe3df;
    --line-strong: #cbd1cc;
    --sidebar: #171a1d;
    --sidebar-soft: #24292c;
    --green: #1f7a5c;
    --green-bright: #61c295;
    --green-soft: #e8f5ef;
    --blue: #2763c4;
    --blue-soft: #eaf1fc;
    --amber: #a76512;
    --amber-soft: #fff3df;
    --violet: #7156a8;
    --violet-soft: #f1edfa;
    --danger: #b23a36;
    --danger-soft: #fbeceb;
    --shadow: 0 10px 30px rgba(23, 26, 29, 0.07);
    --font: "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
    --mono: "Cascadia Mono", "Consolas", monospace;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--canvas);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    letter-spacing: 0;
    -webkit-font-smoothing: antialiased;
}

body.menu-open {
    overflow: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
textarea,
select {
    font: inherit;
    letter-spacing: 0;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid rgba(39, 99, 196, 0.24);
    outline-offset: 2px;
}

svg {
    display: block;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 252px minmax(0, 1fr);
}

.shell-sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 22px 16px 18px;
    color: #f8faf8;
    background: var(--sidebar);
    border-right: 1px solid #272c2f;
}

.brand-mark,
.mobile-brand,
.auth-brand {
    display: flex;
    align-items: center;
    gap: 11px;
}

.brand-mark {
    min-height: 52px;
    padding: 6px 8px;
}

.brand-symbol {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: grid;
    place-items: center;
    border-radius: 6px;
    color: #10251c;
    background: var(--green-bright);
    font-size: 0.78rem;
    font-weight: 850;
}

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

.brand-copy strong,
.mobile-brand strong {
    font-size: 1rem;
    line-height: 1.2;
}

.brand-copy small {
    color: #aeb6b1;
    font-size: 0.75rem;
}

.shell-nav {
    display: grid;
    gap: 4px;
    margin-top: 34px;
}

.nav-label,
.support-label,
.page-eyebrow,
.section-kicker,
.auth-kicker {
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0;
    text-transform: uppercase;
}

.nav-label {
    margin: 0 10px 8px;
    color: #7f8983;
}

.shell-nav-link,
.shell-logout {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 0 11px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: #bdc4c0;
    font-weight: 620;
    transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.shell-nav-link svg,
.shell-logout svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

.shell-nav-link:hover,
.shell-logout:hover {
    color: #ffffff;
    background: var(--sidebar-soft);
}

.shell-nav-link.is-active {
    color: #ffffff;
    background: #26352f;
    border-color: #35483f;
}

.shell-nav-link.is-active svg {
    color: var(--green-bright);
}

.sidebar-support {
    display: grid;
    gap: 6px;
    margin-top: auto;
    padding: 14px 11px;
    border: 1px solid #32383a;
    border-radius: 6px;
    background: #1d2123;
}

.support-label {
    color: #858e89;
}

.sidebar-support a,
.copy-contact {
    color: #d8dedb;
    font-size: 0.8rem;
}

.sidebar-support a:hover {
    color: var(--green-bright);
}

.copy-contact {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.copy-contact span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.copy-contact svg {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
}

.shell-logout {
    margin-top: 10px;
}

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

.mobile-header {
    display: none;
}

.shell-main {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    padding: 34px 34px 52px;
}

.page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--line);
}

.page-eyebrow,
.section-kicker,
.auth-kicker {
    color: var(--green);
}

.page-heading h1 {
    margin: 5px 0 4px;
    font-size: 2rem;
    line-height: 1.18;
}

.page-heading p {
    margin: 0;
    color: var(--ink-soft);
}

.system-badge {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink-soft);
    background: var(--surface);
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.system-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #d19b3b;
}

.system-badge.is-ready {
    color: var(--green);
    border-color: #b8dacb;
    background: var(--green-soft);
}

.system-badge.is-ready .system-dot {
    background: var(--green);
}

.system-badge.is-error {
    color: var(--danger);
    border-color: #efc5c3;
    background: var(--danger-soft);
}

.system-badge.is-error .system-dot {
    background: var(--danger);
}

.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 310px;
    gap: 18px;
    margin-top: 24px;
    align-items: start;
}

.tool-section,
.data-panel {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
}

.section-heading {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}

.section-heading h2 {
    margin: 2px 0 0;
    font-size: 1.05rem;
    line-height: 1.25;
}

.section-meta {
    color: var(--ink-faint);
    font-size: 0.78rem;
    white-space: nowrap;
}

.tool-list {
    display: grid;
}

.tool-row {
    min-height: 102px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    align-items: center;
    gap: 13px;
    padding: 15px 16px;
    transition: background 150ms ease;
}

.tool-row + .tool-row {
    border-top: 1px solid var(--line);
}

.tool-row:hover {
    background: var(--surface-muted);
}

.tool-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 6px;
}

.tool-icon svg {
    width: 20px;
    height: 20px;
}

.tool-icon-green { color: var(--green); background: var(--green-soft); }
.tool-icon-blue { color: var(--blue); background: var(--blue-soft); }
.tool-icon-amber { color: var(--amber); background: var(--amber-soft); }
.tool-icon-violet { color: var(--violet); background: var(--violet-soft); }

.tool-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.tool-copy strong {
    font-size: 0.92rem;
}

.tool-copy small {
    color: var(--ink-soft);
    font-size: 0.79rem;
    line-height: 1.4;
}

.tool-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--green);
    font-size: 0.78rem;
    font-weight: 750;
}

.tool-action svg {
    width: 15px;
    height: 15px;
}

.icon-button {
    width: 40px;
    height: 40px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    background: var(--surface);
    cursor: pointer;
}

.icon-button:hover {
    border-color: var(--line-strong);
    background: var(--surface-muted);
}

.icon-button svg {
    width: 18px;
    height: 18px;
}

.icon-button.subtle {
    width: 34px;
    height: 34px;
}

.icon-button.is-spinning svg {
    animation: spin 800ms linear infinite;
}

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

.status-list {
    margin: 0;
}

.status-list > div {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line);
}

.status-list dt {
    color: var(--ink-soft);
    font-size: 0.8rem;
}

.status-list dd {
    margin: 0;
    text-align: right;
    font-size: 0.82rem;
    font-weight: 720;
}

.data-note {
    margin: 0;
    padding: 14px 16px;
    color: var(--ink-soft);
    background: var(--surface-muted);
    font-size: 0.78rem;
}

.site-toast {
    position: fixed;
    z-index: 100;
    right: 20px;
    bottom: 20px;
    max-width: min(360px, calc(100vw - 32px));
    padding: 11px 14px;
    border-radius: 6px;
    color: #ffffff;
    background: #252a2d;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 150ms ease, transform 150ms ease;
}

.site-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.sidebar-overlay {
    display: none;
}

.auth-body {
    background: #ffffff;
}

.auth-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(340px, 0.85fr) minmax(460px, 1.15fr);
}

.auth-brand-panel {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 44px;
    color: #ffffff;
    background: var(--sidebar);
}

.brand-symbol-large {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
}

.auth-brand > div {
    display: grid;
}

.auth-brand strong {
    font-size: 1.12rem;
}

.auth-brand span:not(.brand-symbol) {
    color: #9ba49f;
    font-size: 0.78rem;
}

.auth-brand-copy {
    max-width: 520px;
}

.auth-brand-copy > span {
    color: var(--green-bright);
    font-size: 0.76rem;
    font-weight: 750;
    text-transform: uppercase;
}

.auth-brand-copy h1 {
    margin: 12px 0 16px;
    font-size: 2.8rem;
    line-height: 1.1;
}

.auth-brand-copy p,
.auth-brand-panel > small {
    color: #adb5b0;
}

.auth-brand-copy p {
    max-width: 440px;
    margin: 0;
    font-size: 1rem;
}

.auth-form-panel {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px;
}

.auth-form-shell {
    width: 100%;
    max-width: 430px;
}

.auth-heading h2 {
    margin: 5px 0 5px;
    font-size: 2rem;
}

.auth-heading p {
    margin: 0;
    color: var(--ink-soft);
}

.auth-error {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-top: 22px;
    padding: 11px 12px;
    border: 1px solid #efc5c3;
    border-radius: 6px;
    color: var(--danger);
    background: var(--danger-soft);
    font-size: 0.86rem;
    font-weight: 650;
}

.auth-error svg {
    width: 18px;
    height: 18px;
}

.auth-form {
    display: grid;
    gap: 10px;
    margin-top: 26px;
}

.auth-label {
    font-size: 0.84rem;
    font-weight: 700;
}

.auth-input-wrap {
    position: relative;
}

.auth-input-wrap > svg {
    position: absolute;
    left: 14px;
    top: 17px;
    width: 18px;
    height: 18px;
    color: var(--ink-faint);
}

.auth-input {
    width: 100%;
    height: 52px;
    padding: 0 52px 0 42px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    color: var(--ink);
    background: #ffffff;
}

.auth-input:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(31, 122, 92, 0.12);
}

.auth-toggle {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 5px;
    color: var(--ink-soft);
    background: transparent;
    cursor: pointer;
}

.auth-toggle:hover {
    color: var(--ink);
    background: var(--surface-muted);
}

.auth-toggle svg {
    width: 18px;
    height: 18px;
}

.auth-submit,
.primary-link {
    min-height: 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 6px;
    color: #ffffff;
    background: var(--green);
    font-weight: 750;
    cursor: pointer;
    transition: background 150ms ease;
}

.auth-submit:hover,
.primary-link:hover {
    background: #176448;
}

.auth-submit svg,
.primary-link svg {
    width: 17px;
    height: 17px;
}

.auth-support {
    display: grid;
    gap: 10px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.auth-support > span {
    color: var(--ink-soft);
    font-size: 0.8rem;
}

.auth-contacts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.auth-contacts a,
.auth-contacts button {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    background: var(--surface-muted);
    font-size: 0.78rem;
    cursor: pointer;
}

.auth-contacts a:hover,
.auth-contacts button:hover {
    border-color: var(--line-strong);
    background: #ffffff;
}

.auth-contacts svg {
    width: 15px;
    height: 15px;
}

.error-page {
    max-width: 560px;
    padding-top: 10vh;
}

.error-code {
    color: var(--green);
    font-size: 0.78rem;
    font-weight: 800;
}

.error-page h1 {
    margin: 8px 0;
    font-size: 2rem;
}

.error-page p {
    margin: 0 0 24px;
    color: var(--ink-soft);
}

.primary-link {
    min-height: 44px;
    padding: 0 16px;
}

@media (max-width: 1280px) {
    .dashboard-layout {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .data-panel {
        grid-column: 1 / -1;
    }
}

@media (max-width: 1024px) {
    .app-shell {
        display: block;
    }

    .shell-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: min(286px, calc(100vw - 44px));
        transform: translateX(-102%);
        transition: transform 180ms ease;
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.18);
    }

    .shell-sidebar.is-open {
        transform: translateX(0);
    }

    .mobile-header {
        position: sticky;
        top: 0;
        z-index: 30;
        height: 64px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 22px;
        border-bottom: 1px solid var(--line);
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(12px);
    }

    .mobile-brand .brand-symbol {
        width: 32px;
        height: 32px;
        flex-basis: 32px;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 35;
        display: block;
        border: 0;
        background: rgba(10, 12, 13, 0.48);
        opacity: 0;
        pointer-events: none;
        transition: opacity 180ms ease;
    }

    .sidebar-overlay.is-visible {
        opacity: 1;
        pointer-events: auto;
    }

    .auth-brand-copy h1 {
        font-size: 2.25rem;
    }
}

@media (max-width: 760px) {
    .shell-main {
        padding: 24px 16px 40px;
    }

    .page-heading {
        display: grid;
        gap: 16px;
    }

    .page-heading h1 {
        font-size: 1.65rem;
    }

    .system-badge {
        width: fit-content;
    }

    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .data-panel {
        grid-column: auto;
    }

    .tool-row {
        grid-template-columns: 42px minmax(0, 1fr);
    }

    .tool-action {
        grid-column: 2;
    }

    .auth-layout {
        display: block;
    }

    .auth-brand-panel {
        min-height: auto;
        padding: 24px;
    }

    .auth-brand-copy,
    .auth-brand-panel > small {
        display: none;
    }

    .auth-form-panel {
        min-height: calc(100vh - 94px);
        align-items: start;
        padding: 48px 22px 30px;
    }

    .auth-heading h2 {
        font-size: 1.8rem;
    }

    .auth-contacts {
        display: grid;
    }

    .auth-contacts a,
    .auth-contacts button {
        justify-content: flex-start;
    }
}

@media (max-width: 420px) {
    .mobile-header {
        padding: 0 14px;
    }

    .tool-row {
        min-height: 112px;
        padding: 14px;
    }

    .section-heading {
        padding: 13px 14px;
    }
}

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