:root {
    --canvas: #000000;
    --surface: #080808;
    --surface-raised: #111111;
    --surface-hover: #181818;
    --line: #292929;
    --line-strong: #444444;
    --text: #f7f7f2;
    --text-soft: #c4c4bc;
    --text-muted: #92928b;
    --accent: #fdfd96;
    --accent-hover: #ffffbd;
    --accent-soft: rgba(253, 253, 150, 0.12);
    --accent-border: rgba(253, 253, 150, 0.42);
    --accent-text: #000000;
    --danger: #e26868;
    --danger-soft: rgba(226, 104, 104, 0.13);
    --danger-border: rgba(226, 104, 104, 0.45);
    --danger-text: #ffb7b7;
    --success: #71c69c;
    --success-soft: rgba(113, 198, 156, 0.09);
    --success-border: rgba(113, 198, 156, 0.38);
    --success-text: #9ee2bd;
    --warning: #fdfd96;
    --backdrop: rgba(0, 0, 0, 0.72);
    --modal-backdrop: rgba(0, 0, 0, 0.78);
    --sidebar: #030303;
    --input: #050505;
    --placeholder: #8a8a83;
    --skeleton: #181818;
    --toast: #101010;
    --control-hover-border: #666666;
    --card-radius: 14px;
    --control-radius: 8px;
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: rgba(0, 0, 0, 0) !important;
    background-color: rgba(0, 0, 0, 0) !important;
    background-image: none !important;
}

body { color: var(--text); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }

.app {
    display: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    padding: 4vh 3vw;
    background: var(--backdrop);
}

.app.is-open { display: flex; }

.workspace {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    width: min(1480px, 94vw);
    height: min(880px, 92vh);
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    background: var(--canvas);
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.62);
}

.sidebar {
    display: flex;
    min-width: 0;
    flex-direction: column;
    padding: 22px 16px;
    border-right: 1px solid var(--line);
    background: var(--sidebar);
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
    min-height: 50px;
    padding: 0 8px 18px;
}

.brand-mark {
    position: relative;
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    overflow: hidden;
    display: grid;
    place-items: center;
    border: 1px solid var(--accent-border);
    border-radius: 13px;
    background: #74777e;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.11), 0 7px 18px rgba(0, 0, 0, 0.32);
}
.brand-mark::after {
    position: absolute;
    inset: 4px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 9px;
    content: "";
    pointer-events: none;
}
.brand-mark img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.42));
    transform: scale(1.18);
}

.brand-copy { min-width: 0; }
.brand strong { display: block; overflow: hidden; font-size: 15px; letter-spacing: -0.01em; text-overflow: ellipsis; white-space: nowrap; }

.navigation { display: grid; gap: 5px; margin-top: 10px; }

.nav-button {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: var(--control-radius);
    background: transparent;
    color: var(--text-soft);
    text-align: left;
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.nav-button:hover { background: var(--surface); color: var(--text); }
.nav-button.is-active { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent); }
.nav-button:active, .button:active, .icon-button:active { transform: translateY(1px); }

.nav-index {
    color: var(--text-muted);
    font-family: ui-monospace, "Cascadia Mono", monospace;
    font-size: 11px;
}

.sidebar-footer {
    display: grid;
    gap: 3px;
    margin-top: auto;
    padding: 18px 8px 2px;
    border-top: 1px solid var(--line);
}

.sidebar-footer strong { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer span:last-child { overflow: hidden; color: var(--text-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--text-muted); font-size: 11px; }

.content-column {
    display: flex;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    flex-direction: column;
}
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 88px;
    padding: 18px 28px;
    border-bottom: 1px solid var(--line);
}

.kicker { margin: 0 0 3px; color: var(--text-muted); font-size: 12px; }
h1 { margin: 0; font-size: 24px; line-height: 1.2; letter-spacing: -0.025em; }
h2, h3, p { margin-top: 0; }
h2 { margin-bottom: 5px; font-size: 17px; letter-spacing: -0.015em; }
h3 { margin-bottom: 4px; font-size: 14px; }

.icon-button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--control-radius);
    background: var(--surface-raised);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
}

.icon-button:hover, .button:hover { border-color: var(--control-hover-border); background: var(--surface-hover); }
.button.primary { border-color: var(--accent); background: var(--accent); color: var(--accent-text); font-weight: 700; }
.button.primary:hover { background: var(--accent-hover); }
.button.danger { border-color: var(--danger-border); background: var(--danger-soft); color: var(--danger-text); }
.button.ghost { background: transparent; }
.button.small { min-height: 32px; padding: 0 10px; font-size: 12px; }
.button:disabled { cursor: not-allowed; opacity: 0.45; transform: none; }

.content {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 24px 28px 42px;
    overscroll-behavior: contain;
    scrollbar-color: var(--line-strong) transparent;
    scrollbar-width: thin;
}
.content::-webkit-scrollbar { width: 8px; height: 8px; }
.content::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 999px; background: var(--line-strong); background-clip: padding-box; }
.content::-webkit-scrollbar-thumb:hover { background: var(--accent); background-clip: padding-box; }

.stack { display: grid; gap: 18px; }
.section-header, .toolbar, .pagination, .action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.section-header p { margin: 0; color: var(--text-muted); font-size: 13px; }
.toolbar { flex-wrap: wrap; }
.toolbar-group { display: flex; align-items: center; gap: 8px; }
.toolbar-group select { width: 220px; }

.field { display: grid; gap: 7px; }
.field label { color: var(--text-soft); font-size: 12px; font-weight: 600; }
.field small { color: var(--text-muted); font-size: 11px; }

input, select, textarea {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid var(--line-strong);
    border-radius: var(--control-radius);
    outline: none;
    background: var(--input);
    color: var(--text);
}

select { appearance: none; cursor: pointer; }
select option { background: var(--surface-raised); color: var(--text); }

input::placeholder, textarea::placeholder { color: var(--placeholder); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 82px; resize: vertical; }
.search-input { width: min(330px, 50vw); }

.panel {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--card-radius);
    background: var(--surface);
}
.panel-body { padding: 18px; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line-strong);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
}
td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 255, 255, 0.018); }
.cell-title { display: grid; gap: 3px; }
.cell-title strong { font-size: 13px; }
.cell-title span, .mono { color: var(--text-muted); font-family: ui-monospace, "Cascadia Mono", monospace; font-size: 11px; }
.table-actions { display: flex; justify-content: flex-end; gap: 6px; }

.status {
    display: inline-flex;
    min-height: 25px;
    align-items: center;
    padding: 0 8px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--text-soft);
    font-size: 11px;
}
.status.online { border-color: var(--success-border); background: var(--success-soft); color: var(--success-text); }
.status.deposit { color: var(--success); }
.status.withdrawal { color: var(--danger-text); }

.grade-list { display: grid; gap: 12px; }
.grade-panel { padding: 18px; }
.grade-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.grade-meta { color: var(--text-muted); font-size: 12px; }
.permission-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.permission {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: var(--control-radius);
    color: var(--text-soft);
    font-size: 12px;
}
.permission input { width: 16px; min-height: 16px; accent-color: var(--accent); }

.salary-section-header { align-items: flex-end; }
.salary-range {
    padding: 7px 10px;
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
.salary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.salary-card {
    position: relative;
    display: grid;
    min-width: 0;
    gap: 18px;
    padding: 20px;
    overflow: hidden;
    transition: border-color 150ms ease, transform 150ms ease, background 150ms ease;
}
.salary-card::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--line-strong);
    content: "";
}
.salary-card.is-editable::before { background: var(--accent); }
.salary-card.is-editable:hover { border-color: var(--accent-border); background: var(--surface-raised); transform: translateY(-1px); }
.salary-card-header, .salary-grade-identity, .salary-editor, .salary-input-shell, .salary-access {
    display: flex;
    align-items: center;
}
.salary-card-header { justify-content: space-between; gap: 12px; }
.salary-grade-identity { min-width: 0; gap: 12px; }
.salary-grade-identity h2 { overflow: hidden; margin: 0 0 3px; text-overflow: ellipsis; white-space: nowrap; }
.salary-rank {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    place-items: center;
    border: 1px solid var(--accent-border);
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
    font-family: ui-monospace, "Cascadia Mono", monospace;
    font-size: 12px;
    font-weight: 800;
}
.salary-access {
    min-height: 25px;
    gap: 6px;
    padding: 0 9px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.055em;
}
.salary-access i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); }
.salary-access.editable { border-color: var(--success-border); background: var(--success-soft); color: var(--success-text); }
.salary-access.editable i { background: var(--success); }
.salary-overview { display: grid; gap: 5px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.salary-overview span { color: var(--text-muted); font-size: 11px; }
.salary-overview strong { font-size: clamp(23px, 2vw, 31px); letter-spacing: -0.035em; }
.salary-editor { align-items: flex-end; gap: 10px; }
.salary-editor .field { flex: 1; min-width: 0; }
.salary-input-shell { position: relative; }
.salary-input-shell > span {
    position: absolute;
    left: 12px;
    z-index: 1;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
    pointer-events: none;
}
.salary-input-shell input { padding-left: 46px; font-size: 14px; font-weight: 700; }
.salary-save { min-height: 40px; }
.salary-lock-note { max-width: 180px; padding-bottom: 3px; color: var(--text-muted); font-size: 11px; line-height: 1.35; }

.select-shell { position: relative; }
.select-shell select {
    min-height: 44px;
    padding: 9px 42px 9px 43px;
    border-color: var(--accent-border);
    background: linear-gradient(180deg, var(--surface-raised), var(--input));
    font-weight: 700;
}
.select-leading {
    position: absolute;
    top: 50%;
    left: 9px;
    z-index: 1;
    display: grid;
    width: 27px;
    height: 27px;
    place-items: center;
    border-radius: 7px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 15px;
    font-weight: 800;
    pointer-events: none;
    transform: translateY(-50%);
}
.select-chevron {
    position: absolute;
    top: 50%;
    right: 15px;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
    pointer-events: none;
    transform: translateY(-70%) rotate(45deg);
    transition: transform 140ms ease;
}
.select-shell:focus-within .select-chevron { transform: translateY(-25%) rotate(225deg); }
.select-shell:focus-within select { background: var(--surface-raised); }

.summary-grid { display: grid; grid-template-columns: minmax(260px, 0.8fr) minmax(420px, 1.2fr); gap: 16px; }
.balance-card {
    position: relative;
    display: flex;
    min-height: 220px;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    border-color: var(--line-strong);
    background: var(--surface-raised);
}
.balance-card::before {
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--accent);
    content: "";
}
.balance-card-top, .balance-card-footer, .balance-sync { display: flex; align-items: center; }
.balance-card-top, .balance-card-footer { justify-content: space-between; gap: 12px; }
.currency-badge {
    display: grid;
    min-width: 42px;
    min-height: 30px;
    place-items: center;
    padding: 0 9px;
    border: 1px solid var(--accent-border);
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    font-family: ui-monospace, "Cascadia Mono", monospace;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
}
.balance-sync {
    min-height: 25px;
    gap: 6px;
    padding: 0 9px;
    border: 1px solid var(--success-border);
    border-radius: 999px;
    background: var(--success-soft);
    color: var(--success-text);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.045em;
}
.balance-sync i { width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.balance-copy { padding: 22px 0; }
.balance-copy p { margin: 0 0 8px; color: var(--text-muted); font-size: 12px; }
.balance { font-size: clamp(34px, 4vw, 50px); font-weight: 780; line-height: 1; letter-spacing: -0.05em; }
.balance-card-footer { padding-top: 13px; border-top: 1px solid var(--line); color: var(--text-muted); font-size: 10px; }
.balance-card-footer span:last-child { color: var(--text-soft); }
.transaction-form { display: grid; grid-template-columns: minmax(180px, 0.7fr) minmax(180px, 1fr); gap: 12px; padding: 18px; }
.transaction-form .wide { grid-column: 1 / -1; }

.empty-state, .error-state, .loading-state {
    display: grid;
    min-height: 250px;
    place-items: center;
    padding: 40px;
    color: var(--text-muted);
    text-align: center;
}
.state-copy { max-width: 440px; }
.state-copy strong { display: block; margin-bottom: 7px; color: var(--text); font-size: 16px; }
.state-copy p { margin: 0; font-size: 13px; line-height: 1.55; }

.skeleton-list { display: grid; width: min(720px, 100%); gap: 10px; }
.skeleton { height: 54px; border-radius: 10px; background: var(--skeleton); }
@media (prefers-reduced-motion: no-preference) {
    .skeleton { animation: pulse 1.25s ease-in-out infinite alternate; }
    @keyframes pulse { to { opacity: 0.48; } }
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: var(--modal-backdrop);
}
.modal {
    width: min(500px, 92vw);
    max-height: 84vh;
    overflow: auto;
    border: 1px solid var(--line-strong);
    border-radius: var(--card-radius);
    background: var(--surface);
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.65);
}
.modal-header, .modal-body, .modal-footer { padding: 18px 20px; }
.modal-header { border-bottom: 1px solid var(--line); }
.modal-header p { margin: 5px 0 0; color: var(--text-muted); font-size: 12px; }
.modal-body { display: grid; gap: 14px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }

.toast-root { position: fixed; right: 24px; bottom: 24px; display: grid; width: min(360px, calc(100vw - 48px)); gap: 8px; }
.toast { padding: 13px 15px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--toast); color: var(--text); font-size: 13px; box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5); }
.toast.error { border-color: var(--danger-border); }
.toast.success { border-color: var(--success-border); }

.pagination { justify-content: flex-end; padding-top: 2px; }
.pagination span { color: var(--text-muted); font-size: 12px; }

@media (max-width: 1100px) {
    .app { padding: 3vh 2vw; }
    .workspace { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); width: 96vw; height: 94vh; }
    .sidebar { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
    .brand { min-height: 42px; padding: 0 14px 0 0; }
    .brand-mark { width: 44px; height: 44px; flex-basis: 44px; }
    .navigation { display: flex; min-width: 0; gap: 4px; margin: 0; overflow-x: auto; }
    .nav-button { width: auto; min-width: max-content; min-height: 38px; }
    .nav-index, .sidebar-footer { display: none; }
    .topbar { min-height: 72px; padding: 12px 20px; }
    .content { padding: 18px 20px 24px; }
    .permission-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .summary-grid { grid-template-columns: 1fr; }
    .balance-card { min-height: 190px; }
    .salary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
    .brand div { display: none; }
    .content { padding: 14px; }
    .section-header, .toolbar { align-items: stretch; flex-direction: column; }
    .toolbar-group { width: 100%; }
    .toolbar-group select { width: 100%; }
    .search-input { width: 100%; }
    .permission-grid { grid-template-columns: 1fr; }
    .salary-grid { grid-template-columns: 1fr; }
    .salary-section-header { align-items: flex-start; }
    .salary-editor { align-items: stretch; flex-direction: column; }
    .salary-save { width: 100%; }
    .salary-lock-note { max-width: none; }
    .transaction-form { grid-template-columns: 1fr; }
    .transaction-form .wide { grid-column: auto; }
    .table-actions { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
