:root {
    --casis-cyan: #08ace4;
    --casis-cyan-dark: #058fc1;
    --casis-blue: #005471;
    --casis-blue-deep: #062f41;
    --casis-ink: #12313f;
    --casis-muted: #657983;
    --casis-border: #dce6ea;
    --casis-bg: #f4f8fa;
    --white: #ffffff;
    --danger-bg: #fff2f2;
    --danger-border: #f2caca;
    --danger-text: #9c3030;
    --warning-bg: #fff8e6;
    --warning-text: #8a5a00;
    --success-bg: #eaf8f1;
    --success-text: #176b48;
    --shadow: 0 18px 50px rgba(22, 59, 74, .09);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: var(--casis-ink);
    background: var(--casis-bg);
}

button,
input {
    font: inherit;
}

a {
    color: inherit;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(430px, 1.05fr) minmax(440px, .95fr);
}

.brand-panel {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 64px;
    background:
        radial-gradient(circle at 18% 18%, rgba(8, 172, 228, .22), transparent 34%),
        linear-gradient(145deg, #062f41 0%, #005471 55%, #006f95 100%);
}

.brand-panel::before,
.brand-panel::after {
    content: "";
    position: absolute;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 999px;
}

.brand-panel::before {
    width: 520px;
    height: 520px;
    right: -210px;
    top: -180px;
}

.brand-panel::after {
    width: 360px;
    height: 360px;
    left: -180px;
    bottom: -120px;
}

.brand-content {
    position: relative;
    z-index: 1;
    width: min(620px, 100%);
    color: rgba(255, 255, 255, .82);
}

.brand-logo {
    width: min(560px, 100%);
    height: auto;
    display: block;
    filter: brightness(0) invert(1);
    opacity: .98;
}

.brand-content p {
    margin: 30px 0 0;
    font-size: 18px;
    letter-spacing: .02em;
    color: rgba(255, 255, 255, .9);
}

.brand-accent {
    width: 58px;
    height: 4px;
    margin: 30px 0 20px;
    border-radius: 99px;
    background: var(--casis-cyan);
}

.brand-content span {
    display: block;
    max-width: 440px;
    font-size: 14px;
    line-height: 1.7;
}

.login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 52px;
    background: var(--white);
}

.login-card {
    width: min(410px, 100%);
}

.mobile-logo {
    display: none;
}

.heading {
    margin-bottom: 34px;
}

.eyebrow,
.topbar-eyebrow {
    display: inline-block;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: var(--casis-cyan-dark);
}

.heading .eyebrow {
    margin-bottom: 10px;
}

.heading h1 {
    margin: 0;
    font-size: 38px;
    line-height: 1.1;
    letter-spacing: -.025em;
    color: var(--casis-blue);
}

.heading p {
    margin: 12px 0 0;
    color: var(--casis-muted);
    font-size: 15px;
}

.login-card label {
    display: block;
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 700;
    color: #294a58;
}

.login-input {
    width: 100%;
    height: 50px;
    border: 1px solid var(--casis-border);
    border-radius: 10px;
    padding: 0 14px;
    outline: none;
    color: var(--casis-ink);
    background: #fff;
    transition: border-color .18s ease, box-shadow .18s ease;
}

#username.login-input {
    margin-bottom: 22px;
}

.login-input:focus {
    border-color: var(--casis-cyan);
    box-shadow: 0 0 0 4px rgba(8, 172, 228, .11);
}

.password-wrap {
    position: relative;
    margin-bottom: 28px;
}

.password-wrap input {
    padding-right: 48px;
}

.show-password {
    position: absolute;
    top: 50%;
    right: 8px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    padding: 0;
    transform: translateY(-50%);
    background: transparent;
    cursor: pointer;
}

.show-password:hover {
    background: #eef6f8;
}

.show-password svg {
    width: 19px;
    height: 19px;
    fill: #6f838c;
}

.submit-button {
    width: 100%;
    height: 50px;
    border: 0;
    border-radius: 10px;
    font-weight: 800;
    color: #fff;
    background: var(--casis-blue);
    cursor: pointer;
    transition: transform .1s ease, background .18s ease, box-shadow .18s ease;
    box-shadow: 0 10px 24px rgba(0, 84, 113, .16);
}

.submit-button:hover {
    background: #00698d;
}

.submit-button:active {
    transform: translateY(1px);
}

.alert {
    margin: -8px 0 24px;
    padding: 12px 14px;
    border: 1px solid var(--danger-border);
    border-radius: 9px;
    color: var(--danger-text);
    background: var(--danger-bg);
    font-size: 13px;
    line-height: 1.45;
}

.footer-note {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid #edf2f4;
    font-size: 11px;
    color: #8a9aa1;
}

.footer-note span:first-child {
    font-weight: 800;
    color: var(--casis-blue);
}

.admin-page {
    min-height: 100vh;
    background: #f5f8fa;
}

.admin-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 24px 18px 18px;
    color: #fff;
    background:
        radial-gradient(circle at 15% 5%, rgba(8, 172, 228, .2), transparent 27%),
        linear-gradient(180deg, #07384c 0%, #005471 72%, #064157 100%);
    box-shadow: 10px 0 35px rgba(3, 45, 61, .08);
    z-index: 30;
}

.sidebar-brand {
    padding: 8px 10px 26px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.sidebar-brand img {
    width: 185px;
    max-width: 100%;
    display: block;
    filter: brightness(0) invert(1);
}

.sidebar-brand span {
    display: block;
    margin-top: 12px;
    color: rgba(255, 255, 255, .6);
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.sidebar-nav {
    display: grid;
    gap: 6px;
    margin-top: 22px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 10px 12px;
    border-radius: 11px;
    color: rgba(255, 255, 255, .75);
    text-decoration: none;
    font-size: 13px;
    font-weight: 650;
    transition: background .16s ease, color .16s ease, transform .16s ease;
}

.nav-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, .09);
}

.nav-item.active {
    color: #fff;
    background: rgba(8, 172, 228, .22);
    box-shadow: inset 3px 0 0 var(--casis-cyan);
}

.nav-icon,
.module-card-icon,
.module-arrow,
.logout-button svg,
.menu-toggle svg,
.row-action svg {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
}

.nav-icon svg {
    width: 21px;
    height: 21px;
    fill: currentColor;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-top: auto;
    padding: 16px 10px 4px;
    border-top: 1px solid rgba(255, 255, 255, .12);
}

.user-avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-weight: 800;
}

.user-meta {
    min-width: 0;
}

.user-meta strong,
.user-meta span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-meta strong {
    font-size: 13px;
}

.user-meta span {
    margin-top: 3px;
    color: rgba(255, 255, 255, .55);
    font-size: 11px;
    text-transform: uppercase;
}

.admin-main {
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 74px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 34px;
    border-bottom: 1px solid rgba(220, 230, 234, .86);
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(12px);
}

.topbar > div {
    display: grid;
    gap: 3px;
}

.topbar strong {
    font-size: 13px;
    color: #31515e;
}

.topbar form {
    margin-left: auto;
}

.logout-button,
.menu-toggle {
    border: 0;
    background: transparent;
    cursor: pointer;
}

.logout-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 12px;
    border-radius: 9px;
    color: #526c77;
    font-size: 12px;
    font-weight: 700;
}

.logout-button:hover {
    color: var(--casis-blue);
    background: #eef6f8;
}

.logout-button svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: 9px;
    color: var(--casis-blue);
}

.menu-toggle svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.content {
    width: min(1480px, 100%);
    margin: 0 auto;
    padding: 38px 38px 60px;
}

.page-heading {
    margin-bottom: 28px;
}

.page-heading-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
}

.page-heading .eyebrow {
    margin-bottom: 8px;
}

.page-heading h1 {
    margin: 0;
    color: var(--casis-blue);
    font-size: clamp(28px, 3vw, 40px);
    line-height: 1.08;
    letter-spacing: -.025em;
}

.page-heading p {
    margin: 10px 0 0;
    color: var(--casis-muted);
    font-size: 14px;
    line-height: 1.6;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.module-card {
    min-height: 150px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 16px;
    padding: 24px;
    border: 1px solid var(--casis-border);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(22, 59, 74, .04);
    text-decoration: none;
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.module-card:hover {
    transform: translateY(-2px);
    border-color: #b7dbe7;
    box-shadow: var(--shadow);
}

.module-card-icon {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    color: var(--casis-blue);
    background: #eaf7fb;
}

.module-card-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.module-card-copy strong,
.module-card-copy span {
    display: block;
}

.module-card-copy strong {
    margin-top: 2px;
    color: #143d4e;
    font-size: 15px;
}

.module-card-copy span {
    margin-top: 8px;
    color: var(--casis-muted);
    font-size: 12px;
    line-height: 1.55;
}

.module-arrow {
    margin-top: 10px;
    color: #88a2ad;
}

.module-arrow svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: min(430px, 100%);
}

.search-form input {
    min-width: 0;
    flex: 1;
    height: 42px;
    border: 1px solid var(--casis-border);
    border-radius: 10px;
    padding: 0 13px;
    outline: none;
    background: #fff;
    color: var(--casis-ink);
}

.search-form input:focus {
    border-color: var(--casis-cyan);
    box-shadow: 0 0 0 4px rgba(8, 172, 228, .1);
}

.search-form button,
.secondary-button {
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    border: 0;
    border-radius: 10px;
    background: var(--casis-blue);
    color: #fff;
    text-decoration: none;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
}

.secondary-button {
    background: #edf5f7;
    color: var(--casis-blue);
}

.table-wrap,
.detail-card {
    overflow: hidden;
    border: 1px solid var(--casis-border);
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 8px 26px rgba(22, 59, 74, .04);
}

.detail-card {
    margin-bottom: 20px;
    padding: 24px;
}

.detail-card-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #edf2f4;
}

.detail-card-heading .eyebrow {
    margin-bottom: 6px;
}

.detail-card-heading h2 {
    margin: 0;
    color: #153f50;
    font-size: 24px;
}

.detail-card-heading p {
    margin: 6px 0 0;
    color: var(--casis-muted);
    font-size: 13px;
}

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

.data-table th,
.data-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #edf2f4;
    text-align: left;
    vertical-align: middle;
    font-size: 12px;
}

.data-table th {
    background: #f8fbfc;
    color: #71868f;
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.data-table tbody tr:hover {
    background: #fbfdfe;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.muted-cell {
    color: #8a9da5;
}

.action-column {
    width: 1%;
    white-space: nowrap;
}

.row-action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--casis-blue);
    text-decoration: none;
    font-weight: 750;
}

.row-action:hover {
    color: var(--casis-cyan-dark);
}

.row-action svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
}

.status-ok {
    color: var(--success-text);
    background: var(--success-bg);
}

.status-muted {
    color: #74878f;
    background: #f0f4f5;
}

.status-warning {
    color: var(--warning-text);
    background: var(--warning-bg);
}

.table-name {
    display: block;
    margin-top: 5px;
    color: #8a9da5;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 10px;
}

.empty-state {
    display: grid;
    gap: 6px;
    justify-items: center;
    padding: 58px 24px;
    border: 1px dashed #cbd9de;
    border-radius: 14px;
    background: #fbfdfe;
    text-align: center;
}

.empty-state strong {
    color: #335662;
}

.empty-state span {
    color: var(--casis-muted);
    font-size: 12px;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 24px 0 12px;
}

.section-title-row h3 {
    margin: 0;
    color: #244c5c;
    font-size: 15px;
}

.section-title-row span {
    color: #81949c;
    font-size: 11px;
}

.question-list {
    display: grid;
    gap: 8px;
}

.question-row {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
    padding: 13px 14px;
    border: 1px solid #e8eff2;
    border-radius: 11px;
    background: #fff;
}

.question-disabled {
    opacity: .55;
}

.question-position {
    display: grid;
    place-items: center;
    height: 34px;
    border-radius: 9px;
    background: #edf7fa;
    color: var(--casis-blue);
    font-size: 11px;
    font-weight: 800;
}

.question-title-line {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.question-title-line strong {
    color: #183f4f;
    font-size: 13px;
}

.question-type {
    padding: 3px 7px;
    border-radius: 999px;
    background: #f0f4f5;
    color: #6d818a;
    font-size: 9px;
    font-weight: 750;
    text-transform: uppercase;
}

.question-copy p {
    margin: 5px 0 0;
    color: var(--casis-muted);
    font-size: 11px;
    line-height: 1.5;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.info-tile {
    padding: 16px;
    border: 1px solid #e5edef;
    border-radius: 12px;
    background: #fbfdfe;
}

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

.info-tile span {
    color: #84979f;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.info-tile strong {
    margin-top: 6px;
    color: #234c5c;
    font-size: 14px;
}

.migration-note {
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px solid #d7e9ef;
    border-radius: 11px;
    background: #f2f9fb;
    color: #456974;
    font-size: 12px;
    line-height: 1.6;
}

.migration-note code {
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: 11px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sidebar-overlay {
    display: none;
}

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

@media (max-width: 900px) {
    .login-shell {
        grid-template-columns: 1fr;
    }

    .brand-panel {
        display: none;
    }

    .login-panel {
        min-height: 100vh;
        padding: 28px;
    }

    .mobile-logo {
        display: block;
        margin-bottom: 40px;
    }

    .mobile-logo img {
        width: 250px;
        max-width: 78%;
        height: auto;
    }

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

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 280px;
        transform: translateX(-105%);
        transition: transform .2s ease;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        display: block;
        background: rgba(3, 28, 38, .45);
        opacity: 0;
        visibility: hidden;
        transition: opacity .2s ease, visibility .2s ease;
        z-index: 25;
    }

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

    .sidebar-open .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }

    .menu-toggle {
        display: grid;
        place-items: center;
    }

    .topbar {
        padding-inline: 20px;
    }

    .content {
        padding: 28px 20px 48px;
    }

    .page-heading-row {
        align-items: stretch;
        flex-direction: column;
    }

    .search-form {
        min-width: 0;
        width: 100%;
    }
}

@media (max-width: 680px) {
    .module-grid {
        grid-template-columns: 1fr;
    }

    .module-card {
        min-height: 126px;
    }

    .topbar strong,
    .topbar-eyebrow,
    .logout-button span {
        display: none;
    }

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

    .data-table {
        min-width: 700px;
    }

    .detail-card-heading {
        flex-direction: column;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .login-panel {
        align-items: flex-start;
        padding-top: 48px;
    }

    .heading h1 {
        font-size: 32px;
    }

    .footer-note {
        display: block;
    }

    .footer-note span {
        display: block;
    }

    .footer-note span + span {
        margin-top: 5px;
    }

    .search-form {
        display: grid;
        grid-template-columns: 1fr auto;
    }
}
