@font-face {
  font-family: Vazirmatn;
  src: url("/assets/vazirmatn-arabic.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;
  --navy: #14345a;
  --navy-deep: #102944;
  --cyan: #01a8ae;
  --text: #172942;
  --muted: #56667b;
  --line: #dce5ed;
  --surface: #f3f6f9;
  --card: #fff;
  --success: #136d57;
  --warning: #81540c;
  --danger: #a32029;
  font: 15px/1.7 Vazirmatn, Tahoma, system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--surface); color: var(--text); }
button, input, select, textarea { font: inherit; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { font-size: clamp(1.45rem, 2.6vw, 2rem); line-height: 1.4; font-weight: 800; }
h2 { font-size: 1.12rem; font-weight: 750; }
h3 { font-size: 1rem; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .58; }
:focus-visible { outline: 3px solid #00868d; outline-offset: 3px; }

.layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { background: var(--navy-deep); padding: 23px 16px; color: white; }
.sidebar-logo { margin: 0 0 24px; padding: 13px 12px; border-radius: 9px; background: white; text-align: center; }
.logo { inline-size: 142px; block-size: auto; vertical-align: middle; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav + nav { margin-block-start: 18px; border-block-start: 1px solid #ffffff33; padding-block-start: 11px; }
.nav-group-label { color: #b7cde0; font-size: .83rem; margin-inline: 14px; }
.sidebar a.nav-link { text-decoration: none; }
.button { border: 1px solid transparent; border-radius: 8px; padding: 8px 14px; font-weight: 650; white-space: nowrap; }
.primary { background: var(--navy); color: white; }
.primary:not(:disabled):hover { background: #0e2948; }
.secondary { background: white; border-color: var(--line); color: var(--navy); }
.secondary:not(:disabled):hover { background: #edf6f8; border-color: #b4d7dc; }
.text-button { background: transparent; color: var(--navy); padding-inline: 8px; }
.text-button:not(:disabled):hover { background: #eaf0f5; }
.nav-link { color: #e8f2fa; background: transparent; text-align: start; border-inline-start: 3px solid transparent; white-space: normal; }
.nav-link[aria-current] { background: #24496a; border-inline-start-color: #45cdd0; color: white; }
.nav-link:hover { background: #24496a; }
.topbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; min-height: 66px; padding: 10px clamp(16px, 4vw, 45px); background: var(--card); border-bottom: 1px solid var(--line); }
.top-title, .identity { display: flex; align-items: center; gap: 10px; min-width: 0; }
.top-title .mark { width: 18px; height: auto; }
.top-title span, .identity span { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.top-title span { border-inline-start: 1px solid var(--line); padding-inline-start: 11px; }
.content, .app-alerts { margin-inline: auto; max-width: 1420px; padding-inline: clamp(16px, 4vw, 45px); }
.content { padding-block: clamp(19px, 3vw, 36px) 45px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 22px; }
.page-heading p { margin-top: 5px; color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.padded { padding: clamp(15px, 2vw, 24px); }
.padded > h2 { margin-bottom: 12px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; inline-size: 100%; text-align: start; }
th, td { padding: 12px 17px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: #f4f7fa; font-size: .87rem; color: var(--muted); font-weight: 700; white-space: nowrap; }
td { white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fbfc; }
.padded .table-wrap { margin-block: 10px 0; border: 1px solid var(--line); border-radius: 8px; }
.pill { display: inline-block; white-space: nowrap; padding: 3px 8px; border-radius: 5px; font-weight: 650; font-size: .84rem; }
.neutral { background: #eaf0f7; color: var(--navy); }
.success { background: #e5f6ef; color: var(--success); }
.waiting { background: #fff1d8; color: var(--warning); }
.danger { color: var(--danger); }
.pager, .section-bar, .form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pager { padding: 10px 16px; border-top: 1px solid var(--line); color: var(--muted); }
.section-bar { justify-content: space-between; margin-bottom: 13px; }
.form-actions { margin-block-start: 12px; }
.form-stack, .panels, .details-stack { display: grid; gap: 16px; }
.fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; margin-block-end: 13px; align-items: start; }
.role-options { display: flex; flex-wrap: wrap; gap: 12px 20px; min-inline-size: 0; margin: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; }
.role-options label { display: flex; align-items: center; gap: 7px; }
.role-options input { inline-size: auto; margin: 0; }
td > .pill + .pill { margin-inline-start: 5px; }
label, .lookup { display: grid; gap: 5px; min-width: 0; }
label > span, .field-name { font-weight: 670; font-size: .92rem; }
input, select, textarea { color: var(--text); inline-size: 100%; min-width: 0; padding: 8px 11px; border: 1px solid #c9d6e3; border-radius: 7px; background: white; }
textarea { resize: vertical; }
input[type="number"] { direction: ltr; text-align: end; }
.search-line { display: flex; gap: 6px; }
.lookup { max-inline-size: 410px; }
.lookup-alert .empty { padding: 2px 0; font-size: .84rem; }
.cut-editor { margin-top: 18px; padding-top: 17px; border-top: 1px solid var(--line); }
.cut-rows { display: grid; gap: 8px; max-width: 600px; }
.cut-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .7fr) auto; gap: 10px; align-items: end; }
.cut-total { display: inline-block; color: var(--navy); margin-top: 12px; }
.facts { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.fact { padding: 9px 10px; background: #f3f7fa; border-radius: 7px; }
.fact dt { color: var(--muted); font-size: .88rem; }
.fact dd, .note { overflow-wrap: anywhere; }
.note { margin-top: 8px; color: var(--muted); white-space: pre-wrap; }
.empty, .loading { padding: 18px; color: var(--muted); }
.padded .empty { padding-inline: 0; }
.error { color: #861e27; background: #fff1f1; border: 1px solid #eebfc3; border-radius: 8px; padding: 10px 13px; margin-block: 7px; }
.login, .access-panel { min-height: 100dvh; }
.login { display: grid; grid-template-columns: minmax(320px, 46%) 1fr; }
.login-panel { width: min(100%, 465px); align-self: center; justify-self: center; padding: 25px; }
.login-panel .logo { margin-bottom: 20px; width: 153px; }
.login-panel p { margin-top: 7px; color: var(--muted); }
.login-fields { display: grid; gap: 12px; margin-top: 23px; }
.login-fields button { width: 100%; }
.login-brand { display: grid; place-content: center; justify-items: center; text-align: center; gap: 10px; color: white; background: var(--navy-deep); padding: 30px; border-inline-start: 6px solid var(--cyan); }
.login-brand h2 { font-size: clamp(1.5rem, 4vw, 2.8rem); }
.login-brand p { color: #d9eaf4; }
.brand-symbol { display: grid; place-items: center; width: 85px; height: 85px; border-radius: 16px; background: white; margin-bottom: 14px; }
.brand-symbol img { width: 43px; }
.access-panel { display: grid; place-content: center; justify-items: center; gap: 14px; padding: 20px; text-align: center; }

@media (max-width: 870px) {
  .layout { grid-template-columns: 177px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 630px) {
  .layout { display: block; }
  .sidebar { padding: 8px 12px; }
  .sidebar-logo { display: none; }
  .sidebar nav { display: flex; gap: 8px; flex-wrap: wrap; }
  .nav-group-label { flex-basis: 100%; }
  .nav-link { font-size: .9rem; }
  .topbar { flex-wrap: wrap; }
  .top-title span { font-size: .82rem; }
  .fields { grid-template-columns: 1fr; }
  .login { grid-template-columns: 1fr; }
  .login-brand { display: none; }
  .content, .app-alerts { padding-inline: 12px; }
  th, td { padding: 10px 12px; }
}
