:root {
    color-scheme: light;
    --ink: #1f2933;
    --muted: #667085;
    --line: #d7dee8;
    --surface: #ffffff;
    --page: #f5f7fa;
    --teal: #0f766e;
    --teal-dark: #115e59;
    --coral: #c2410c;
    --focus: #f59e0b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 15px;
    line-height: 1.45;
}

a {
    color: var(--teal-dark);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.topbar {
    align-items: center;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 24px;
    justify-content: space-between;
    padding: 14px clamp(16px, 4vw, 40px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    align-items: center;
    color: var(--ink);
    display: flex;
    font-weight: 700;
    gap: 10px;
}

.brand-strip {
    align-items: center;
    display: flex;
    gap: 12px;
}

.sidebar-toggle {
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    cursor: pointer;
    display: inline-flex;
    height: 40px;
    justify-content: center;
    width: 40px;
}

.sidebar-toggle:hover {
    background: #eef2f7;
}

.brand-logo {
    align-items: center;
    border-radius: 6px;
    border: 1px solid var(--line);
    display: block;
    height: 34px;
    object-fit: contain;
    width: 48px;
}

.primary-logo {
    background: #111827;
    height: 46px;
    width: 76px;
}

.org-mark {
    align-items: center;
    color: var(--muted);
    display: flex;
    font-size: 12px;
    font-weight: 700;
    gap: 8px;
    text-transform: uppercase;
}

.org-logo {
    height: 34px;
    width: 48px;
}

.user-strip {
    align-items: center;
    display: flex;
    gap: 14px;
}

.header-notification {
    align-items: center;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 999px;
    color: #9a3412;
    display: inline-flex;
    font-weight: 800;
    gap: 8px;
    min-height: 38px;
    padding: 7px 11px;
}

.header-notification:hover {
    background: #ffedd5;
    text-decoration: none;
}

.header-notification span {
    align-items: center;
    background: #c2410c;
    border-radius: 999px;
    color: #ffffff;
    display: inline-flex;
    font-size: 12px;
    justify-content: center;
    min-width: 22px;
    padding: 4px 7px;
}

.user-name {
    align-items: center;
    color: var(--ink);
    display: inline-flex;
    font-weight: 700;
    gap: 8px;
}

.nav {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.nav a,
.logout-form button {
    background: transparent;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    padding: 0;
}

.badge {
    align-items: center;
    background: #dcfce7;
    border-radius: 999px;
    color: #166534;
    display: inline-flex;
    font-size: 12px;
    font-weight: 800;
    justify-content: center;
    line-height: 1;
    margin-left: 4px;
    min-width: 22px;
    padding: 4px 7px;
}

.badge.neutral {
    background: #eef2ff;
    color: #3730a3;
    margin: 2px 4px 2px 0;
}

.logout-form {
    margin: 0;
}

.app-frame {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    min-height: calc(100vh - 76px);
    transition: grid-template-columns 0.2s ease;
}

.sidebar-collapsed .app-frame {
    grid-template-columns: 76px minmax(0, 1fr);
}

.sidebar {
    background: #ffffff;
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 18px;
    justify-content: space-between;
    padding: 18px 14px;
    position: sticky;
    top: 75px;
    height: calc(100vh - 75px);
    overflow: hidden;
    transition: width 0.2s ease, padding 0.2s ease;
}

.side-nav {
    display: grid;
    gap: 8px;
}

.side-nav a,
.side-logout-form button {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: var(--ink);
    cursor: pointer;
    display: flex;
    font: inherit;
    font-weight: 700;
    gap: 10px;
    min-height: 42px;
    padding: 10px 12px;
    text-align: left;
    width: 100%;
}

.sidebar-collapsed .side-nav a,
.sidebar-collapsed .side-logout-form button {
    justify-content: center;
    padding: 10px;
}

.sidebar-collapsed .side-nav span,
.sidebar-collapsed .side-logout-form span,
.sidebar-collapsed .sidebar-org span,
.sidebar-collapsed .sidebar-org img {
    display: none;
}

.sidebar-collapsed .side-nav i {
    width: auto;
}

.sidebar-collapsed .sidebar-org {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.sidebar-collapsed .sidebar-org::after {
    color: var(--teal-dark);
    content: "K";
    font-weight: 900;
}

.side-nav a:hover,
.side-logout-form button:hover {
    background: #f1f5f9;
    text-decoration: none;
}

.side-nav i {
    color: var(--teal-dark);
    width: 18px;
}

.side-logout-form {
    margin: 0;
}

.sidebar-org {
    align-items: center;
    border-top: 1px solid var(--line);
    color: var(--muted);
    display: flex;
    font-size: 12px;
    font-weight: 800;
    gap: 10px;
    padding: 14px 10px 0;
    text-transform: uppercase;
}

.shell {
    margin: 0;
    max-width: 1240px;
    padding: 28px clamp(16px, 4vw, 40px) 56px;
    width: 100%;
}

.page-heading {
    align-items: end;
    display: flex;
    gap: 16px;
    justify-content: space-between;
    margin-bottom: 24px;
}

.eyebrow {
    color: var(--coral);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    margin: 0 0 4px;
    text-transform: uppercase;
}

h1,
h2 {
    letter-spacing: 0;
    margin: 0;
}

h1 {
    font-size: clamp(28px, 4vw, 42px);
}

h2 {
    font-size: 18px;
}

.subheading {
    color: var(--teal-dark);
    font-size: 15px;
    margin: 18px 0 8px;
}

.subtle,
.panel-head span {
    color: var(--muted);
    margin: 6px 0 0;
}

.button,
button.button {
    align-items: center;
    background: white;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 700;
    justify-content: center;
    min-height: 40px;
    padding: 8px 14px;
}

.button.primary {
    background: var(--teal);
    border-color: var(--teal);
    color: white;
}

.button:hover,
button.button:hover {
    text-decoration: none;
}

.button-row,
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.metrics {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 22px;
}

.status-metrics {
    grid-template-columns: repeat(7, minmax(120px, 1fr));
}

.activity-panel {
    margin-bottom: 22px;
}

.activity-grid,
.activity-tabs {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.activity-tile,
.activity-tabs a {
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    padding: 14px;
}

.activity-tile strong,
.activity-tile span {
    display: block;
}

.activity-tile span {
    color: var(--muted);
    margin-top: 6px;
}

.activity-tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 16px;
}

.activity-tabs a {
    background: var(--surface);
    font-weight: 700;
    text-align: center;
}

.metric,
.panel,
.form-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.metric {
    padding: 18px;
}

.metric span {
    color: var(--muted);
    display: block;
    font-weight: 700;
}

.metric strong {
    display: block;
    font-size: 32px;
    margin-top: 8px;
}

.notification-panel {
    align-items: center;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    color: #9a3412;
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    padding: 14px 16px;
}

.notification-panel strong {
    background: #c2410c;
    border-radius: 999px;
    color: white;
    display: inline-flex;
    font-size: 18px;
    height: 38px;
    justify-content: center;
    align-items: center;
    min-width: 38px;
    padding: 0 10px;
}

.panel,
.form-panel {
    padding: 20px;
}

.panel-head {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 14px;
}

.detail-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
}

.summary-lines {
    display: grid;
    gap: 18px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    border-collapse: collapse;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    text-align: left;
    vertical-align: middle;
}

thead th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.compact th,
.compact td {
    padding: 8px;
}

.empty {
    color: var(--muted);
    padding: 28px 12px;
    text-align: center;
}

.form-panel {
    max-width: 960px;
}

.form-panel.wide {
    max-width: none;
}

.form-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field span {
    color: var(--muted);
    font-weight: 700;
}

input,
select,
textarea {
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    font: inherit;
    min-height: 40px;
    padding: 8px 10px;
    width: 100%;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--focus);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
    outline: none;
}

.form-section {
    border-top: 1px solid var(--line);
    margin-top: 20px;
    padding-top: 18px;
}

.form-section:first-child {
    border-top: 0;
    margin-top: 0;
    padding-top: 0;
}

.split {
    display: grid;
    gap: 32px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.check-list ul {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    list-style: none;
    margin: 12px 0 16px;
    padding: 0;
}

.check-list label {
    align-items: center;
    display: flex;
    gap: 8px;
}

.check-list input,
input[type="checkbox"] {
    min-height: auto;
    width: auto;
}

.check-inline {
    align-items: center;
    display: flex;
    font-weight: 700;
    gap: 8px;
    margin-top: 16px;
}

.field-check {
    align-items: center;
    background: #f8fafc;
    border: 1px solid var(--line);
    border-radius: 6px;
    flex-direction: row;
    min-height: 40px;
    padding: 8px 10px;
}

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

.detail-list span,
.detail-list strong {
    display: block;
}

.detail-list span {
    color: var(--muted);
    font-weight: 700;
}

.form-actions {
    border-top: 1px solid var(--line);
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 18px;
}

.sticky-actions {
    background: var(--surface);
    bottom: 0;
    position: sticky;
}

.data-entry input {
    min-width: 78px;
}

.data-entry input[type="text"] {
    min-width: 160px;
}

.messages {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.message {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 6px;
    color: #065f46;
    padding: 10px 12px;
}

.message.error {
    background: #fef3f2;
    border-color: #fecdca;
    color: #b42318;
}

.errorlist {
    color: #b42318;
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
}

.auth-page {
    background:
        radial-gradient(circle at 20% 20%, rgba(14, 165, 233, 0.26), transparent 32%),
        radial-gradient(circle at 80% 10%, rgba(20, 184, 166, 0.24), transparent 30%),
        linear-gradient(135deg, #061620 0%, #0c2532 42%, #111827 100%);
    overflow: hidden;
    min-height: 100vh;
    position: relative;
}

.auth-shell {
    align-items: center;
    display: flex;
    min-height: 100vh;
    padding: 24px;
    position: relative;
    z-index: 1;
}

.auth-card {
    backdrop-filter: blur(18px);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
    margin: 0 auto;
    max-width: 420px;
    padding: 28px;
    width: 100%;
}

.cyber-bg,
.cyber-bg::before,
.cyber-bg::after {
    inset: 0;
    position: fixed;
}

.cyber-bg {
    overflow: hidden;
    pointer-events: none;
}

.cyber-bg::before {
    animation: grid-drift 18s linear infinite;
    background-image:
        linear-gradient(rgba(45, 212, 191, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(45, 212, 191, 0.12) 1px, transparent 1px);
    background-size: 54px 54px;
    content: "";
    transform: perspective(600px) rotateX(62deg) scale(1.8);
    transform-origin: center bottom;
}

.cyber-bg::after {
    animation: scan-shift 8s ease-in-out infinite alternate;
    background:
        linear-gradient(90deg, transparent, rgba(125, 211, 252, 0.2), transparent),
        radial-gradient(circle at 50% 50%, rgba(34, 211, 238, 0.14), transparent 45%);
    content: "";
}

.cyber-bg span {
    animation: float-node 9s ease-in-out infinite;
    background: rgba(94, 234, 212, 0.72);
    border-radius: 999px;
    box-shadow: 0 0 32px rgba(94, 234, 212, 0.7);
    height: 7px;
    position: absolute;
    width: 7px;
}

.cyber-bg span:nth-child(1) {
    left: 12%;
    top: 24%;
}

.cyber-bg span:nth-child(2) {
    animation-delay: -3s;
    left: 72%;
    top: 18%;
}

.cyber-bg span:nth-child(3) {
    animation-delay: -6s;
    left: 58%;
    top: 72%;
}

@keyframes grid-drift {
    from {
        background-position: 0 0, 0 0;
    }
    to {
        background-position: 54px 54px, 54px 54px;
    }
}

@keyframes scan-shift {
    from {
        opacity: 0.55;
        transform: translateX(-6%);
    }
    to {
        opacity: 0.95;
        transform: translateX(6%);
    }
}

@keyframes float-node {
    0%,
    100% {
        transform: translate3d(0, 0, 0) scale(1);
    }
    50% {
        transform: translate3d(36px, -28px, 0) scale(1.8);
    }
}

.auth-logo {
    border: 1px solid var(--line);
    border-radius: 8px;
    display: block;
    height: 72px;
    margin-bottom: 18px;
    object-fit: contain;
    width: 96px;
}

.auth-logo-row {
    align-items: center;
    display: grid;
    gap: 14px;
    grid-template-columns: 1fr 1fr;
    margin-bottom: 18px;
}

.primary-auth-logo {
    background: #111827;
    height: 92px;
    margin-bottom: 0;
    width: 100%;
}

.org-auth-logo {
    height: 64px;
    margin-bottom: 0;
    width: 100%;
}

.login-form {
    display: grid;
    gap: 14px;
    margin-top: 22px;
}

.auth-button {
    width: 100%;
}

.auth-note {
    color: var(--muted);
    margin: 18px 0 0;
}

footer {
    background-color: #62b6ee;
    margin-left: 250px;
    text-align: center;
    padding: 10px;
    transition: margin-left 0.2s ease;
}

.sidebar-collapsed footer {
    margin-left: 76px;
}

.wide-auth {
    max-width: 560px;
}

@media (max-width: 900px) {
    .page-heading,
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .app-frame {
        grid-template-columns: 1fr;
    }

    .sidebar-collapsed .app-frame {
        grid-template-columns: 1fr;
    }

    .sidebar {
        height: auto;
        position: static;
    }

    .sidebar-collapsed .sidebar {
        padding: 12px;
    }

    .side-nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sidebar-collapsed .side-nav {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    footer {
        margin-left: 0;
    }

    .sidebar-collapsed footer {
        margin-left: 0;
    }

    .metrics,
    .status-metrics,
    .activity-grid,
    .activity-tabs,
    .detail-list,
    .detail-grid,
    .split,
    .form-grid,
    .form-grid.three {
        grid-template-columns: 1fr;
    }
}
