:root {
    --brand: #8b5cf6;
    --brand-2: #22d3ee;
    --bg: #070b18;
    --surface: #111827;
    --surface-2: #0b1020;
    --text: #f8fafc;
    --muted: #94a3b8;
    --line: rgba(148, 163, 184, .18);
    --danger: #fb7185;
}

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

a {
    color: var(--brand-2);
}

.form-control,
.form-select {
    border-color: var(--line);
    background-color: rgba(15, 23, 42, .84);
    color: var(--text);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand);
    background-color: rgba(15, 23, 42, .94);
    color: var(--text);
    box-shadow: 0 0 0 .2rem rgba(139, 92, 246, .20);
}

.form-control::placeholder {
    color: var(--muted);
}

.app-shell {
    min-height: 100vh;
    background:
        radial-gradient(circle at 12% 8%, rgba(139, 92, 246, .20), transparent 34%),
        radial-gradient(circle at 82% 18%, rgba(34, 211, 238, .13), transparent 32%),
        linear-gradient(135deg, #070b18 0%, #0b1020 50%, #111827 100%);
}

.app-sidebar {
    border-right: 1px solid var(--line);
    background:
        radial-gradient(circle at 20% 0%, rgba(139, 92, 246, .24), transparent 34%),
        linear-gradient(180deg, rgba(15, 23, 42, .98) 0%, rgba(2, 6, 23, .98) 100%);
    padding: 24px;
}

.brand {
    margin-bottom: 16px;
}

.brand-mark {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: white;
    font-weight: 800;
    box-shadow: 0 14px 34px rgba(139, 92, 246, .35);
}

.app-nav .mud-nav-link {
    border-radius: 14px;
    margin-bottom: 6px;
}

.app-nav .mud-nav-link.active:not(.mud-nav-link-disabled) {
    background: rgba(139, 92, 246, .18);
    color: #fff;
}

.app-main {
    min-height: 100vh;
}

.topbar {
    border-bottom: 1px solid var(--line);
    background: rgba(15, 23, 42, .78) !important;
    backdrop-filter: blur(14px);
}

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

.content-area {
    padding: 32px;
}

.hero-card {
    min-height: 330px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 30px;
    padding: 48px;
    display: flex;
    align-items: center;
    color: white;
    background:
        radial-gradient(circle at 20% 20%, rgba(34, 211, 238, .34) 0, transparent 34%),
        radial-gradient(circle at 90% 5%, rgba(139, 92, 246, .55) 0, transparent 30%),
        linear-gradient(135deg, #111827 0%, #312e81 48%, #0f172a 100%);
    box-shadow: 0 26px 80px rgba(0, 0, 0, .34);
}

.eyebrow {
    color: var(--brand-2);
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.hero-card .eyebrow {
    color: rgba(255, 255, 255, .78);
}

.hero-card h1 {
    max-width: 760px;
    font-size: 3rem;
    font-weight: 800;
}

.hero-card .lead {
    max-width: 680px;
    color: rgba(255, 255, 255, .82);
}

.metric-card,
.empty-state,
.form-card,
.work-card,
.management-modal,
.confirm-modal,
.mobile-record-card {
    border: 1px solid var(--line);
    background: rgba(17, 24, 39, .86);
    box-shadow: 0 22px 60px rgba(0, 0, 0, .28);
}

.metric-card,
.empty-state,
.form-card,
.work-card {
    border-radius: 24px;
    padding: 28px;
}

.metric-card span,
.text-muted {
    color: var(--muted) !important;
}

.metric-card strong {
    font-size: 1.4rem;
}

.responsive-card-view {
    display: none;
}

.mobile-card-list {
    display: grid;
    gap: 12px;
}

.mobile-record-card {
    min-width: 0;
    width: 100%;
    padding: 18px;
    border-radius: 18px;
}

.mobile-record-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.mobile-record-card__header > div {
    min-width: 0;
}

.mobile-record-card__header strong,
.mobile-record-card__header span,
.mobile-record-card__details dd,
.detail-list strong {
    overflow-wrap: anywhere;
}

.mobile-record-card__header span {
    color: var(--muted);
    font-size: .88rem;
}

.mobile-record-card__details {
    display: grid;
    gap: 10px;
    margin: 0;
}

.mobile-record-card__details > div,
.detail-list > div {
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.mobile-record-card__details dt,
.detail-list span,
.modal-summary-grid span {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.mobile-record-card__details dd {
    margin: 2px 0 0;
}

.mobile-record-card__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.modal-backdrop-shell {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(2, 6, 23, .72);
    backdrop-filter: blur(10px);
}

.management-modal,
.confirm-modal {
    width: min(760px, 100%);
    max-height: min(820px, calc(100vh - 48px));
    overflow: auto;
    border-radius: 22px;
    padding: 24px;
}

.confirm-modal {
    width: min(520px, 100%);
}

.modal-header-clean {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.modal-header-clean h2,
.work-card h2 {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 800;
}

.modal-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.modal-summary-grid > div {
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    background: rgba(15, 23, 42, .76);
}

.modal-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px;
    margin-bottom: 18px;
    border-radius: 16px;
    background: rgba(15, 23, 42, .82);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.danger-panel {
    border: 1px solid rgba(251, 113, 133, .32);
    border-radius: 16px;
    padding: 18px;
    background: rgba(127, 29, 29, .22);
}

.danger-panel h3 {
    font-size: 1.1rem;
    font-weight: 800;
}

.form-hint {
    margin-top: 8px;
    color: var(--muted);
    font-size: .9rem;
}

.validation-box,
.api-error-box {
    margin: 0 0 16px;
    border-radius: 14px;
    padding: 12px 14px;
    font-size: .92rem;
}

.validation-box,
.api-error-box {
    border: 1px solid rgba(251, 113, 133, .34);
    background: rgba(127, 29, 29, .25);
    color: #fecdd3;
}

.validation-message {
    display: block;
    margin-top: 6px;
    color: #fecdd3;
    font-size: .85rem;
}

.detail-list {
    display: grid;
    gap: 12px;
}

.detail-list > div {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.detail-list span,
.detail-list strong {
    min-width: 0;
}

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

.profile-grid-wide {
    grid-column: 1 / -1;
}

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

.page-heading-copy {
    min-width: 0;
    flex: 1 1 auto;
}

.page-title,
.page-description {
    overflow-wrap: anywhere;
}

.page-heading-action {
    flex: 0 0 auto;
}

.skeleton-card {
    min-height: 280px;
    border-radius: 24px;
    background: linear-gradient(90deg, #111827, #1e293b, #111827);
    animation: pulse 1.3s infinite;
}

@keyframes pulse {
    0% {
        opacity: .55;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: .55;
    }
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px;
    background:
        radial-gradient(circle at 18% 18%, rgba(34, 211, 238, .18), transparent 30%),
        radial-gradient(circle at 82% 10%, rgba(139, 92, 246, .24), transparent 34%),
        linear-gradient(135deg, #070b18 0%, #111827 48%, #020617 100%);
}

.login-panel {
    width: min(1040px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr);
    gap: 28px;
    align-items: stretch;
}

.login-story {
    color: white;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 30px;
    padding: 44px;
    background:
        radial-gradient(circle at 12% 15%, rgba(34, 211, 238, .25), transparent 35%),
        linear-gradient(135deg, #111827 0%, #312e81 54%, #0f172a 100%);
    box-shadow: 0 22px 60px rgba(0, 0, 0, .35);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-story .eyebrow {
    color: rgba(255, 255, 255, .72);
}

.login-story h1 {
    max-width: 560px;
    font-size: 2.65rem;
    font-weight: 800;
}

.login-story .lead {
    max-width: 620px;
    color: rgba(255, 255, 255, .80);
}

.login-highlights {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 26px;
}

.login-highlights span {
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 999px;
    color: rgba(255, 255, 255, .86);
    padding: 8px 12px;
    font-size: .9rem;
}

.login-card {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 30px;
    padding: 40px;
    background: rgba(17, 24, 39, .92);
    box-shadow: 0 22px 60px rgba(0, 0, 0, .35);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.login-brand small {
    display: block;
    color: var(--muted);
}

.login-brand-form {
    margin-bottom: 24px;
}

.login-card h2 {
    font-size: 2rem;
    font-weight: 800;
}

.sidebar-auth {
    border: 1px solid var(--line);
    border-radius: 18px;
    margin-top: auto;
    padding: 16px;
    background: rgba(15, 23, 42, .72) !important;
}

@media (max-width: 960px) {
    .app-sidebar {
        width: 240px !important;
    }

    .content-area {
        padding: 20px;
    }

    .hero-card h1 {
        font-size: 2.2rem;
    }

    .modal-summary-grid,
    .profile-grid {
        grid-template-columns: 1fr;
    }

    .profile-grid-wide {
        grid-column: auto;
    }

    .detail-list > div {
        display: block;
    }

    .login-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .mud-drawer.app-sidebar,
    .app-sidebar {
        display: none !important;
    }

    .mud-main-content.app-main,
    .app-main {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .topbar {
        position: sticky;
        top: 0;
        min-height: 52px;
        padding-inline: 16px !important;
    }

    .topbar .mud-typography-subtitle1 {
        font-size: .98rem;
        line-height: 1.1;
    }

    .topbar .mud-typography-caption {
        display: block;
        max-width: 160px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-brand-mark {
        display: inline-flex;
        background: linear-gradient(135deg, var(--brand), var(--brand-2));
        color: white;
        font-weight: 800;
        width: 28px !important;
        height: 28px !important;
        font-size: .8rem !important;
    }

    .mobile-nav-strip {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding: 8px 14px;
        border-bottom: 1px solid var(--line);
        background: rgba(7, 11, 24, .94);
        scrollbar-width: none;
    }

    .mobile-nav-strip::-webkit-scrollbar {
        display: none;
    }

    .mobile-nav-strip .mud-button {
        flex: 0 0 auto;
        min-width: max-content;
    }

    .mobile-logout-form {
        flex: 0 0 auto;
        margin: 0;
    }

    .content-area {
        padding: 18px 14px 28px;
    }

    .responsive-table-view {
        display: none;
    }

    .responsive-card-view {
        display: block;
    }

    .page-heading {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
        margin-bottom: 18px;
    }

    .page-heading .mud-typography-h3,
    .page-title {
        font-size: clamp(2rem, 11vw, 2.8rem);
        line-height: 1;
    }

    .page-description {
        font-size: 1rem;
    }

    .page-heading-action {
        align-self: flex-start;
        width: auto;
        max-width: 100%;
        white-space: normal;
    }

    .page-heading-action .mud-button-label {
        white-space: normal;
        text-align: left;
    }

    .mobile-card-list {
        width: 100%;
    }

    .mobile-record-card .mud-stack-row {
        flex-wrap: wrap;
    }

    .mobile-record-card .mud-button {
        min-width: 0;
        padding-inline: 10px;
    }

    .work-card,
    .form-card,
    .empty-state,
    .metric-card {
        padding: 22px;
        border-radius: 22px;
    }

    .detail-list > div {
        display: grid;
        gap: 4px;
    }

    .detail-list strong {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .login-page {
        padding: 20px;
    }

    .login-story {
        padding: 32px;
    }

    .login-story h1 {
        font-size: 2rem;
    }

    .login-card {
        padding: 28px;
    }
}
