:root {
  --ink: #11161c;
  --ink-2: #20262d;
  --ivory: #fcfaf6;
  --paper: #ffffff;
  --gold: #c8a15a;
  --gold-dark: #8e6b2d;
  --muted: #737a7d;
  --line: #e6dfd2;
  --soft: #f3efe7;
  --success: #1d7452;
  --shadow: 0 22px 60px rgba(17, 22, 28, .08);
}

* { box-sizing: border-box; }
html { background: var(--ivory); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--ivory);
  font-family: "Noto Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;
  text-rendering: optimizeLegibility;
}
button, textarea, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 3px solid var(--gold-dark); outline-offset: 3px; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 10;
  width: 252px;
  padding: 30px 22px;
  display: flex;
  flex-direction: column;
  color: white;
  background:
    radial-gradient(circle at 20% 0%, rgba(200, 161, 90, .11), transparent 33%),
    var(--ink);
}
.brand { width: 175px; max-height: 60px; object-fit: contain; object-position: right center; filter: invert(1); }
.nav-list { display: grid; gap: 9px; margin-top: 54px; }
.nav-item {
  width: 100%;
  padding: 13px 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 14px;
  color: #bbc1c3;
  background: transparent;
  text-align: right;
}
.nav-item:hover, .nav-item.is-active { color: white; border-color: rgba(200,161,90,.28); background: rgba(255,255,255,.07); }
.nav-item.is-active::after { content: ""; width: 3px; height: 22px; margin-right: auto; border-radius: 8px; background: var(--gold); }
.nav-icon { width: 24px; color: var(--gold); font-size: 18px; text-align: center; }
.sidebar-foot { margin-top: auto; color: #9fa8aa; font-size: 12px; line-height: 1.8; }
.sidebar-foot span { color: #717a7d; }
.logout-button { color: white; border-color: #596066; }
.logout-button:hover { color: var(--ink); }
.security-pill { display: inline-flex; gap: 8px; align-items: center; margin-bottom: 18px; padding: 7px 10px; border-radius: 99px; color: #d7dfdc; background: rgba(255,255,255,.07); }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: #58ca92; box-shadow: 0 0 0 4px rgba(88,202,146,.12); }

.main { min-height: 100vh; margin-right: 252px; padding: 42px clamp(24px, 4vw, 64px) 70px; }
.view { display: none; animation: fade .22s ease; }
.view.is-visible { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } }
.mobile-header, .mobile-nav { display: none; }
.page-header { display: flex; justify-content: space-between; gap: 26px; align-items: flex-end; margin-bottom: 26px; }
.page-header.compact { align-items: center; }
.page-header h1 { margin: 4px 0; font-size: clamp(28px, 4vw, 44px); line-height: 1.25; letter-spacing: -.8px; }
.page-header p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--gold-dark); font-size: 11px; font-weight: 800; letter-spacing: 1.8px; }
.header-actions { display: flex; gap: 10px; }
.primary-button, .ghost-button, .light-button {
  min-height: 44px;
  padding: 10px 17px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 750;
}
.primary-button { color: white; background: var(--ink); box-shadow: 0 8px 20px rgba(17,22,28,.13); }
.primary-button:hover { background: #252d35; }
.ghost-button { color: var(--ink); border-color: var(--line); background: transparent; }
.ghost-button:hover { background: white; }
.light-button { color: var(--ink); background: white; }

.status-banner {
  margin-bottom: 22px;
  padding: 14px 17px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid #d8e9e1;
  border-radius: 15px;
  background: #f1f8f4;
}
.status-banner strong, .status-banner span { display: block; }
.status-banner span { color: #61736b; font-size: 12px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px rgba(29,116,82,.11); }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { min-height: 142px; padding: 20px; border: 1px solid var(--line); border-radius: 19px; background: rgba(255,255,255,.72); }
.stat-card > span, .stat-card small { display: block; color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin: 16px 0 1px; font-size: clamp(26px, 3vw, 38px); line-height: 1; }
.stat-card-dark { color: white; border-color: var(--ink); background: var(--ink); }
.stat-card-dark > span, .stat-card-dark small { color: #aeb7b9; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, .8fr); gap: 18px; }
.panel { padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.83); box-shadow: 0 18px 50px rgba(17,22,28,.035); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.panel-heading h2 { margin: 3px 0 0; font-size: 21px; }
.count-badge { min-width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--ink); font-size: 12px; }
.project-card { padding: 17px 0; border-top: 1px solid var(--line); }
.project-card:first-child { padding-top: 0; border-top: 0; }
.project-top { display: flex; justify-content: space-between; gap: 16px; }
.project-card h3 { margin: 0 0 5px; font-size: 16px; }
.project-card p { margin: 0; color: var(--muted); font-size: 12px; }
.project-status { padding: 5px 9px; border-radius: 99px; color: var(--gold-dark); background: #f6ecda; font-size: 11px; white-space: nowrap; }
.progress-row { display: flex; gap: 12px; align-items: center; margin-top: 14px; }
.progress-track { flex: 1; height: 8px; overflow: hidden; appearance: none; border: 0; border-radius: 99px; color: var(--gold-dark); background: var(--soft); }
.progress-track::-webkit-progress-bar { background: var(--soft); }
.progress-track::-webkit-progress-value { border-radius: 99px; background: var(--gold-dark); }
.progress-track::-moz-progress-bar { border-radius: 99px; background: var(--gold-dark); }
.progress-row span { min-width: 35px; direction: ltr; font-size: 11px; font-weight: 700; }
.payment-row { display: flex; gap: 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.payment-row:first-child { padding-top: 0; border-top: 0; }
.payment-logo { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; color: white; background: var(--ink); font-weight: 800; }
.payment-copy { flex: 1; }
.payment-copy strong, .payment-copy span { display: block; }
.payment-copy span { color: var(--muted); font-size: 11px; }
.payment-value { direction: ltr; text-align: left; font-weight: 800; }
.skeleton { height: 70px; border-radius: 13px; background: linear-gradient(90deg, #f4f1eb, #fbfaf7, #f4f1eb); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton.tall { height: 160px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.assistant-teaser { margin-top: 18px; padding: 24px; display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; overflow: hidden; border-radius: 20px; color: white; background: radial-gradient(circle at 15% 15%, rgba(200,161,90,.22), transparent 30%), var(--ink); }
.assistant-teaser .eyebrow { color: #d8bc82; }
.assistant-teaser h2 { margin: 4px 0; }
.assistant-teaser p { margin: 0; color: #afb7b9; }
.assistant-mark { width: 52px; height: 52px; display: grid; place-items: center; border: 1px solid rgba(200,161,90,.45); border-radius: 16px; color: var(--gold); font-size: 25px; }

.assistant-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; min-height: 620px; }
.assistant-context, .chat-panel { border: 1px solid var(--line); border-radius: 20px; background: white; }
.assistant-context { padding: 25px; }
.assistant-orb { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; color: white; background: var(--ink); font-size: 25px; font-weight: 800; }
.assistant-context h2 { margin: 18px 0 7px; }
.assistant-context p { color: var(--muted); font-size: 13px; line-height: 1.8; }
.context-rule { height: 1px; margin: 22px 0; background: var(--line); }
.prompt-chip { width: 100%; margin-top: 9px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; color: var(--ink); background: var(--ivory); text-align: right; font-size: 12px; }
.chat-panel { min-height: 600px; display: flex; flex-direction: column; overflow: hidden; }
.chat-messages { flex: 1; padding: 25px; overflow-y: auto; }
.message { max-width: 78%; margin-bottom: 15px; padding: 13px 15px; border-radius: 15px; }
.message span { display: block; margin-bottom: 4px; color: var(--gold-dark); font-size: 10px; font-weight: 800; }
.message p { margin: 0; white-space: pre-wrap; line-height: 1.75; }
.assistant-message { margin-left: auto; background: var(--soft); }
.user-message { margin-right: auto; color: white; background: var(--ink); }
.user-message span { color: #d9bd85; }
.composer { padding: 15px; display: flex; gap: 10px; border-top: 1px solid var(--line); background: var(--ivory); }
.composer textarea { flex: 1; min-height: 50px; max-height: 130px; resize: vertical; padding: 12px; border: 1px solid var(--line); border-radius: 12px; outline: none; background: white; }
.composer textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200,161,90,.12); }

.data-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.data-card { min-height: 210px; padding: 25px; border: 1px solid var(--line); border-radius: 20px; background: white; }
.data-card > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: white; background: var(--ink); font-size: 11px; }
.data-card h2 { margin: 28px 0 8px; }
.data-card p { color: var(--muted); line-height: 1.8; }

.access-dialog { width: min(430px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 22px; box-shadow: var(--shadow); }
.access-dialog::backdrop { background: rgba(17,22,28,.72); backdrop-filter: blur(5px); }
.access-dialog form { padding: 30px; }
.access-dialog h2 { margin: 7px 0; }
.access-dialog p { color: var(--muted); line-height: 1.7; }
.access-dialog label { display: block; margin: 18px 0 6px; font-size: 12px; font-weight: 700; }
.access-dialog input { width: 100%; height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; direction: ltr; }
.access-dialog .primary-button { width: 100%; margin-top: 12px; }
.form-error { min-height: 20px; margin-top: 5px; color: #aa2b2b; font-size: 12px; }

.inquiry-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.inquiry-summary h2, .inquiry-head h2 { margin: 0; font-size: 1.2rem; }
.inquiry-summary p, .inquiry-head p, .inquiry-meta { margin: 6px 0 0; color: #565e61; overflow-wrap: anywhere; }
.inquiries-list { display: grid; gap: 14px; }
.inquiry-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.inquiry-meta { margin-top: 14px; font-size: .875rem; }
.inquiry-brief { margin: 16px 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; }
.inquiry-actions { display: flex; flex-wrap: wrap; align-items: end; column-gap: 12px; row-gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.inquiry-actions label, .records-field { display: grid; gap: 7px; font-size: .9rem; color: var(--ink); }
.inquiry-actions label { min-width: 155px; }
.inquiry-actions select, .records-field input, .records-field select, .records-field textarea {
  width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: white;
}
.inquiry-actions .form-error, .records-feedback { font-size: .875rem; }
.conversion-details, .conversion-result { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.conversion-details summary { cursor: pointer; font-weight: 700; }
.conversion-details form { margin-top: 12px; }
.conversion-result p { margin-top: 0; }
.data-section-tabs { margin-bottom: 18px; }
#commercialRoot .records-item { scroll-margin-top: 18px; }
.records-panel { display: grid; gap: 18px; }
.records-toolbar, .records-tabs, .records-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.records-toolbar { justify-content: space-between; }
.records-tabs button[aria-pressed='true'] { color: white; background: var(--ink); }
.records-list { display: grid; gap: 8px; }
.records-item { padding: 14px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.records-item h3, .records-item p, .records-feedback { margin: 0; }
.records-meta { margin-top: 7px; color: #565e61; }
.records-form { padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--ivory); }
.records-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; margin: 12px 0 18px; }
.records-field input, .records-field select, .records-field textarea, .inquiry-actions select { font-size: 1rem; }
.mobile-tools { display: flex; justify-content: flex-end; gap: 6px; }
#documentsRoot { margin-top: 18px; }
.records-actions a.ghost-button { display: inline-flex; align-items: center; text-decoration: none; }
#operationsRoot { display: grid; gap: 18px; }
.rentals-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.rentals-head h2, .rental-card h3 { margin: 0; font-size: 1.2rem; }
.rentals-head p, .rental-access p { margin: 6px 0 0; color: #565e61; line-height: 1.6; }
.rentals-feedback { min-height: 1.3em; margin: 12px 0; color: #565e61; font-size: .9rem; }
.rental-access { display: grid; gap: 10px; margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.rental-key-content { padding: 26px; display: grid; gap: 12px; }
.rental-key-content p { margin: 0; }
.rental-key-content a { color: #735322; text-underline-offset: .16em; }
.rental-key-content input { font-family: ui-monospace, monospace; }
.ops-roles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ops-role { min-height: 120px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: white; text-align: start; }
.ops-role:hover { border-color: var(--gold); }
.ops-role strong, .ops-role span { display: block; }
.ops-role span { margin-top: 7px; color: #565e61; font-size: .875rem; line-height: 1.6; }
.ops-panel h2, .ops-entry h3 { margin: 0; }
.ops-panel h2 { margin-bottom: 16px; font-size: 1.2rem; }
.ops-feedback { color: #595141; }
.ops-feedback:empty { display: none; }
.ops-form, .ops-list { display: grid; gap: 12px; }
.ops-entry { padding: 15px 0; border-top: 1px solid var(--line); }
.ops-entry summary { cursor: pointer; font-weight: 750; }
.ops-entry[open] > summary { margin-bottom: 14px; }
.ops-text { line-height: 1.8; overflow-wrap: anywhere; white-space: pre-wrap; }
.ops-meta { color: #565e61; font-size: .875rem; }
.ops-check { display: flex; align-items: center; min-height: 44px; gap: 12px; }
.ops-check input { width: 20px; height: 20px; accent-color: var(--ink); }
.ops-form > button { justify-self: start; }
.ops-recent { margin-block: 8px 0; padding-inline-start: 22px; color: #565e61; }
.ops-recent li + li { margin-block-start: 6px; }

@media (max-width: 980px) {
  .sidebar { display: none; }
  .main { margin: 0; padding: 18px 18px 100px; }
  .mobile-header { height: 58px; margin-bottom: 22px; display: flex; align-items: center; justify-content: space-between; }
  .mobile-header img { width: 140px; height: 45px; object-fit: contain; object-position: right center; }
  .mobile-nav { position: fixed; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); left: 12px; z-index: 20; height: 66px; padding: 7px; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid rgba(255,255,255,.12); border-radius: 20px; background: rgba(17,22,28,.95); box-shadow: 0 18px 45px rgba(17,22,28,.3); backdrop-filter: blur(14px); }
  .mobile-nav-item { display: grid; place-items: center; gap: 1px; border: 0; border-radius: 13px; color: #b4bec0; background: transparent; font-size: .75rem; }
  .mobile-nav-item span { font-size: 18px; }
  .mobile-nav-item.is-active { color: white; background: rgba(255,255,255,.08); }
  .mobile-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
  .assistant-layout { grid-template-columns: 1fr; }
  .assistant-context { display: none; }
  .chat-panel { min-height: calc(100vh - 220px); }
}

@media (max-width: 620px) {
  .main { padding-inline: 14px; }
  .page-header { align-items: flex-start; }
  .page-header h1 { font-size: 31px; }
  .header-actions { display: none; }
  .stats-grid { gap: 10px; }
  .stat-card { min-height: 125px; padding: 16px; }
  .stat-card strong { font-size: 27px; }
  .panel { padding: 17px; }
  .assistant-teaser { grid-template-columns: auto 1fr; padding: 20px; }
  .assistant-teaser .light-button { grid-column: 1 / -1; }
  .data-grid { grid-template-columns: 1fr; }
  .message { max-width: 91%; }
  .records-fields { grid-template-columns: 1fr; }
  .ops-roles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inquiry-summary { align-items: flex-start; }
  .inquiry-actions label { flex: 1; }
  .page-header.compact { align-items: start; flex-direction: column; gap: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

.finance-panel,
.support-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.finance-panel .stat-card { min-width: 0; overflow-wrap: anywhere; }
.finance-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.finance-head h2,
.finance-list h3,
.support-ticket h3 { margin-block: 0 4px; }
.finance-list { display: grid; gap: 10px; min-width: 0; }
.finance-entry,
.support-ticket { min-width: 0; overflow-wrap: anywhere; }
.finance-filter { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
.finance-filter > * { min-width: 0; flex: 1 1 180px; }
.finance-demo { display: grid; gap: 16px; }
.finance-demo-notice { padding: 12px 16px; border-radius: 10px; border: 1px solid #cda764; background: #fffaef; color: #64410c; }

@media (max-width: 620px) {
  .finance-panel .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finance-panel .stat-card strong { font-size: clamp(17px, 4.8vw, 24px); }
}
