/* شكل الإصدار 2.6.1 فوق محتوى 1.33. لا يغيّر الحقول ولا البحث ولا البيانات. */
:root {
  color-scheme: light;
  --ink: #16211c;
  --muted: #55655c;
  --green: #1f6f4a;
  --green2: #17573a;
  --pale: #e4efe9;
  --gold: #8a5a00;
  --line: #dde3df;
  --border: #c2ccc6;
  --white: #ffffff;
  --bg: #f4f6f5;
  --danger: #a4262c;
  --surface: #ffffff;
  --surface-soft: #eceef0;
  --surface-alt: #f0f3f1;
  --accent: #1f6f4a;
  --service-accent: #1f6f4a;
  --focus: #1f6f4a;
  --brand-dark: #1f6f4a;
  --brand-olive: #1f6f4a;
  --shadow: 0 1px 2px rgba(20, 32, 26, .07);
  --shadow-lg: 0 12px 32px rgba(20, 32, 26, .16);
  --radius: 10px;
  --font-ui: "Segoe UI", "Noto Sans Arabic", "Dubai", Tahoma, Arial, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f0f4f1;
  --muted: #9aa8a0;
  --green: #4fae7c;
  --green2: #6bc294;
  --pale: #1f3a2c;
  --gold: #d9a541;
  --line: #2c3830;
  --border: #3d4c43;
  --white: #1a221e;
  --bg: #121815;
  --danger: #e8848a;
  --surface: #1a221e;
  --surface-soft: #0e1310;
  --surface-alt: #253029;
  --accent: #4fae7c;
  --service-accent: #4fae7c;
  --focus: #5cc08c;
  --brand-dark: #4fae7c;
  --brand-olive: #4fae7c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 14px 36px rgba(0, 0, 0, .6);
}

html {
  font-family: var(--font-ui);
  line-height: 1.55;
  font-size: 15px;
}
html body,
button, input, select, textarea,
h1, h2, h3, h4, h5, h6,
.sidebar .brand b {
  font-family: var(--font-ui);
  font-weight: 550;
}
html body { font-size: 15px; color: var(--ink); background: var(--bg); }
h1 { font-size: 1.25rem; font-weight: 650; }
h2, .topbar h2 { font-size: 1.15rem; font-weight: 650; }
h3, .panel-head h3, h4 { font-size: 1rem; font-weight: 650; }
label, .filters label, .sidebar nav button, table, th,
.panel p, .panel-head p, small, .stat small, .stat span,
.eyebrow, .type-tag, .status-badge, .cell-actions button,
.ui-toolbar button, .auth-card small, .topbar .eyebrow {
  font-size: inherit;
}
button, input, select, textarea { font-size: 15px; }
.topbar .eyebrow { font-size: .8rem; color: var(--muted); letter-spacing: 0; margin: 0; }
.eyebrow { letter-spacing: 0; color: var(--muted); font-size: .75rem; font-weight: 650; }

input, select, textarea {
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  line-height: 1.45;
}
textarea { min-height: 76px; }
input:focus, select:focus, textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent);
}
button { min-height: 36px; border-radius: 6px; font-weight: 600; }
.primary, .language-switch button.active {
  background: var(--green);
  color: #fff;
  border: 1px solid var(--green);
}
.primary:hover, .language-switch button.active:hover { background: var(--green2); }
.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}
.secondary:hover { background: var(--surface-alt); }
.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.link { color: var(--green); }

.app { grid-template-columns: 248px minmax(0, 1fr); }
.sidebar {
  background: var(--surface);
  color: var(--ink);
  border-inline-end: 1px solid var(--line);
  padding: 0 8px 16px;
}
.sidebar .brand {
  flex-direction: row;
  align-items: center;
  text-align: start;
  gap: 12px;
  padding: 16px 12px;
  border-bottom: 1px solid var(--line);
}
.sidebar .brand b { font-size: .95rem; }
.sidebar .brand small { font-size: .72rem; color: var(--muted); }
.office-logo-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.sidebar .office-logo-panel { width: 56px; }
.sidebar .office-logo { width: 56px; height: auto; object-fit: contain; }
.auth-logo, .auth-logo .office-logo { width: 72px; }
.sidebar nav { margin-top: 8px; gap: 2px; }
.sidebar nav button {
  color: var(--ink);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: .95rem;
  font-weight: 500;
  text-align: start;
}
.sidebar nav button::before { opacity: .75; }
.sidebar nav button:hover { background: var(--surface-alt); color: var(--ink); }
.sidebar nav button.active,
.sidebar nav button.active:hover {
  background: var(--pale);
  color: var(--green2);
  box-shadow: none;
  font-weight: 650;
}
.sidebar-foot { border-top: 1px solid var(--line); padding-top: 12px; }
.sidebar #logoutBtn, .sidebar-foot .ghost { color: var(--ink); width: 100%; }
.user-role { color: var(--muted); }

@media screen and (min-width: 761px) {
  .sidebar { width: 248px; background: var(--surface); color: var(--ink); }
}

.topbar {
  min-height: 60px;
  height: auto;
  padding: 10px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}
.local-pill {
  background: var(--surface-soft);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 600;
}
.ui-toolbar button {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink);
}

.view { padding: 24px; }
.hero {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 16px 20px;
}
.hero::after { display: none; }
.hero h3 { color: var(--ink); font-size: 1.15rem; margin: 0 0 4px; }
.hero p, .hero .eyebrow { color: var(--muted); }
.hero .primary { background: var(--green); color: #fff; }

.stats { gap: 12px; margin: 16px 0; }
.stat, .task-stat, .custody-chip, .fund-card, #custodyView .fund-card {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-block-start: 1px solid var(--line);
  border-inline-start: 3px solid var(--green);
  box-shadow: var(--shadow);
  padding: 16px;
}
.stat b, .task-stat b, .fund-card b, .custody-chip b {
  font-family: var(--font-ui);
  font-size: 1.5rem;
  font-weight: 650;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.fund-card small, .fund-card p, .custody-chip small, #custodyView .fund-card small, #custodyView .fund-card p { color: var(--muted); }
.custody-chip.custody-total { border: 1px solid var(--line); border-inline-start: 3px solid var(--green); background: var(--surface); }
#stats .stat-link:hover:not(:disabled) { transform: none; border-color: var(--green); background: var(--pale); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.panel-head { margin-bottom: 16px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.filters, .task-filters, #filters, #reportFilters {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  gap: 12px;
}
.task-filters { align-items: end; padding-bottom: 16px; }
.task-filters > button, .task-filters input, .task-filters select { height: 36px; min-height: 36px; }
.monthly-hint {
  margin: 0 0 16px;
  padding: 12px 14px;
  background: var(--pale);
  border: 0;
  border-inline-start: 3px solid var(--green);
  border-radius: 6px;
  color: var(--ink);
}

.table-wrap { border: 0; border-radius: 0; }
th {
  background: var(--surface-soft);
  color: var(--ink);
  font-size: .8rem;
  font-weight: 650;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
td { padding: 9px 12px; border-top: 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
tbody tr:nth-child(even) td { background: transparent; }
tbody tr:hover td { background: var(--surface-alt); }
.amount { font-variant-numeric: tabular-nums; }

.type-tag, .status-badge, .task-status {
  border-radius: 999px;
  padding: 2px 9px;
  font-size: .76rem;
  font-weight: 650;
  background: var(--pale);
  color: var(--green);
}
.task-status.in_progress, .task-row-status.in_progress { background: #e6eff7; color: #1f5d8f; }
.task-status.completed, .task-row-status.completed { background: #e3f2e9; color: #1a7a4c; }
.task-status.suspended, .task-row-status.suspended { background: #fdf3d8; color: #7a5c00; }
:root[data-theme="dark"] .task-status.in_progress,
:root[data-theme="dark"] .task-row-status.in_progress { background: #16293a; color: #6aaede; }
:root[data-theme="dark"] .task-status.completed,
:root[data-theme="dark"] .task-row-status.completed { background: #1b3527; color: #58bd86; }
:root[data-theme="dark"] .task-status.suspended,
:root[data-theme="dark"] .task-row-status.suspended { background: #332a12; color: #d4b04a; }

.report-choices { gap: 12px; }
.report-choices button {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  font-size: .95rem;
  font-weight: 650;
}
.report-choices button span { font-size: .78rem; color: var(--muted); font-weight: 450; }
.report-choices button.selected { background: var(--pale); border-color: var(--green); color: var(--green2); }

.auth-screen {
  background: var(--bg);
}
.auth-card {
  border: 1px solid var(--line);
  border-top: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 28px 28px 24px;
  text-align: center;
}
.auth-card h1 { font-size: 1.25rem; }
.auth-card .eyebrow { color: var(--muted); }
.language-switch { border-radius: 8px; box-shadow: none; background: var(--surface); }

dialog, .task-dialog, .service-dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  background: var(--surface);
  color: var(--ink);
}
dialog::backdrop, .task-dialog::backdrop, .service-dialog::backdrop { background: rgba(10, 18, 14, .5); }
.dialog-head { background: var(--surface); border-bottom: 1px solid var(--line); }

.toast {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--green);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
}
.toast.error { background: var(--surface); border-inline-start-color: var(--danger); color: var(--ink); }

.subgrid, .attachment-add, .permission-fieldset, .check-label {
  background: var(--surface-soft);
  border-color: var(--line);
  border-radius: 10px;
}
.form-panel { max-width: 960px; }

@media (max-width: 760px) {
  .topbar h2 { font-size: 1.05rem; }
  .panel-head h3 { font-size: 1rem; }
  .hero h3 { font-size: 1.1rem; }
  .sidebar nav button, .ui-toolbar button { font-size: .95rem; }
  .view { padding: 12px; }
}

@media print {
  .hero::after { display: none; }
  .panel, .stat, .hero { box-shadow: none; }
}
