:root {
  color-scheme: light;
  --navy-950: #0b1a2b;
  --navy-900: #10243b;
  --navy-800: #18334f;
  --navy-700: #244867;
  --teal-700: #087f8c;
  --teal-600: #0b9aa3;
  --teal-100: #dff5f3;
  --page: #f3f7fa;
  --surface: #ffffff;
  --surface-soft: #f8fbfc;
  --line: #e2eaf0;
  --text: #16283b;
  --muted: #718296;
  --danger: #b42332;
  --shadow: 0 8px 26px rgb(16 36 59 / 6%);
  font-family: Tahoma, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--page); }
body { margin: 0; min-height: 100vh; background: var(--page); color: var(--text); direction: rtl; }
a { color: var(--teal-700); text-decoration: none; }
a:hover { color: var(--navy-700); text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  min-height: 72px; padding: 10px 26px; color: #fff; background: var(--navy-900);
  box-shadow: 0 4px 18px rgb(11 26 43 / 16%);
}
.brand, .auth-brand { display: inline-flex; align-items: center; gap: 11px; color: #fff; }
.brand:hover, .auth-brand:hover { color: #fff; text-decoration: none; }
.brand strong, .auth-brand strong { display: block; font-size: 16px; letter-spacing: .15px; }
.brand small, .auth-brand small { display: block; margin-top: 3px; color: #b8c9d8; font-size: 11px; }
.brand-mark { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 12px; color: #08333a; background: #5de0d4; font-size: 21px; }
.topbar-user { display: flex; align-items: center; gap: 17px; margin-right: auto; }
.topbar-user form { margin: 0; }
.topbar-greeting { color: #d7e4ee; font-size: 13px; }
.menu-toggle { display: none; }

.app-shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 25px; max-width: 1600px; margin: 0 auto; padding: 25px 26px 40px; }
.sidebar { align-self: start; position: sticky; top: 96px; min-height: 430px; padding: 17px 13px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.sidebar-profile { display: flex; align-items: center; gap: 11px; padding: 7px 7px 19px; border-bottom: 1px solid var(--line); }
.avatar { display: grid; flex: 0 0 42px; width: 42px; height: 42px; place-items: center; border-radius: 14px; color: var(--navy-900); background: var(--teal-100); font-size: 19px; font-weight: 700; }
.profile-copy { min-width: 0; }
.profile-copy strong, .profile-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-copy strong { font-size: 13px; }
.profile-copy span { margin-top: 5px; color: var(--muted); font-size: 11px; }
.sidebar-nav { padding-top: 13px; }
.nav-caption { display: block; padding: 8px 10px 6px; color: #91a0b0; font-size: 10px; font-weight: 700; letter-spacing: .5px; }
.nav-caption-spaced { margin-top: 15px; }
.nav-link { display: flex; align-items: center; gap: 11px; min-height: 43px; margin: 3px 0; padding: 9px 11px; border-radius: 10px; color: #40546a; font-size: 13px; transition: color .15s ease, background .15s ease; }
.nav-link:hover { color: var(--navy-900); background: #f1f7f9; text-decoration: none; }
.nav-link.is-active { color: #075c66; background: #e3f6f4; font-weight: 700; }
.nav-icon { display: inline-grid; width: 23px; height: 23px; place-items: center; border-radius: 7px; color: var(--teal-700); background: #edf8f7; font-size: 15px; }
.sidebar-note { margin: 21px 5px 0; padding: 12px 11px; border-radius: 11px; color: #607487; background: var(--surface-soft); font-size: 11px; line-height: 1.8; }
.main-content { min-width: 0; }
.content-heading { display: flex; flex-direction: column; gap: 5px; margin: 1px 0 19px; }
.content-heading h1 { margin: 0; color: var(--navy-900); font-size: 23px; line-height: 1.35; }
.heading-kicker { color: var(--muted); font-size: 11px; }
.sidebar-backdrop { display: none; }

.auth-shell { width: min(100% - 32px, 520px); margin: clamp(30px, 9vh, 90px) auto; }
.auth-brand { margin: 0 0 20px; padding: 13px 16px; border-radius: 16px; background: var(--navy-900); box-shadow: var(--shadow); }
.auth-shell .card { padding: 24px; }
.form-card { max-width: 920px; }
.form-card h2, .data-section h2, .error-card h2 { margin: 0; color: var(--navy-900); font-size: 17px; }
.form-card h3 { color: var(--navy-800); font-size: 14px; }
.project-titlebar { align-items: center; }
.project-subtitle { margin: 0; color: #53687c; font-size: 13px; font-weight: 700; }
.project-subtitle span, .worker-summary .muted span { padding: 0 5px; color: #a3b0bc; }
.overview-facts { display: flex; flex-wrap: wrap; gap: 10px 24px; color: #425970; font-size: 13px; }
.overview-facts b { color: var(--navy-900); }
.project-overview > .muted { margin: 12px 0; line-height: 1.7; }
.table-actions { display: flex; flex-wrap: wrap; gap: 5px 10px; min-width: 185px; }
.table-actions a { font-size: 11px; white-space: nowrap; }
.worker-summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.worker-summary h2 { margin: 5px 0; color: var(--navy-900); font-size: 20px; }
.worker-summary p { margin: 0; }
.update-details { direction: ltr; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; padding: 14px; border-radius: 10px; color: #263b50; background: #f4f8fa; font-size: 11px; line-height: 1.6; }
.status-card code { direction: ltr; unicode-bidi: isolate; color: var(--navy-800); font-size: 11px; }
.error-card { padding: 28px; }
.error-card p { margin: 9px 0 19px; color: var(--muted); }
.error-code { display: inline-block; margin-bottom: 7px; color: var(--teal-700); font-size: 12px; font-weight: 700; letter-spacing: 2px; }

.pagehead { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 0 0 15px; }
.pagehead h2, .pagehead h3 { margin: 0; color: var(--navy-900); }
.card { min-width: 0; margin-bottom: 16px; padding: 19px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 14px; }
.grid > .card { position: relative; overflow: hidden; min-height: 115px; }
.grid > .card::before { position: absolute; top: 0; right: 0; width: 4px; height: 100%; background: var(--teal-600); content: ""; }
.metric { margin-top: 10px; color: var(--navy-900); font-size: 25px; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-card { display: flex; flex-direction: column; align-items: flex-start; }
.stat-label { color: #53687c; font-size: 12px; font-weight: 700; }
.stat-hint { margin-top: auto; padding-top: 8px; color: #8797a7; font-size: 10px; line-height: 1.5; }
.stat-card-highlight { background: linear-gradient(135deg, #effbfa, #fff 72%); }
.stat-card-highlight::before { background: var(--navy-700) !important; }
.status-pill { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 30px; color: #526579; background: #edf2f6; font-size: 10px; white-space: nowrap; }
.status-active { color: #08705f; background: #e0f5ee; }
.status-completed { color: #08717b; background: #e1f5f5; }
.status-paused { color: #8a5a00; background: #fff3d6; }
.status-cancelled { color: #9c3340; background: #fbe9eb; }
.table-action { display: inline-flex; padding: 5px 8px; border-radius: 7px; background: #e8f6f4; font-size: 11px; }
.table-action:hover { text-decoration: none; background: #d5eeeb; }
.empty-state { margin: 0; padding: 14px 4px; color: var(--muted); font-size: 13px; }
.page-actions { margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 12px; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; padding: 5px 10px; border-radius: 30px; color: #08717b; background: var(--teal-100); font-size: 11px; }

label { display: block; margin: 12px 0 6px; color: #32495e; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid #d3dee7; border-radius: 9px; outline: 0; color: var(--text); background: #fff; font-size: 13px; }
input:focus, select:focus, textarea:focus { border-color: var(--teal-600); box-shadow: 0 0 0 3px rgb(11 154 163 / 12%); }
textarea { min-height: 90px; resize: vertical; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 13px; }
.filters { display: grid; grid-template-columns: minmax(220px, 2fr) minmax(150px, 1fr) auto; align-items: end; gap: 11px; }
.filters label { margin-top: 0; }

button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 9px 15px; border: 1px solid transparent; border-radius: 9px; color: #fff; background: var(--teal-700); cursor: pointer; font-size: 13px; font-weight: 700; transition: background .15s ease, transform .15s ease; }
button:hover, .btn:hover { color: #fff; background: #076a75; text-decoration: none; }
button:active, .btn:active { transform: translateY(1px); }
.btn-small { min-height: 33px; padding: 6px 11px; font-size: 11px; }
.btn-light { color: var(--navy-900); background: #edf3f6; }
.btn-light:hover { color: var(--navy-900); background: #dfe9ee; }
.btn-quiet { border-color: #456078; color: #f5fbff; background: #203a54; }
.btn-quiet:hover { color: #fff; background: #2b4966; }
.btn-danger { background: var(--danger); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.flash { margin: 0 0 14px; padding: 12px 14px; border: 1px solid #f0dda7; border-radius: 10px; color: #634b13; background: #fff7df; font-size: 13px; }
.footer-note { margin: 12px 2px; color: var(--muted); font-size: 11px; }

.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; }
table { width: 100%; border-collapse: collapse; min-width: 650px; background: var(--surface); }
th, td { padding: 12px 13px; border-bottom: 1px solid #eaf0f4; text-align: right; vertical-align: middle; font-size: 12px; }
th { color: #43596d; background: #f3f8fa; font-size: 11px; font-weight: 700; white-space: nowrap; }
tbody tr:last-child td, tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fbfefe; }
td a { font-weight: 600; }
pre { max-width: 100%; overflow: auto; border: 1px solid var(--line); }

@media (max-width: 1000px) {
  .app-shell { grid-template-columns: 220px minmax(0, 1fr); gap: 17px; padding-inline: 17px; }
  .sidebar { padding-inline: 10px; }
  .grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
@media (max-width: 760px) {
  .topbar { min-height: 64px; padding: 9px 15px; }
  .menu-toggle { display: flex; flex: 0 0 38px; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 38px; height: 38px; padding: 7px; border: 1px solid #456078; border-radius: 10px; background: #1a344e; }
  .menu-toggle:hover { background: #24435f; }
  .menu-toggle span { width: 17px; height: 2px; border-radius: 2px; background: #fff; }
  .brand-mark { width: 36px; height: 36px; }
  .brand strong { font-size: 14px; }
  .brand small { font-size: 10px; }
  .topbar-greeting { display: none; }
  .app-shell { display: block; padding: 17px 13px 30px; }
  .sidebar { position: fixed; z-index: 31; top: 0; right: 0; bottom: 0; width: min(300px, 84vw); min-height: 0; overflow-y: auto; border: 0; border-radius: 0; transform: translateX(105%); transition: transform .2s ease; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; z-index: 30; inset: 0; display: block; visibility: hidden; border: 0; border-radius: 0; opacity: 0; background: rgb(8 22 37 / 48%); transition: opacity .2s ease, visibility .2s ease; }
  body.sidebar-open .sidebar-backdrop { visibility: visible; opacity: 1; }
  .content-heading { margin-bottom: 14px; }
  .content-heading h1 { font-size: 21px; }
}
@media (max-width: 540px) {
  .topbar { gap: 10px; }
  .brand { gap: 8px; }
  .topbar-user { gap: 0; }
  .app-shell { padding-inline: 10px; }
  .card { padding: 14px; border-radius: 13px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .grid > .card { min-height: 100px; padding: 13px 11px; font-size: 12px; }
  .metric { font-size: 19px; }
  .pagehead h2 { font-size: 18px; }
  .worker-summary { align-items: flex-start; flex-direction: column; }
  .worker-summary .btn { width: 100%; }
  .filters { grid-template-columns: 1fr; }
  .filters button { width: 100%; }
  .two { grid-template-columns: 1fr; gap: 0; }
  .actions .btn { flex: 1 1 145px; }
  .auth-shell { width: min(100% - 20px, 520px); margin-top: 32px; }
  .auth-shell .card { padding: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}


/* Project archive */
.pagehead-actions { margin: 0; }
.archive-intro { display: flex; align-items: center; gap: 15px; margin: 0 0 18px; padding: 20px 22px; border: 1px solid #dce9ed; border-radius: 16px; background: linear-gradient(115deg, #e8f7f5 0%, #fff 62%); box-shadow: var(--shadow); }
.archive-intro-mark { display: grid; flex: 0 0 48px; width: 48px; height: 48px; place-items: center; border-radius: 15px; color: #075c66; background: #d4f0ec; font-size: 23px; }
.archive-intro h2 { margin: 0; color: var(--navy-900); font-size: 17px; }
.archive-intro p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.archive-count { margin-right: auto; padding: 7px 11px; border: 1px solid #cbe8e4; border-radius: 30px; color: #075c66; background: #f5fcfb; font-size: 11px; font-weight: 700; white-space: nowrap; }
.archive-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 15px; }
.archive-card { margin: 0; padding: 19px; }
.archive-card-head, .archive-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.archive-card h3 { margin: 4px 0 0; color: var(--navy-900); font-size: 18px; }
.archive-label { color: var(--teal-700); font-size: 10px; font-weight: 700; }
.archive-date { color: var(--muted); font-size: 10px; direction: ltr; }
.archive-meta { margin: 12px 0 16px; color: #607487; font-size: 12px; }
.archive-meta span { padding: 0 4px; color: #a3b0bc; }
.archive-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.archive-totals > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; padding: 11px; border: 1px solid #e8eef2; border-radius: 10px; background: #f9fbfc; }
.archive-totals span { color: #718296; font-size: 10px; }
.archive-totals strong { color: var(--navy-900); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.archive-card-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.archive-card-foot form { margin: 0; }
.archive-card-foot .btn-danger { min-height: 36px; padding: 7px 12px; font-size: 11px; }
.archive-empty { display: grid; justify-items: center; gap: 8px; padding: 38px 20px; text-align: center; }
.archive-empty-icon { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 50%; color: #08705f; background: #e0f5ee; font-size: 20px; }
.archive-empty h2 { margin: 2px 0 0; color: var(--navy-900); font-size: 17px; }
.archive-empty p { margin: 0 0 9px; color: var(--muted); font-size: 12px; }
@media (max-width: 540px) { .archive-intro { align-items: flex-start; padding: 16px; } .archive-intro-mark { flex-basis: 40px; width: 40px; height: 40px; } .archive-count { align-self: center; padding: 6px 8px; } .archive-card-foot { align-items: flex-start; flex-direction: column; } .archive-card-foot form, .archive-card-foot button { width: 100%; } .archive-totals > div { align-items: flex-start; flex-direction: column; } }


/* Accounting */
.accounting-intro { display:flex; align-items:center; justify-content:space-between; gap:15px; margin-bottom:16px; padding:20px; border:1px solid var(--line); border-radius:16px; background:linear-gradient(115deg,#e8f7f5,#fff 68%); }
.accounting-intro h2 { margin:4px 0; color:var(--navy-900); font-size:20px; }
.accounting-intro p { margin:0; color:var(--muted); font-size:12px; }
.accounting-mark { display:grid; place-items:center; width:54px; height:54px; border-radius:16px; color:#075c66; background:#d4f0ec; font-weight:800; }
.accounting-accounts { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.accounting-account { margin:0 0 16px; }
.accounting-account-head { display:flex; align-items:center; gap:12px; }
.accounting-icon { display:grid; place-items:center; width:43px; height:43px; border-radius:13px; color:var(--teal-700); background:var(--teal-100); font-size:20px; }
.accounting-account h3 { margin:3px 0 0; color:var(--navy-900); font-size:15px; }
.accounting-balance { margin:17px 0 8px; color:var(--navy-900); font-size:27px; font-weight:800; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.accounting-balance small { color:var(--muted); font-size:12px; }
.accounting-meta { margin-top:5px; color:var(--muted); font-size:11px; }
.accounting-details { margin-top:15px; padding-top:12px; border-top:1px solid var(--line); }
.accounting-details summary { color:var(--teal-700); cursor:pointer; font-size:12px; font-weight:700; }
.accounting-details form { margin-top:12px; }
.accounting-locked { margin:13px 0 0; color:var(--muted); font-size:11px; }
.accounting-forms { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.accounting-forms > .card { min-width:0; }
.accounting-forms h3,.accounting-ledger h3 { margin:0 0 13px; color:var(--navy-900); font-size:16px; }
.accounting-forms .muted { font-size:11px; line-height:1.7; }
.accounting-filters { grid-template-columns:repeat(3,minmax(0,1fr)) auto auto; margin:14px 0; }
.accounting-direction { display:inline-block; padding:5px 9px; border-radius:20px; font-size:10px; font-weight:700; }
.accounting-direction.is-in { color:#08705f; background:#e0f5ee; }
.accounting-direction.is-out { color:#a12b36; background:#fdebed; }
.accounting-ref { color:var(--muted); }
@media(max-width:760px) {
  .accounting-accounts,.accounting-forms { grid-template-columns:1fr; gap:0; }
  .accounting-filters { grid-template-columns:1fr; }
  .accounting-filters > * { width:100%; }
  .accounting-intro { padding:15px; }
  .accounting-balance { font-size:24px; }
}
