:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --border: #d8dbe0;
    --text: #1f2933;
    --muted: #6b7280;
    --primary: #1d4ed8;
    --primary-dark: #1e40af;
    --danger: #b91c1c;
    --success: #15803d;
    --error-bg: #fef2f2;
    --success-bg: #f0fdf4;
    --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
    text-decoration: underline;
}

h1 {
    font-size: 1.4rem;
    margin: 0 0 0.5rem;
}

h2 {
    font-size: 1.1rem;
    margin: 1.75rem 0 0.75rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
}

.container {
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 1rem;
}

.app-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--text);
}

.brand:hover {
    text-decoration: none;
}

.brand-logo {
    display: block;
    height: 44px;
    width: auto;
}

.brand-name {
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.2;
}

.app-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.85rem;
    margin-left: auto;
}

.link-button {
    background: none;
    border: 0;
    color: var(--primary);
    cursor: pointer;
    padding: 0;
    font: inherit;
}

.link-button:hover {
    text-decoration: underline;
}

.account-menu {
    position: relative;
}

.account-menu-button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.account-menu-button:hover {
    background: #f3f4f6;
}

.account-caret {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
}

.account-menu-list {
    position: absolute;
    right: 0;
    top: calc(100% + 0.4rem);
    z-index: 50;
    min-width: 12rem;
    display: flex;
    flex-direction: column;
    padding: 0.35rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.account-menu-list[hidden] {
    display: none;
}

.account-menu-list form {
    margin: 0;
}

.account-menu-list a,
.account-menu-list .link-button {
    display: block;
    width: 100%;
    padding: 0.5rem 0.65rem;
    border-radius: 6px;
    color: var(--text);
    text-align: left;
    font-size: 0.9rem;
}

.account-menu-list a:hover,
.account-menu-list .link-button:hover {
    background: #f3f4f6;
    text-decoration: none;
}

main.container {
    padding-bottom: 3rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-narrow {
    max-width: 460px;
    margin-left: auto;
    margin-right: auto;
}

.muted {
    color: var(--muted);
}

.hint {
    color: var(--muted);
    font-size: 0.85rem;
    margin: 0.25rem 0 0;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

.field {
    margin-bottom: 1rem;
}

.field label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.3rem;
    font-size: 0.9rem;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="date"],
.field input[type="number"],
.field input[type="file"],
.field select,
.field textarea,
.repeatable input,
.filters input,
.filters select {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    font: inherit;
    color: inherit;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: -1px;
}

.field.checkbox label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-weight: 400;
}

.field.checkbox input {
    width: auto;
    margin-top: 0.2rem;
}

.field-error {
    color: var(--danger);
    font-size: 0.85rem;
    margin: 0.25rem 0 0;
}

.btn {
    display: inline-block;
    padding: 0.55rem 1rem;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.2;
}

.btn:hover {
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: #fff;
    border-color: var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: #f3f4f6;
}

.btn-danger {
    background: #fff;
    border-color: var(--danger);
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--error-bg);
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
}

.btn.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.inline-form {
    display: inline;
    margin: 0;
}

.alert {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    border: 1px solid;
}

.alert-success {
    background: var(--success-bg);
    border-color: #bbf7d0;
    color: var(--success);
}

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

.alert ul {
    margin: 0.5rem 0 0;
    padding-left: 1.2rem;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #e5e7eb;
    color: #374151;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-ok {
    background: #dcfce7;
    color: var(--success);
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0 1rem;
}

.table th,
.table td {
    border: 1px solid var(--border);
    padding: 0.5rem 0.6rem;
    text-align: left;
    vertical-align: top;
    font-size: 0.9rem;
}

.table thead th {
    background: #f8fafc;
    font-weight: 600;
}

.repeatable-block {
    overflow-x: auto;
}

.repeatable {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.75rem;
    min-width: 720px;
}

.repeatable th,
.repeatable td {
    border: 1px solid var(--border);
    padding: 0.35rem;
}

.repeatable thead th {
    background: #f8fafc;
    font-size: 0.82rem;
    text-align: left;
}

.repeatable .sr-cell {
    width: 2.5rem;
    text-align: center;
    color: var(--muted);
}

.filters {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1rem;
}

.filters input {
    flex: 1 1 260px;
}

.filters select {
    flex: 0 0 150px;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-top: 1rem;
}

.wizard-layout {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
}

.wizard-sidebar {
    flex: 0 0 260px;
    position: sticky;
    top: 1rem;
}

.stepnav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0;
    margin: 0;
}

.stepnav-item a,
.stepnav-item > span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font-size: 0.85rem;
}

.stepnav-item a:hover {
    text-decoration: none;
    border-color: var(--primary);
}

.stepnav-item .step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    background: #e5e7eb;
    font-size: 0.78rem;
    font-weight: 700;
}

.stepnav-item.is-current a,
.stepnav-item.is-current > span {
    border-color: var(--primary);
    background: #eff6ff;
    color: var(--primary-dark);
    font-weight: 600;
}

.stepnav-item.is-current .step-number {
    background: var(--primary);
    color: #fff;
}

.stepnav-item.is-locked > span {
    opacity: 0.55;
}

.wizard-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.summary-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.summary-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.summary {
    margin: 0;
}

.summary-row {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1rem;
    padding: 0.4rem 0;
    border-bottom: 1px dashed var(--border);
}

.summary-row dt {
    color: var(--muted);
    font-weight: 600;
}

.summary-row dd {
    margin: 0;
}

.photo-thumb {
    width: 110px;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    object-fit: cover;
}

.declaration {
    margin-top: 1.5rem;
}

@media (max-width: 800px) {
    .wizard-layout {
        flex-direction: column;
    }

    .wizard-sidebar {
        flex: none;
        width: 100%;
        position: static;
    }
}

@media (max-width: 640px) {
    .summary-row {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }
}

/* ============================================================
   HRMS data-entry console (scoped to the profile wizard page)
   ============================================================ */

.hrms-page {
    background: #eef1f5;
}

.hrms-page .app-header .container {
    max-width: 1680px;
}

.hrms {
    --hrms-bg: #eef1f5;
    --hrms-surface: #ffffff;
    --hrms-sunken: #f5f7f9;
    --hrms-ink: #0f172a;
    --hrms-ink-2: #334155;
    --hrms-muted: #5b6b7f;
    --hrms-line: #e0e6ec;
    --hrms-line-strong: #c6cfd9;
    --hrms-accent: #0f766e;
    --hrms-accent-dark: #0b5d57;
    --hrms-accent-soft: #e3f1ef;
    --hrms-accent-line: #b7d8d4;
    --hrms-danger: #b42318;
    --hrms-success: #067647;

    background: var(--hrms-bg);
    color: var(--hrms-ink);
    min-height: 70vh;
    padding: 1.5rem;
    font-size: 15px;
}

.hrms a {
    color: var(--hrms-accent-dark);
}

.hrms a:hover {
    text-decoration: underline;
}

.hrms-shell {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
    max-width: 1680px;
    margin: 0 auto;
}

/* -------- Completion rail -------- */

.hrms-rail {
    position: sticky;
    top: 1.25rem;
    background: var(--hrms-surface);
    border: 1px solid var(--hrms-line);
    border-radius: 12px;
    padding: 1.1rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.rail-eyebrow {
    margin: 0;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--hrms-muted);
}

.rail-title {
    margin: 0.3rem 0 0.8rem;
    border: 0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.rail-meter {
    height: 6px;
    border-radius: 999px;
    background: var(--hrms-sunken);
    border: 1px solid var(--hrms-line);
    overflow: hidden;
}

.rail-meter-fill {
    display: block;
    height: 100%;
    background: var(--hrms-accent);
    border-radius: 999px;
    transition: width 0.25s ease;
}

.rail-meta {
    margin: 0.55rem 0 1rem;
    font-size: 0.78rem;
    color: var(--hrms-muted);
    font-variant-numeric: tabular-nums;
}

.hrms-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hrms-step a {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.55rem;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--hrms-ink-2);
    font-size: 0.86rem;
    line-height: 1.25;
    text-decoration: none;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.hrms-step a:hover {
    background: var(--hrms-sunken);
    text-decoration: none;
}

.hrms-step a:focus-visible {
    outline: 2px solid var(--hrms-accent);
    outline-offset: 2px;
}

.hrms-step-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: var(--hrms-sunken);
    border: 1px solid var(--hrms-line-strong);
    color: var(--hrms-muted);
    font-size: 0.74rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.hrms-step.is-done .hrms-step-mark {
    background: var(--hrms-success);
    border-color: var(--hrms-success);
    color: #fff;
}

.hrms-step.is-current a {
    background: var(--hrms-accent-soft);
    border-color: var(--hrms-accent-line);
    color: var(--hrms-accent-dark);
    font-weight: 600;
}

.hrms-step.is-current .hrms-step-mark {
    background: var(--hrms-accent);
    border-color: var(--hrms-accent);
    color: #fff;
}

/* -------- Section canvas -------- */

.hrms-canvas {
    background: var(--hrms-surface);
    border: 1px solid var(--hrms-line);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.canvas-head {
    padding: 1.25rem 1.75rem;
    border-bottom: 1px solid var(--hrms-line);
    border-radius: 11px 11px 0 0;
    background: linear-gradient(180deg, #ffffff, #fbfcfd);
}

.canvas-eyebrow {
    margin: 0 0 0.35rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--hrms-accent);
    font-variant-numeric: tabular-nums;
}

.canvas-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.canvas-body {
    padding: 1.6rem 1.75rem;
}

.canvas-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.75rem;
    border-top: 1px solid var(--hrms-line);
    border-radius: 0 0 11px 11px;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(6px);
}

.actions-spacer {
    flex: 1;
}

/* -------- Fields -------- */

.hrms .grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem 1.25rem;
}

.hrms .field {
    margin-bottom: 1.15rem;
}

.hrms .grid > .field {
    margin-bottom: 0;
}

.hrms .field label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--hrms-ink-2);
}

.hrms .field input[type="text"],
.hrms .field input[type="email"],
.hrms .field input[type="password"],
.hrms .field input[type="date"],
.hrms .field input[type="number"],
.hrms .field select,
.hrms .field textarea,
.hrms .repeatable input,
.hrms .repeatable select {
    width: 100%;
    min-height: 42px;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--hrms-line-strong);
    border-radius: 8px;
    background: #fff;
    color: var(--hrms-ink);
    font: inherit;
    font-size: 1rem;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.hrms .field textarea {
    min-height: 96px;
    resize: vertical;
}

.hrms .field input[type="file"] {
    width: 100%;
    padding: 0.45rem 0.6rem;
    border: 1px dashed var(--hrms-line-strong);
    border-radius: 8px;
    background: var(--hrms-sunken);
    font-size: 0.85rem;
}

.hrms .field input:focus,
.hrms .field select:focus,
.hrms .field textarea:focus,
.hrms .repeatable input:focus,
.hrms .repeatable select:focus {
    outline: none;
    border-color: var(--hrms-accent);
    box-shadow: 0 0 0 3px var(--hrms-accent-soft);
}

.hrms .field.checkbox label {
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--hrms-ink);
}

.hrms .field.checkbox input {
    width: 18px;
    height: 18px;
    margin-top: 0.1rem;
    accent-color: var(--hrms-accent);
}

.hrms .field-error {
    margin: 0.3rem 0 0;
    color: var(--hrms-danger);
    font-size: 0.8rem;
}

.hrms .hint {
    margin: 0.3rem 0 0;
    color: var(--hrms-muted);
    font-size: 0.8rem;
}

.hrms .photo-thumb {
    border-radius: 8px;
    border-color: var(--hrms-line-strong);
}

.hrms .canvas-body h2 {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin: 1.9rem 0 0.9rem;
    padding: 0;
    border: 0;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--hrms-muted);
}

.hrms .canvas-body h2::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--hrms-line);
}

.hrms .canvas-body > h2:first-child {
    margin-top: 0;
}

/* -------- Buttons -------- */

.hrms .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 42px;
    padding: 0.55rem 1.1rem;
    border: 1px solid transparent;
    border-radius: 8px;
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.hrms .btn:focus-visible {
    outline: 2px solid var(--hrms-accent);
    outline-offset: 2px;
}

.hrms .btn-primary {
    background: var(--hrms-accent);
    color: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.14);
}

.hrms .btn-primary:hover {
    background: var(--hrms-accent-dark);
    text-decoration: none;
}

.hrms .btn-secondary {
    background: #fff;
    border-color: var(--hrms-line-strong);
    color: var(--hrms-ink);
}

.hrms .btn-secondary:hover {
    background: var(--hrms-sunken);
    text-decoration: none;
}

.hrms .btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--hrms-ink-2);
}

.hrms .btn-ghost:hover {
    background: var(--hrms-sunken);
    text-decoration: none;
}

.hrms .btn-danger {
    background: #fff;
    border-color: #eeb4ae;
    color: var(--hrms-danger);
}

.hrms .btn-danger:hover {
    background: #fef3f2;
}

.hrms .btn-sm {
    min-height: 32px;
    padding: 0.25rem 0.6rem;
    font-size: 0.78rem;
}

/* -------- Tables -------- */

.hrms .repeatable-block {
    overflow-x: auto;
    border: 1px solid var(--hrms-line);
    border-radius: 10px;
}

.hrms .repeatable-block > .btn {
    margin: 0.75rem;
}

.hrms .table input[type="file"] {
    max-width: 220px;
    padding: 0.35rem 0.5rem;
    border: 1px dashed var(--hrms-line-strong);
    border-radius: 8px;
    background: var(--hrms-sunken);
    font-size: 0.82rem;
}

.hrms .table,
.hrms .repeatable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

.hrms .table {
    margin: 0 0 1rem;
    border: 1px solid var(--hrms-line);
    border-radius: 10px;
    overflow: hidden;
}

.hrms .table th,
.hrms .repeatable thead th {
    padding: 0.6rem 0.75rem;
    background: var(--hrms-sunken);
    border-bottom: 1px solid var(--hrms-line-strong);
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--hrms-ink-2);
}

.hrms .table td,
.hrms .repeatable td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--hrms-line);
    vertical-align: middle;
}

.hrms .table tbody tr:last-child td,
.hrms .repeatable tbody tr:last-child td {
    border-bottom: 0;
}

.hrms .repeatable tbody tr:hover {
    background: #fafcfd;
}

.hrms .repeatable .sr-cell {
    width: 3rem;
    text-align: center;
    color: var(--hrms-muted);
    font-variant-numeric: tabular-nums;
}

/* -------- Badges & alerts -------- */

.hrms .badge {
    background: var(--hrms-sunken);
    border: 1px solid var(--hrms-line-strong);
    color: var(--hrms-ink-2);
}

.hrms .badge-ok {
    background: #ecfdf3;
    border-color: #a9e7c1;
    color: var(--hrms-success);
}

.hrms .alert {
    border-radius: 10px;
}

.hrms .declaration {
    margin-top: 1.75rem;
}

/* -------- Responsive -------- */

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

    .hrms-rail {
        position: static;
    }

    .hrms-steps {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .hrms-step {
        flex: 1 1 220px;
    }
}

@media (max-width: 640px) {
    .hrms {
        padding: 1rem 0.75rem;
    }

    .canvas-head,
    .canvas-body,
    .canvas-actions {
        padding-left: 1rem;
        padding-right: 1rem;
    }

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

    .canvas-actions {
        flex-wrap: wrap;
    }

    .actions-spacer {
        display: none;
    }
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
}

.theme-toggle:hover {
    background: #f3f4f6;
}

.theme-icon {
    display: block;
    width: 18px;
    height: 18px;
}

.theme-icon-sun {
    display: none;
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f1419;
    --surface: #1b222b;
    --border: #2c3642;
    --text: #e6edf3;
    --muted: #96a2b0;
    --primary: #60a5fa;
    --primary-dark: #3b82f6;
    --danger: #f87171;
    --success: #4ade80;
    --error-bg: #2a1616;
    --success-bg: #10291c;
}

[data-theme="dark"] .theme-toggle:hover {
    background: #232c37;
}

[data-theme="dark"] .theme-icon-sun {
    display: block;
}

[data-theme="dark"] .theme-icon-moon {
    display: none;
}

[data-theme="dark"] .brand-logo {
    background: #ffffff;
    border-radius: 8px;
    padding: 4px 6px;
}

[data-theme="dark"] .field input[type="text"],
[data-theme="dark"] .field input[type="email"],
[data-theme="dark"] .field input[type="password"],
[data-theme="dark"] .field input[type="date"],
[data-theme="dark"] .field input[type="number"],
[data-theme="dark"] .field input[type="file"],
[data-theme="dark"] .field select,
[data-theme="dark"] .field textarea,
[data-theme="dark"] .repeatable input,
[data-theme="dark"] .filters input,
[data-theme="dark"] .filters select {
    background: var(--bg);
    color: var(--text);
}

[data-theme="dark"] .btn-primary {
    color: #0b1220;
}

[data-theme="dark"] .btn-secondary {
    background: var(--surface);
}

[data-theme="dark"] .btn-secondary:hover {
    background: #232c37;
}

[data-theme="dark"] .btn-danger {
    background: var(--surface);
}

[data-theme="dark"] .badge {
    background: #2c3642;
    color: var(--text);
}

[data-theme="dark"] .badge-ok {
    background: #10291c;
    color: var(--success);
}

[data-theme="dark"] .alert-success {
    border-color: #1f5a3a;
}

[data-theme="dark"] .alert-error {
    border-color: #5b2a2a;
}

[data-theme="dark"] .table thead th,
[data-theme="dark"] .repeatable thead th {
    background: #232c37;
}

[data-theme="dark"] .stepnav-item a {
    background: var(--surface);
}

[data-theme="dark"] .stepnav-item .step-number {
    background: #2c3642;
}

[data-theme="dark"] .stepnav-item.is-current a {
    background: #14263c;
    color: var(--primary);
}

[data-theme="dark"] .account-menu-button:hover,
[data-theme="dark"] .account-menu-list a:hover,
[data-theme="dark"] .account-menu-list .link-button:hover {
    background: #232c37;
}

[data-theme="dark"] .hrms {
    --hrms-bg: #0f1419;
    --hrms-surface: #1b222b;
    --hrms-sunken: #232c37;
    --hrms-ink: #e6edf3;
    --hrms-ink-2: #c3ccd6;
    --hrms-muted: #94a3b1;
    --hrms-line: #2c3642;
    --hrms-line-strong: #3a4553;
    --hrms-accent: #2dd4bf;
    --hrms-accent-dark: #5eead4;
    --hrms-accent-soft: #12312e;
    --hrms-accent-line: #1f4a45;
    --hrms-danger: #f87171;
    --hrms-success: #4ade80;
}

[data-theme="dark"] .hrms-page {
    background: #0f1419;
}

[data-theme="dark"] .hrms .field input[type="text"],
[data-theme="dark"] .hrms .field input[type="email"],
[data-theme="dark"] .hrms .field input[type="password"],
[data-theme="dark"] .hrms .field input[type="date"],
[data-theme="dark"] .hrms .field input[type="number"],
[data-theme="dark"] .hrms .field select,
[data-theme="dark"] .hrms .field textarea,
[data-theme="dark"] .hrms .repeatable input,
[data-theme="dark"] .hrms .repeatable select {
    background: var(--hrms-sunken);
    color: var(--hrms-ink);
}

[data-theme="dark"] .hrms .field input[type="file"],
[data-theme="dark"] .hrms .table input[type="file"] {
    background: var(--hrms-sunken);
}

[data-theme="dark"] .hrms .btn-primary {
    color: #06251f;
}

[data-theme="dark"] .hrms .btn-primary:hover {
    background: #5eead4;
}

[data-theme="dark"] .hrms .btn-secondary {
    background: var(--hrms-surface);
    color: var(--hrms-ink);
}

[data-theme="dark"] .hrms .btn-secondary:hover {
    background: var(--hrms-sunken);
}

[data-theme="dark"] .hrms .btn-ghost:hover {
    background: var(--hrms-sunken);
}

[data-theme="dark"] .hrms .btn-danger {
    background: var(--hrms-surface);
    border-color: #7f2e26;
}

[data-theme="dark"] .hrms .btn-danger:hover {
    background: #2a1616;
}

[data-theme="dark"] .hrms .repeatable tbody tr:hover {
    background: #202a35;
}

[data-theme="dark"] .hrms .badge-ok {
    background: #10291c;
    border-color: #1f5a3a;
    color: var(--hrms-success);
}

[data-theme="dark"] .hrms-step.is-current .hrms-step-mark,
[data-theme="dark"] .hrms-step.is-done .hrms-step-mark {
    color: #06251f;
}

[data-theme="dark"] .canvas-head {
    background: var(--hrms-surface);
}

[data-theme="dark"] .canvas-actions {
    background: rgba(27, 34, 43, 0.94);
}

@media (max-width: 640px) {
    .container {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }

    .brand-logo {
        height: 36px;
    }

    .brand-name {
        font-size: 1.05rem;
    }

    .card {
        padding: 1.15rem;
    }

    .summary-head,
    .summary-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .summary-actions .btn {
        text-align: center;
    }

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

    .filters input,
    .filters select,
    .filters .btn {
        flex: 1 1 auto;
        width: 100%;
    }

    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }

    .table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .hrms .canvas-actions .btn,
    .hrms-step {
        flex: 1 1 100%;
    }
}

@media (max-width: 400px) {
    .brand-name {
        font-size: 0.95rem;
    }

    .account-menu-button {
        padding: 0.4rem 0.55rem;
    }

    .canvas-title {
        font-size: 1.25rem;
    }
}
