:root {
  --ink: #1f2937;
  --muted: #596474;
  --paper: #fffdfa;
  --canvas: #f5f3ee;
  --line: #e6e0d7;
  --brand: #1d4e5f;
  --brand-deep: #123945;
  --teal: #0f766e;
  --teal-soft: #e5f4f1;
  --warning: #9a5b08;
  --warning-soft: #fff5df;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --success: #147a48;
  --success-soft: #eaf8ef;
  --shadow: 0 14px 30px rgba(47, 51, 56, .08);
  --radius: 16px;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  font-family: Tahoma, Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { direction: rtl; overflow-x: hidden; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { border: 0; }
button:not(:disabled) { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(15,118,110,.3); outline-offset: 2px; }

.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(circle at 12% 20%, #dcefe9 0, transparent 36%), radial-gradient(circle at 86% 80%, #eee2ce 0, transparent 32%), var(--canvas); }
.auth-card { width: min(100%, 470px); padding: 2.1rem; border: 1px solid rgba(255,255,255,.7); border-radius: 24px; background: rgba(255,253,250,.93); box-shadow: var(--shadow); }
.brand-lockup { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.6rem; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; color: #fff; background: var(--brand); border-radius: 14px; font-weight: 700; }
.brand-lockup h1 { margin: 0; font-size: 1rem; }
.brand-lockup p { margin: .2rem 0 0; color: var(--muted); font-size: .75rem; }
.auth-card h2 { margin: 0 0 .5rem; font-size: 1.2rem; }
.auth-card > p { margin: 0 0 1.3rem; color: var(--muted); font-size: .82rem; line-height: 1.8; }

.shell { display: grid; min-height: 100vh; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { padding: 1.15rem; color: #e7f0ef; background: linear-gradient(180deg, var(--brand-deep), #193f4c); }
.sidebar .brand-lockup { margin: .5rem .35rem 1.8rem; }
.sidebar .brand-mark { color: var(--brand); background: #f0cf84; }
.sidebar .brand-lockup p { color: #c3d6d3; }
.nav-list { display: grid; min-width: 0; gap: .35rem; }
.nav-item { width: 100%; min-height: 44px; display: flex; align-items: center; gap: .7rem; padding: .78rem .85rem; color: #d9e6e4; text-align: right; border-radius: 11px; background: transparent; transition: background 160ms var(--ease-out), transform 160ms var(--ease-out); }
.nav-item:hover, .nav-item[aria-current="page"] { color: #fff; background: rgba(255,255,255,.13); }
.nav-item:active, .button:active { transform: scale(.97); }
.sidebar-footer { margin-top: 2rem; padding: .85rem; color: #c3d6d3; font-size: .7rem; line-height: 1.8; border-top: 1px solid rgba(255,255,255,.15); }

.content { min-width: 0; padding: 1.75rem clamp(1rem, 3vw, 3rem); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.7rem; }
.topbar h1 { margin: 0; font-size: clamp(1.2rem, 2vw, 1.65rem); }
.topbar p { margin: .35rem 0 0; color: var(--muted); font-size: .75rem; }
.identity { display: flex; align-items: center; gap: .65rem; color: var(--muted); font-size: .72rem; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; color: #fff; background: var(--teal); border-radius: 50%; font-weight: 700; }

.grid { display: grid; min-width: 0; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { min-width: 0; padding: 1.15rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 5px 16px rgba(47, 51, 56, .035); }
.card h2, .card h3 { margin: 0; }
.card h2 { font-size: 1rem; }
.card h3 { font-size: .88rem; }
.card p { color: var(--muted); font-size: .75rem; line-height: 1.8; }
.stat { padding: 1rem; min-height: 110px; border-radius: var(--radius); background: var(--paper); border: 1px solid var(--line); }
.stat small { color: var(--muted); font-size: .7rem; }
.stat strong { display: block; margin-top: .7rem; font-size: 1.55rem; }
.stat .accent { color: var(--teal); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px; min-width: 44px; padding: .55rem .85rem; color: #fff; background: var(--brand); border-radius: 10px; font-size: .76rem; transition: transform 160ms var(--ease-out), background 160ms var(--ease-out), opacity 160ms var(--ease-out); }
.button:hover { background: var(--brand-deep); }
.button.secondary { color: var(--brand); background: #e4efec; }
.button.ghost { color: var(--brand); background: transparent; border: 1px solid var(--line); }
.button.danger { background: var(--danger); }
.button:disabled { cursor: not-allowed; opacity: .55; }
[aria-busy="true"] .button:disabled, .button[aria-busy="true"] { cursor: progress; }

.field { display: grid; gap: .38rem; }
.field label { font-size: .72rem; font-weight: 600; }
.field .hint { color: var(--muted); font-size: .62rem; }
.input, .select, .textarea { width: 100%; min-height: 44px; padding: .68rem .72rem; color: var(--ink); background: #fff; border: 1px solid #d9d4ca; border-radius: 10px; font-size: .76rem; }
.textarea { min-height: 92px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-start; gap: .65rem; margin-top: 1.1rem; }
.required { color: var(--danger); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: .74rem; }
th, td { padding: .8rem; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; background: #faf8f3; }
tr:last-child td { border-bottom: 0; }
.row-action { min-width: 44px; min-height: 44px; padding: .45rem; color: var(--brand); text-decoration: underline; background: transparent; font-size: .73rem; }

.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .32rem .55rem; font-size: .65rem; border-radius: 999px; }
.badge.unset { color: var(--warning); background: var(--warning-soft); }
.badge.zero { color: var(--muted); background: #edf0f2; }
.badge.warn { color: var(--danger); background: var(--danger-soft); }
.badge.ok { color: var(--success); background: var(--success-soft); }
.notice { display: flex; align-items: flex-start; gap: .65rem; padding: .85rem; font-size: .73rem; line-height: 1.75; border-radius: 11px; }
.notice.info { color: #1e4a64; background: #e8f4f8; }
.notice.warning { color: #805005; background: var(--warning-soft); }
.notice.error { color: var(--danger); background: var(--danger-soft); }
.notice.success { color: var(--success); background: var(--success-soft); }
.empty { padding: 2rem 1rem; color: var(--muted); text-align: center; font-size: .78rem; }
.loading { display: flex; align-items: center; gap: .6rem; padding: 1rem; color: var(--muted); font-size: .75rem; }
.spinner { width: 17px; height: 17px; border: 2px solid #cad8d5; border-top-color: var(--teal); border-radius: 50%; animation: spin .7s linear infinite; }

.detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.detail-header h2 { margin: 0; font-size: 1.1rem; }
.detail-meta { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .65rem; color: var(--muted); font-size: .7rem; }
.fact-list { display: grid; gap: .65rem; margin: 0; padding: 0; list-style: none; }
.fact-list li { padding: .75rem; border-right: 3px solid var(--teal); background: #f7faf9; border-radius: 8px; }
.fact-list strong { display: block; font-size: .73rem; }
.fact-list span { display: block; margin-top: .25rem; color: var(--muted); font-size: .67rem; }
.dialog-backdrop { position: fixed; inset: 0; display: grid; place-items: center; padding: 1rem; background: rgba(18, 57, 69, .35); z-index: 30; }
.dialog { width: min(100%, 760px); max-height: calc(100vh - 2rem); overflow: auto; padding: 1.25rem; background: var(--paper); border-radius: 18px; box-shadow: var(--shadow); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.dialog-head h2 { margin: 0; font-size: 1rem; }
.close { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; color: var(--muted); background: #f0ede6; border-radius: 50%; }
.toast-region { position: fixed; left: 1rem; bottom: 1rem; z-index: 50; display: grid; gap: .55rem; width: min(380px, calc(100vw - 2rem)); }
.toast { padding: .85rem 1rem; color: #fff; background: #26333a; border-radius: 12px; box-shadow: var(--shadow); font-size: .73rem; animation: enter .18s var(--ease-out); }
.toast.error { background: var(--danger); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes enter { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (max-width: 820px) { .shell { grid-template-columns: minmax(0, 1fr); } .sidebar { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .75rem; padding: .65rem .8rem; } .sidebar .brand-lockup { margin: 0; } .sidebar .brand-lockup h1, .sidebar .brand-lockup p, .sidebar-footer { display: none; } .nav-list { display: flex; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-gutter: stable; } .nav-item { width: auto; flex: 0 0 auto; white-space: nowrap; } .content { padding: 1rem; } .grid-2, .grid-3, .form-grid { grid-template-columns: minmax(0, 1fr); } .topbar, .detail-header { align-items: flex-start; flex-direction: column; } .identity { width: 100%; flex-wrap: wrap; } .toolbar-left, .toolbar-right { width: 100%; } .toolbar-right > .input { width: 100% !important; } .dialog-backdrop { align-items: end; padding: .5rem; } .dialog { max-height: calc(100dvh - 1rem); border-radius: 18px 18px 10px 10px; } }
@media (min-width: 821px) and (max-width: 900px) { .shell { grid-template-columns: minmax(0, 1fr); } .sidebar { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: .75rem; padding: .65rem .8rem; } .sidebar .brand-lockup { margin: 0; } .sidebar .brand-lockup h1, .sidebar .brand-lockup p, .sidebar-footer { display: none; } .nav-list { display: flex; overflow-x: auto; overscroll-behavior-inline: contain; } .nav-item { width: auto; flex: 0 0 auto; white-space: nowrap; } .content { padding: 1rem; } .grid-2, .grid-3, .form-grid { grid-template-columns: minmax(0, 1fr); } .topbar, .detail-header { align-items: flex-start; flex-direction: column; } .identity, .toolbar-left, .toolbar-right { width: 100%; } }
@media (max-width: 480px) { .content { padding: .8rem; } .card, .stat { padding: .9rem; } .form-actions { flex-direction: column; } .form-actions .button { width: 100%; } th, td { padding: .7rem; } .topbar { margin-bottom: 1rem; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

.s6-financial-core { margin: 1.15rem 0; }
.s6-financial-core .stat { background: linear-gradient(135deg, #fffdfa, #f1f8f5); }
.s6-financial-core [data-authoritative-price] { color: var(--brand); font-variant-numeric: tabular-nums; }
.financial-request { display: grid; gap: .55rem; margin-top: .7rem; padding: .8rem; border: 1px solid var(--line); border-radius: 10px; }
.financial-request.pending { background: var(--warning-soft); border-color: #edd39b; }
.financial-request.approved { background: var(--success-soft); border-color: #b9dfc7; }
.financial-meta { display: flex; flex-wrap: wrap; gap: .4rem .9rem; color: var(--muted); font-size: .67rem; line-height: 1.7; }
.s6-financial-core h3 { margin: 1rem 0 .35rem; }
@media (max-width: 820px) { .financial-meta { display: grid; gap: .2rem; } }
