:root {
    color-scheme: light;
    --page: #f8f7f2;
    --surface: #ffffff;
    --surface-soft: #f2f3eb;
    --ink: #222d25;
    --muted: #758077;
    --green: #315d46;
    --green-dark: #244735;
    --green-light: #e7efe8;
    --border: #e5e8df;
    --danger: #a83f3f;
    --danger-bg: #fff0ef;
    --success: #286344;
    --success-bg: #eaf5ed;
    --warning: #85641b;
    --warning-bg: #fff6dd;
    --radius-lg: 24px;
    --radius-md: 14px;
    --radius-sm: 9px;
    --shadow: 0 18px 60px rgba(35, 52, 39, 0.07);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    min-width: 320px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

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

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

.topbar {
    width: 100%;
    min-height: 82px;
    padding: 18px clamp(20px, 5vw, 76px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid rgba(49, 93, 70, 0.09);
}

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

.brand-mark {
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--green);
    color: #fff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 27px;
    font-weight: 700;
}

.brand-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.brand-copy strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 21px;
    letter-spacing: -0.5px;
}

.brand-copy small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 1.8px;
}

.topbar-label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.main-content {
    width: min(1240px, calc(100% - 48px));
    margin: 0 auto;
    padding: 56px 0 36px;
}

.auth-layout {
    min-height: 620px;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.8fr);
    align-items: center;
    gap: clamp(36px, 7vw, 100px);
}

.auth-intro {
    padding: 20px 0;
}

.eyebrow {
    display: inline-block;
    color: var(--green);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 2px;
}

.auth-intro h1 {
    margin: 18px 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(42px, 5.3vw, 69px);
    font-weight: 500;
    letter-spacing: -2.7px;
    line-height: 1.08;
}

.auth-intro h1 span {
    color: var(--green);
}

.auth-intro > p {
    max-width: 490px;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.9;
}

.feature-list {
    display: grid;
    gap: 17px;
    margin-top: 38px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 13px;
    color: #465349;
    font-size: 14px;
}

.feature-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: grid;
    place-items: center;
    border: 1px solid #dce5db;
    border-radius: 11px;
    background: #fff;
    color: var(--green);
    font-size: 11px;
    font-weight: 800;
}

.auth-card {
    width: 100%;
    padding: clamp(25px, 3.5vw, 42px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.card-heading {
    margin-bottom: 29px;
}

.card-heading h1,
.card-heading h2 {
    margin: 8px 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 34px;
    font-weight: 500;
    letter-spacing: -1px;
    line-height: 1.25;
}

.card-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
}

.form-field {
    display: grid;
    gap: 8px;
    margin-bottom: 19px;
}

.form-field label {
    font-size: 13px;
    font-weight: 700;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid #dfe4db;
    border-radius: var(--radius-sm);
    outline: none;
    background: #fff;
    color: var(--ink);
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.form-field textarea {
    min-height: 100px;
    resize: vertical;
}

.form-field input::placeholder,
.form-field textarea::placeholder {
    color: #a1aaa2;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(49, 93, 70, 0.11);
}

.field-hint {
    color: var(--muted);
    font-size: 12px;
}

.button {
    min-height: 43px;
    padding: 10px 17px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.button:focus-visible,
.nav-button:focus-visible {
    outline: 3px solid rgba(49, 93, 70, 0.25);
    outline-offset: 2px;
}

.button-primary {
    background: var(--green);
    color: #fff;
}

.button-primary:hover:not(:disabled) {
    background: var(--green-dark);
    transform: translateY(-1px);
}

.button-outline {
    border-color: var(--border);
    background: #fff;
    color: var(--ink);
}

.button-outline:hover:not(:disabled) {
    border-color: #b9c8bb;
    background: var(--surface-soft);
}

.button-ghost {
    background: transparent;
    color: var(--muted);
}

.button-ghost:hover:not(:disabled) {
    background: var(--surface-soft);
    color: var(--ink);
}

.button-full {
    width: 100%;
    min-height: 49px;
    margin-top: 5px;
}

.security-note {
    margin: 22px 0 0;
    color: #899188;
    font-size: 11px;
    line-height: 1.7;
    text-align: center;
}

.message {
    margin: 15px 0;
    padding: 12px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.message.error {
    border-color: #f0cfcc;
    background: var(--danger-bg);
    color: var(--danger);
}

.message.success {
    border-color: #d0e7d5;
    background: var(--success-bg);
    color: var(--success);
}

.message.warning {
    border-color: #efdfad;
    background: var(--warning-bg);
    color: var(--warning);
}

.single-column {
    min-height: 600px;
    grid-template-columns: minmax(0, 500px);
    justify-content: center;
}

.password-card {
    align-self: center;
}

.password-card .button-ghost {
    margin-top: 8px;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 32px;
}

.dashboard-header h1 {
    margin: 6px 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(32px, 4vw, 45px);
    font-weight: 500;
    letter-spacing: -1.4px;
}

.dashboard-header p {
    margin: 0;
    color: var(--muted);
}

.profile-area {
    display: flex;
    align-items: center;
    gap: 20px;
}

.profile-details {
    display: grid;
    gap: 4px;
    text-align: right;
}

.profile-details strong {
    font-size: 14px;
}

.role-badge {
    width: fit-content;
    justify-self: end;
    padding: 3px 9px;
    border-radius: 20px;
    background: var(--green-light);
    color: var(--green);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

.dashboard-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 26px;
    padding: 8px;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.nav-button {
    min-height: 40px;
    padding: 9px 16px;
    flex: 0 0 auto;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.nav-button:hover {
    background: var(--surface-soft);
    color: var(--ink);
}

.nav-button.active {
    background: var(--green);
    color: #fff;
}

.dashboard-message {
    margin-bottom: 20px;
}

.dashboard-content {
    min-height: 300px;
}

.dashboard-footer {
    margin-top: 46px;
    padding-top: 20px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    border-top: 1px solid var(--border);
    color: #899188;
    font-size: 12px;
}

.loading-state {
    min-height: 260px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--muted);
}

.loading-state p {
    margin: 0;
    font-size: 13px;
}

.loading-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #dce5db;
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 750ms linear infinite;
}

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

/* Dashboard components */

.section-heading {
    margin-bottom: 22px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.section-heading h2 {
    margin: 0 0 5px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 27px;
    font-weight: 500;
    letter-spacing: -0.5px;
}

.section-heading p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

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

.stat-card {
    min-height: 135px;
    padding: 21px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
}

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

.stat-value {
    display: block;
    margin-top: 12px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 35px;
    line-height: 1.2;
}

.panel {
    margin-bottom: 22px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.panel h3 {
    margin: 0 0 18px;
    font-size: 16px;
    font-weight: 750;
}

.panel-description {
    margin: -10px 0 20px;
    color: var(--muted);
    font-size: 13px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

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

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

.data-table th {
    background: #fafbf8;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    white-space: nowrap;
}

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

.data-table td {
    overflow-wrap: anywhere;
}

.data-table .actions-cell {
    white-space: nowrap;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 20px;
    background: var(--surface-soft);
    color: #59655b;
    font-size: 11px;
    font-weight: 750;
    white-space: nowrap;
}

.status-badge.active,
.status-badge.completed,
.status-badge.paid {
    background: var(--success-bg);
    color: var(--success);
}

.status-badge.inactive,
.status-badge.blocked,
.status-badge.failed {
    background: var(--danger-bg);
    color: var(--danger);
}

.status-badge.pending,
.status-badge.unassigned {
    background: var(--warning-bg);
    color: var(--warning);
}

.inline-form {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 14px;
}

.inline-form .form-field {
    min-width: 180px;
    flex: 1;
    margin-bottom: 0;
}

.inline-form .form-field label {
    font-size: 12px;
}

.inline-form .button {
    min-height: 48px;
}

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

.form-grid .form-field {
    min-width: 0;
}

.form-grid .full-width {
    grid-column: 1 / -1;
}

.filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.filter-bar input,
.filter-bar select {
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--ink);
}

.filter-bar input {
    min-width: 220px;
    flex: 1;
}

.empty-state {
    padding: 48px 20px;
    border: 1px dashed #dce3d8;
    border-radius: var(--radius-md);
    background: #fcfcf9;
    text-align: center;
}

.empty-state h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.empty-state p {
    max-width: 420px;
    margin: 0 auto;
    color: var(--muted);
    font-size: 13px;
}

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

.detail-item {
    padding: 16px 12px;
    border-bottom: 1px solid #edf0e9;
}

.detail-item span {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.detail-item strong {
    font-size: 14px;
    overflow-wrap: anywhere;
}

.notice {
    padding: 15px 17px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    color: #526054;
    font-size: 13px;
}

.notice + .notice {
    margin-top: 12px;
}

@media (max-width: 900px) {
    .main-content {
        width: min(100% - 36px, 720px);
        padding-top: 36px;
    }

    .auth-layout {
        min-height: auto;
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .auth-intro {
        padding: 0;
    }

    .auth-intro h1 {
        font-size: clamp(42px, 8vw, 58px);
    }

    .feature-list {
        display: none;
    }

    .auth-card {
        max-width: 560px;
        justify-self: center;
    }

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

@media (max-width: 600px) {
    .topbar {
        min-height: 70px;
        padding: 13px 18px;
    }

    .topbar-label {
        font-size: 11px;
    }

    .main-content {
        width: calc(100% - 28px);
        padding-top: 28px;
    }

    .auth-intro h1 {
        font-size: 43px;
        letter-spacing: -1.8px;
    }

    .auth-intro > p {
        font-size: 14px;
    }

    .auth-card {
        padding: 23px 19px;
        border-radius: 18px;
    }

    .card-heading h1,
    .card-heading h2 {
        font-size: 29px;
    }

    .dashboard-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 20px;
    }

    .profile-area {
        width: 100%;
        justify-content: space-between;
    }

    .profile-details {
        text-align: left;
    }

    .role-badge {
        justify-self: start;
    }

    .dashboard-nav {
        margin-bottom: 20px;
    }

    .stats-grid {
        gap: 10px;
    }

    .stat-card {
        min-height: 112px;
        padding: 15px;
    }

    .stat-value {
        font-size: 29px;
    }

    .panel {
        padding: 17px;
    }

    .section-heading {
        flex-direction: column;
    }

    .form-grid,
    .detail-list {
        grid-template-columns: 1fr;
    }

    .form-grid .full-width {
        grid-column: auto;
    }

    .inline-form {
        align-items: stretch;
        flex-direction: column;
    }

    .inline-form .form-field {
        min-width: 0;
    }

    .dashboard-footer {
        margin-top: 30px;
        font-size: 11px;
    }
}

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