:root {
  --ink: #233345;
  --ink-2: #31465c;
  --ink-soft: #526579;
  --paper: #f5f3ed;
  --paper-bright: #fffefa;
  --paper-dark: #ece8df;
  --line: #e7e3da;
  --muted: #8a929a;
  --copper: #b5784c;
  --copper-dark: #95603b;
  --copper-pale: #f4e9de;
  --green: #4f806d;
  --green-pale: #e8f1eb;
  --red: #a85249;
  --red-pale: #f7e9e6;
  --blue: #55748b;
  --blue-pale: #e9eff3;
  --shadow: 0 16px 40px rgba(35, 51, 69, .075);
  --radius: 16px;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Cairo", "Noto Sans Arabic", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 19px; height: 19px; display: inline-block; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

/* Brand */
.brand-lockup { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-symbol { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--copper-pale); color: var(--copper-dark); flex: 0 0 auto; }
.brand-symbol .icon { width: 25px; height: 25px; stroke-width: 1.45; }
.brand-name { display: block; font-size: 19px; font-weight: 800; line-height: 1.15; letter-spacing: -.06em; }
.brand-lockup small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 500; white-space: nowrap; }
.eyebrow { color: var(--copper-dark); font-size: 10px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; margin: 0 0 9px; }

/* Login */
.login-screen { min-height: 100vh; padding: 32px; display: grid; grid-template-columns: minmax(420px, 530px) minmax(320px, 1fr); gap: clamp(28px, 8vw, 130px); align-items: center; justify-content: center; background: var(--paper-bright); }
.login-card { width: 100%; max-width: 470px; margin-inline: auto; }
.login-brand { margin-bottom: 65px; }
.login-card .eyebrow { margin-bottom: 17px; }
.login-card h1 { font-size: clamp(29px, 3vw, 43px); line-height: 1.55; letter-spacing: -.055em; font-weight: 800; margin: 0; }
.login-card h1 span { color: var(--copper-dark); }
.login-copy { max-width: 380px; color: var(--ink-soft); font-size: 14px; line-height: 2; margin: 15px 0 26px; }
.login-button { min-height: 56px; display: flex; justify-content: space-between; align-items: center; padding: 0 22px; background: var(--ink); border-color: var(--ink); font-weight: 700; box-shadow: 0 9px 24px rgba(35,51,69,.15); }
.login-button:hover { background: var(--ink-2); border-color: var(--ink-2); transform: translateY(-1px); }
.login-button .icon { width: 20px; }
.login-note { display: flex; align-items: center; gap: 9px; color: var(--muted); margin-top: 17px; font-size: 11px; }
.secure-dot, .studio-status { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-pale); display: inline-block; }
.login-footer { border-top: 1px solid var(--line); margin-top: 60px; padding-top: 18px; color: #a3a7a9; font-size: 10px; }
.login-message { margin-top: 18px; border-radius: 10px; background: var(--red-pale); color: var(--red); padding: 12px 15px; font-size: 12px; }
.login-aside { background: var(--ink); min-height: 640px; max-height: calc(100vh - 64px); border-radius: 25px; position: relative; overflow: hidden; display: flex; align-items: end; color: white; padding: clamp(32px, 5vw, 65px); }
.login-aside:before { content: ""; position: absolute; inset: 0; opacity: .14; background: repeating-linear-gradient(0deg, transparent 0 32px, rgba(255,255,255,.16) 33px, transparent 34px), repeating-linear-gradient(90deg, transparent 0 32px, rgba(255,255,255,.12) 33px, transparent 34px); mask-image: linear-gradient(125deg, transparent 3%, black 50%, transparent 95%); }
.aside-orbit { position: absolute; width: min(38vw, 470px); height: min(38vw, 470px); border: 1px solid rgba(226,190,158,.32); border-radius: 50%; left: 50%; top: 39%; transform: translate(-50%,-50%); }
.orbit-one:before, .orbit-two:before { content: ""; position: absolute; inset: 13%; border: 1px solid rgba(226,190,158,.24); border-radius: 50%; }
.orbit-two { width: min(26vw, 320px); height: min(26vw, 320px); border-style: dashed; transform: translate(-50%,-50%) rotate(22deg); }
.aside-aperture { position: absolute; width: 170px; height: 170px; top: 39%; left: 50%; transform: translate(-50%,-50%); display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #42586e, #1a2735 70%); color: #cf9a70; box-shadow: 0 0 0 15px rgba(255,255,255,.025), 0 0 0 35px rgba(255,255,255,.02), 0 18px 50px rgba(0,0,0,.2); }
.aside-aperture .icon { width: 94px; height: 94px; stroke-width: .8; }
.aside-caption { position: relative; z-index: 1; }
.aside-caption span { color: #c99a74; font-size: 9px; font-weight: 800; letter-spacing: .14em; direction: ltr; display: inline-block; }
.aside-caption p { margin: 17px 0 0; font-size: clamp(24px, 3vw, 36px); line-height: 1.7; font-weight: 700; letter-spacing: -.04em; }
.aside-tick { position: absolute; top: 50%; width: 32px; height: 1px; background: rgba(224,187,155,.6); }
.aside-tick-a { left: 13%; }.aside-tick-b { right: 13%; }

/* App shell */
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 30; right: 0; top: 0; bottom: 0; width: 252px; padding: 25px 17px 16px; background: var(--paper-bright); border-left: 1px solid var(--line); display: flex; flex-direction: column; transition: transform .18s ease; }
.sidebar-brand { padding: 0 8px 27px; }
.sidebar-label { color: #a0a4a3; padding: 0 12px; font-size: 10px; font-weight: 800; margin: 0 0 10px; }
.sidebar-label-lower { margin-top: 29px; }
.main-nav { display: grid; gap: 4px; }
.nav-link { border: 0; background: transparent; color: #67727d; min-height: 43px; display: flex; align-items: center; gap: 13px; padding: 0 12px; border-radius: 10px; text-align: right; font-size: 12px; font-weight: 600; position: relative; transition: background .15s ease,color .15s ease; }
.nav-link .icon { width: 18px; height: 18px; color: #89929a; }
.nav-link:hover { background: #f6f3ed; color: var(--ink); }
.nav-link.active { background: var(--ink); color: white; box-shadow: 0 7px 14px rgba(35,51,69,.11); }
.nav-link.active .icon { color: #ddb18c; }
.nav-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--copper); margin-right: auto; }
.sidebar-spacer { flex: 1; min-height: 24px; }
.sidebar-studio { display: flex; align-items: center; gap: 12px; padding: 14px 11px; border: 1px solid var(--line); border-radius: 12px; margin: 9px 2px 8px; }
.sidebar-studio strong { display: block; font-size: 10px; max-width: 150px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.sidebar-studio small { color: var(--muted); font-size: 9px; display: block; margin-top: 4px; }
.studio-status { width: 6px; height: 6px; box-shadow: 0 0 0 4px var(--green-pale); flex: 0 0 auto; }
.logout-link { border: 0; background: none; display: flex; align-items: center; gap: 12px; padding: 11px 12px; color: #8a8e90; font-size: 11px; }
.logout-link:hover { color: var(--red); }
.logout-link .icon { width: 17px; height: 17px; }
.main-column { min-height: 100vh; margin-right: 252px; }
.topbar { height: 78px; padding: 0 clamp(22px, 4.2vw, 60px); display: flex; align-items: center; justify-content: space-between; background: rgba(245,243,237,.94); border-bottom: 1px solid rgba(224,220,211,.8); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); }
.topbar-context { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-kicker { color: #9a9e9e; font-size: 10px; }
.topbar-divider { color: #c3c1bb; font-size: 12px; }
.topbar-context strong { font-size: 12px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 20px; }
.today-chip { color: #7e8790; font-size: 10px; }
.topbar-rule { height: 27px; width: 1px; background: var(--line); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 34px; height: 34px; display: grid; place-items: center; background: var(--copper-pale); color: var(--copper-dark); border-radius: 50%; font-weight: 800; font-size: 12px; }
.user-chip strong { display: block; font-size: 10px; max-width: 130px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.user-chip small { display: block; font-size: 9px; color: var(--muted); margin-top: 3px; }
.user-menu-caret { border: 0; color: #969b9e; background: transparent; font-size: 16px; padding: 4px; }
.mobile-menu { display: none; border: 1px solid var(--line); background: var(--paper-bright); border-radius: 9px; width: 37px; height: 37px; color: var(--ink); }
.view-container { padding: 36px clamp(22px, 4.2vw, 60px) 60px; max-width: 1600px; margin: 0 auto; }

/* Page headings and controls */
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 27px; }
.page-heading h1 { margin: 0; font-weight: 800; font-size: clamp(23px, 2vw, 29px); letter-spacing: -.05em; }
.page-heading p { margin: 7px 0 0; font-size: 11px; color: #858c92; }
.heading-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn-primary { --bs-btn-bg: var(--ink); --bs-btn-border-color: var(--ink); --bs-btn-hover-bg: var(--ink-2); --bs-btn-hover-border-color: var(--ink-2); --bs-btn-active-bg: var(--ink-2); --bs-btn-active-border-color: var(--ink-2); --bs-btn-disabled-bg: #84909b; --bs-btn-disabled-border-color: #84909b; }
.btn-copper { background: var(--copper); border-color: var(--copper); color: white; }
.btn-copper:hover { background: var(--copper-dark); border-color: var(--copper-dark); color: white; }
.btn-sm { --bs-btn-font-size: 11px; --bs-btn-padding-y: .55rem; --bs-btn-padding-x: .85rem; --bs-btn-border-radius: .65rem; }
.btn-outline-secondary { --bs-btn-color: #68747d; --bs-btn-border-color: #d9d8d2; --bs-btn-hover-bg: var(--paper-dark); --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: #d9d8d2; }
.filter-bar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 16px; }
.search-box { width: min(320px, 100%); position: relative; }
.search-box .icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: #a1a6a8; }
.search-box .form-control { padding-right: 38px; }
.form-control, .form-select { border-color: #e1ded7; background-color: #fffefa; border-radius: 9px; min-height: 39px; color: var(--ink); font-size: 12px; }
.form-control:focus, .form-select:focus { border-color: #c59673; box-shadow: 0 0 0 .18rem rgba(181,120,76,.12); }
.form-label { font-size: 11px; font-weight: 700; margin-bottom: 7px; color: #4b5b6a; }
.form-text { color: #92999d; font-size: 10px; }

/* Cards and dashboard */
.panel { background: var(--paper-bright); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 3px 10px rgba(35,51,69,.018); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; }
.panel-heading h2, .panel-heading h3 { margin: 0; font-size: 13px; font-weight: 800; }
.panel-heading p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.panel-body { padding: 0 20px 19px; }
.metrics-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 13px; margin-bottom: 18px; }
.metric-card { min-height: 136px; border-radius: var(--radius); background: var(--paper-bright); border: 1px solid var(--line); padding: 17px 18px; position: relative; overflow: hidden; }
.metric-card:after { content: ""; position: absolute; left: -15px; bottom: -43px; width: 105px; height: 105px; border-radius: 50%; border: 1px solid rgba(181,120,76,.13); box-shadow: 0 0 0 13px rgba(181,120,76,.03), 0 0 0 26px rgba(181,120,76,.02); }
.metric-top { display: flex; justify-content: space-between; align-items: center; color: #889099; font-size: 10px; }
.metric-icon { width: 31px; height: 31px; border-radius: 10px; display: grid; place-items: center; background: var(--copper-pale); color: var(--copper-dark); }
.metric-icon .icon { width: 16px; height: 16px; }
.metric-value { display: block; font-size: 27px; font-weight: 800; margin-top: 15px; letter-spacing: -.05em; direction: ltr; text-align: right; }
.metric-foot { margin-top: 4px; font-size: 9px; color: #989fa3; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.65fr) minmax(270px,.8fr); gap: 16px; align-items: start; }
.dashboard-stack { display: grid; gap: 16px; }
.panel-action { border: 0; background: transparent; color: var(--copper-dark); font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.panel-action:hover { color: var(--ink); }
.panel-action .icon { width: 13px; height: 13px; }

/* Tables */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; min-width: 650px; border-collapse: collapse; }
.data-table th { background: #faf9f5; padding: 11px 16px; color: #959b9d; font-size: 9px; font-weight: 700; text-align: right; white-space: nowrap; border-top: 1px solid #f0eee9; border-bottom: 1px solid #f0eee9; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid #f1efe9; color: #455463; font-size: 10px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fcfbf8; }
.primary-cell { font-weight: 700; color: var(--ink) !important; }
.secondary-cell { color: #899198 !important; font-size: 9px !important; display: block; margin-top: 4px; }
.amount-cell { font-weight: 800; white-space: nowrap; direction: ltr; text-align: right; }
.row-actions { display: flex; align-items: center; gap: 5px; }
.icon-btn { width: 29px; height: 29px; padding: 0; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: #78838d; background: white; }
.icon-btn:hover { border-color: #cda889; color: var(--copper-dark); background: #fffaf5; }
.icon-btn .icon { width: 14px; height: 14px; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 100px; padding: 5px 9px; white-space: nowrap; font-size: 9px; font-weight: 700; }
.status-pill:before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-confirmed, .status-completed { background: var(--green-pale); color: var(--green); }
.status-pending, .status-new { background: #f5eee3; color: #a37645; }
.status-cancelled { background: #f2efeb; color: #8e9293; }
.status-in_progress { background: var(--blue-pale); color: var(--blue); }
.status-high { background: var(--red-pale); color: var(--red); }
.status-normal { background: var(--blue-pale); color: var(--blue); }
.status-low { background: #f1f0eb; color: #858b8b; }
.empty-state { padding: 38px 20px; text-align: center; color: #959b9d; font-size: 11px; }
.empty-state .empty-mark { width: 39px; height: 39px; margin: 0 auto 10px; border-radius: 13px; display: grid; place-items: center; background: var(--paper); color: #9d9e9b; }
.empty-state .icon { width: 18px; height: 18px; }

/* Activity and tasks */
.agenda-list { display: grid; }
.agenda-item { display: grid; grid-template-columns: 55px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid #f0eee9; }
.agenda-item:last-child { border-bottom: 0; }
.agenda-date { text-align: center; border-left: 1px solid var(--line); padding-left: 12px; }
.agenda-date strong { display: block; font-size: 18px; line-height: 1; }
.agenda-date small { display: block; color: var(--muted); font-size: 8px; margin-top: 5px; }
.agenda-info strong { display: block; font-size: 10px; }
.agenda-info small { display: block; color: var(--muted); margin-top: 4px; font-size: 9px; }
.agenda-time { color: var(--copper-dark); font-size: 9px; font-weight: 700; white-space: nowrap; }
.task-list { display: grid; }
.task-row { display: grid; grid-template-columns: 22px minmax(0,1fr) auto; gap: 10px; align-items: start; padding: 12px 0; border-bottom: 1px solid #f0eee9; }
.task-row:last-child { border-bottom: 0; }
.task-check { width: 17px; height: 17px; accent-color: var(--green); margin-top: 2px; }
.task-row strong { display: block; font-size: 10px; }
.task-row small { display: block; color: #90979b; font-size: 9px; margin-top: 5px; }

/* Tables lists, report chart */
.section-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.catalog-card { padding: 20px; }
.catalog-card h2 { font-size: 13px; margin: 0 0 5px; }
.catalog-card p { color: var(--muted); font-size: 10px; margin: 0 0 16px; }
.catalog-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0; border-top: 1px solid #f0eee9; }
.catalog-row strong { font-size: 10px; display: block; }
.catalog-row small { font-size: 9px; color: var(--muted); display: block; margin-top: 3px; }
.catalog-price { direction: ltr; white-space: nowrap; color: var(--ink); font-weight: 700; font-size: 10px; }
.role-chip { display: inline-flex; padding: 5px 9px; border-radius: 100px; background: var(--blue-pale); color: var(--blue); font-size: 9px; font-weight: 700; }
.role-owner { background: var(--copper-pale); color: var(--copper-dark); }
.report-kpis { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin-bottom: 17px; }
.report-kpi { background: var(--paper-bright); border: 1px solid var(--line); border-radius: 13px; padding: 16px; }
.report-kpi span { display: block; color: var(--muted); font-size: 9px; }
.report-kpi strong { display: block; margin-top: 9px; font-size: 20px; direction: ltr; text-align: right; }
.chart-area { padding: 10px 0 4px; display: grid; gap: 11px; }
.chart-row { display: grid; grid-template-columns: minmax(75px,100px) minmax(80px,1fr) 90px; gap: 12px; align-items: center; }
.chart-label { color: #79838b; font-size: 9px; white-space: nowrap; }
.chart-track { height: 8px; border-radius: 100px; background: #f0eee8; overflow: hidden; }
.chart-bar { height: 100%; min-width: 2px; border-radius: 100px; background: var(--copper); }
.chart-value { direction: ltr; text-align: left; color: var(--ink); font-size: 9px; font-weight: 700; }
.sale-total { direction: ltr; text-align: right; font-size: 19px; font-weight: 800; }

/* Agreement print */
.agreement-paper { background: white; padding: clamp(22px,4vw,50px); border: 1px solid var(--line); border-radius: 8px; max-width: 850px; margin: auto; color: #242d35; box-shadow: 0 5px 20px rgba(30,40,50,.06); }
.agreement-top { display: flex; align-items: start; justify-content: space-between; gap: 20px; padding-bottom: 20px; border-bottom: 2px solid var(--ink); }
.agreement-brand img { max-width: 98px; max-height: 66px; object-fit: contain; }
.agreement-brand strong { display: block; font-size: 18px; }
.agreement-brand small { color: #747a7c; font-size: 10px; }
.agreement-id { text-align: left; color: #777; font-size: 10px; }
.agreement-id strong { display: block; color: var(--ink); font-size: 13px; margin-bottom: 6px; }
.agreement-title { text-align: center; margin: 24px 0; }
.agreement-title h3 { font-size: 20px; font-weight: 800; }
.agreement-title p { color: #69737c; font-size: 11px; }
.agreement-party-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.agreement-party { background: #faf9f5; padding: 14px; border-radius: 8px; }
.agreement-party span { display: block; color: #838a8e; font-size: 9px; margin-bottom: 5px; }
.agreement-party strong { font-size: 11px; }
.agreement-table { width: 100%; border-collapse: collapse; margin: 18px 0; }
.agreement-table th, .agreement-table td { border: 1px solid #e4e1db; padding: 9px; text-align: right; font-size: 10px; }
.agreement-table th { background: #f8f6f0; }
.agreement-clauses { padding-right: 18px; line-height: 2; font-size: 10px; }
.signature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 50px; margin-top: 45px; }
.signature-line { border-top: 1px solid #aeb1b0; padding-top: 8px; color: #747a7c; font-size: 9px; text-align: center; }

/* Modal, toast, states */
.modal-content { border: 1px solid var(--line); border-radius: 17px; box-shadow: 0 22px 70px rgba(20,30,40,.17); }
.modal-header { padding: 21px 24px 16px; border-bottom-color: var(--line); }
.modal-header .eyebrow { font-size: 9px; margin-bottom: 5px; }
.modal-title { font-size: 18px; font-weight: 800; }
.modal-body { padding: 22px 24px; }
.modal-footer { border-top-color: var(--line); padding: 13px 24px 18px; }
.modal-footer .btn { min-width: 105px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.form-section-title { grid-column: 1/-1; font-size: 11px; font-weight: 800; padding-top: 7px; color: var(--copper-dark); }
.service-edit-row { display: grid; grid-template-columns: minmax(0,1fr) 88px 110px 30px; gap: 8px; align-items: center; margin: 7px 0; }
.clause-edit-row { display: grid; grid-template-columns: 24px minmax(0,1fr) 30px; gap: 8px; align-items: start; margin: 8px 0; }
.permission-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px 15px; }
.permission-check { display: flex; align-items: center; gap: 8px; color: #53616c; font-size: 10px; }
.permission-check input { accent-color: var(--copper); }
.toast { border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 11px; border-radius: 12px; }
.toast.toast-success { border-right: 4px solid var(--green); }
.toast.toast-error { border-right: 4px solid var(--red); }
.loading-block { min-height: 150px; display: grid; place-items: center; color: #969d9f; font-size: 11px; }
.skeleton { height: 13px; border-radius: 5px; background: linear-gradient(90deg,#f0eee8,#f8f6f0,#f0eee8); background-size: 220% 100%; animation: shimmer 1.4s ease infinite; }
@keyframes shimmer { to { background-position: -220% 0; } }

@media (max-width: 1150px) {
  .sidebar { width: 225px; }
  .main-column { margin-right: 225px; }
  .metrics-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-stack { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 850px) {
  .login-screen { grid-template-columns: 1fr; padding: 26px; }
  .login-aside { display: none; }
  .login-card { padding-block: 20px; }
  .login-brand { margin-bottom: 45px; }
  .sidebar { transform: translateX(110%); box-shadow: -10px 0 30px rgba(20,30,40,.09); }
  .sidebar.open { transform: translateX(0); }
  .main-column { margin-right: 0; }
  .mobile-menu { display: grid; place-items: center; }
  .topbar { justify-content: start; gap: 13px; height: 68px; padding: 0 18px; }
  .topbar-context { flex: 1; }
  .topbar-kicker, .topbar-divider, .today-chip, .topbar-rule { display: none; }
  .topbar-actions { margin-right: auto; }
  .user-chip small, .user-menu-caret { display: none; }
  .view-container { padding: 27px 18px 45px; }
}
@media (max-width: 640px) {
  .catalog-row { flex-wrap: wrap; }
  .catalog-row > div:first-child { flex: 1 1 100%; }
  .catalog-row .row-actions { margin-right: auto; }
  .page-heading { align-items: start; flex-direction: column; margin-bottom: 20px; }
  .page-heading .heading-actions { width: 100%; }
  .page-heading .heading-actions .btn { flex: 1; }
  .metrics-grid { gap: 9px; }
  .metric-card { min-height: 115px; padding: 13px; }
  .metric-value { font-size: 22px; margin-top: 12px; }
  .metric-top { font-size: 9px; }
  .dashboard-stack, .section-grid { grid-template-columns: 1fr; }
  .report-kpis { gap: 7px; }
  .report-kpi { padding: 11px; }
  .report-kpi strong { font-size: 16px; }
  .filter-bar > .form-control, .filter-bar > .form-select { flex: 1 1 130px; }
  .filter-bar .search-box { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .service-edit-row { grid-template-columns: minmax(0,1fr) 70px 92px 28px; gap: 5px; }
  .service-edit-row .form-control { min-width: 0; padding-inline: 7px; }
  .permission-grid { grid-template-columns: 1fr; }
  .agreement-party-grid { grid-template-columns: 1fr; }
  .agreement-top { flex-direction: column; }
  .agreement-id { text-align: right; }
  .signature-grid { gap: 20px; }
  .login-screen { padding: 20px; }
  .login-footer { margin-top: 42px; }
  .chart-row { grid-template-columns: 72px minmax(60px,1fr) 70px; gap: 7px; }
}

@media print {
  body { background: white; }
  body * { visibility: hidden !important; }
  .agreement-paper, .agreement-paper * { visibility: visible !important; }
  .modal { display: block !important; position: static !important; width: 100% !important; height: auto !important; overflow: visible !important; background: transparent !important; }
  .modal-backdrop, .modal-header, .modal-footer { display: none !important; }
  .modal-dialog { width: auto !important; max-width: none !important; margin: 0 !important; transform: none !important; }
  .modal-content { border: 0 !important; background: transparent !important; box-shadow: none !important; }
  .modal-body { padding: 0 !important; overflow: visible !important; }
  .modal-body > :not(.agreement-paper) { display: none !important; }
  .agreement-paper { position: static; width: 100%; max-width: none; margin: 0; padding: 0; border: 0; box-shadow: none; }
  .agreement-table, .agreement-party, .agreement-paper { break-inside: avoid; }
  @page { size: A4; margin: 18mm 16mm; }
}


/* النورس: هوية بحرية احترافية، متناسقة مع شعار الاستديو */
:root {
  --ink: #123b57;
  --ink-2: #1a5777;
  --ink-soft: #49677d;
  --paper: #f3f7fa;
  --paper-bright: #ffffff;
  --paper-dark: #e5eef3;
  --line: #dbe6ed;
  --muted: #8092a0;
  --copper: #12a0a7;
  --copper-dark: #087f91;
  --copper-pale: #e3f5f6;
  --green: #2d8a70;
  --green-pale: #e5f3ee;
  --red: #a64353;
  --red-pale: #f9e9ed;
  --blue: #3c789c;
  --blue-pale: #e8f1f7;
  --brand-accent: #0c9ba7;
  --violet: #493b8c;
  --shadow: 0 18px 48px rgba(18, 59, 87, .09);
}

.brand-logo { width: 48px; height: 48px; flex: 0 0 auto; object-fit: contain; border-radius: 12px; background: #fff; box-shadow: 0 5px 18px rgba(18,59,87,.12); }
.login-brand .brand-logo { width: 62px; height: 62px; border-radius: 16px; }
.sidebar-brand .brand-logo { width: 44px; height: 44px; }
.brand-name { letter-spacing: -.03em; }
.login-screen { background: radial-gradient(circle at 83% 10%, rgba(18,160,167,.08), transparent 25%), linear-gradient(135deg,#f5fbfd,#fff 65%,#f7f6ff); }
.login-card h1 span { color: var(--brand-accent); }
.login-button { background: linear-gradient(115deg,#0c7d91,#153f66); border-color: #0c7d91; box-shadow: 0 11px 28px rgba(12,125,145,.22); }
.login-button:hover { background: linear-gradient(115deg,#096e82,#123653); border-color: #096e82; }
.login-aside { background: linear-gradient(145deg,#18a0aa 0%,#155778 48%,#49398a 100%); }
.login-aside:before { opacity: .2; }
.aside-orbit, .orbit-one:before, .orbit-two:before { border-color: rgba(255,255,255,.32); }
.aside-aperture { background: radial-gradient(circle at 40% 35%,#287e91,#122f56 72%); color: #c4f4f3; box-shadow: 0 0 0 15px rgba(255,255,255,.05),0 0 0 35px rgba(255,255,255,.035),0 18px 50px rgba(0,0,0,.2); }
.aside-caption span { color: #bceff0; }
.aside-tick { background: rgba(198,243,243,.68); }
.nav-link.active { background: linear-gradient(115deg,#123b57,#1b6680); box-shadow: 0 8px 18px rgba(18,59,87,.17); }
.nav-link.active .icon { color: #b4eff0; }
.nav-link:hover { background: #eaf4f7; }
.user-avatar { background: #dff2f4; color: #087f91; }
.topbar { background: rgba(248,251,252,.95); border-bottom-color: #dbe6ed; }
.sidebar { overflow-y: auto; scrollbar-width: thin; scrollbar-color: #c5d5dd transparent; }
.btn-primary { --bs-btn-bg: #123b57; --bs-btn-border-color: #123b57; --bs-btn-hover-bg: #1a5777; --bs-btn-hover-border-color: #1a5777; --bs-btn-active-bg: #1a5777; --bs-btn-active-border-color: #1a5777; }
.btn-copper { background: #0c9ba7; border-color: #0c9ba7; }
.metric-icon, .empty-mark { background: #e4f4f5; color: #0a8b99; }
.status-confirmed, .status-completed { background: #e5f3ee; color: #287b63; }
.status-pending, .status-new { background: #e8f1f7; color: #356d8c; }
.status-in_progress { background: #eeeafe; color: #55469a; }

/* تقويم التوافر الشهري */
.calendar-panel { overflow: hidden; }
.calendar-toolbar { display: flex; justify-content: space-between; align-items: end; gap: 18px; padding: 22px 24px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.calendar-month-controls, .calendar-search { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.calendar-month-controls strong { min-width: 80px; text-align: center; font-size: 16px; color: var(--ink); }
.calendar-month-input { width: 150px; }
.calendar-search label { margin: 0; font-size: 11px; color: var(--ink-soft); font-weight: 700; }
.calendar-search .form-control { width: 165px; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); }
.calendar-weekdays { background: #f4f8fa; color: var(--ink-soft); font-size: 10px; font-weight: 800; text-align: center; }
.calendar-weekdays > div { padding: 12px 5px; }
.calendar-grid { gap: 1px; background: var(--line); border-top: 1px solid var(--line); }
.calendar-cell { min-height: 112px; border: 0; border-radius: 0; padding: 10px; display: flex; flex-direction: column; align-items: flex-start; gap: 7px; text-align: right; color: var(--ink); background: #fff; transition: background .14s ease, box-shadow .14s ease; }
.calendar-cell:hover { background: #f0f8fa; box-shadow: inset 0 0 0 2px rgba(12,155,167,.3); }
.calendar-cell:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: -2px; }
.calendar-empty { background: #f8fafb; }
.calendar-booked { background: #f1effb; }
.calendar-booked:hover { background: #e9e5f8; }
.calendar-day-number { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.calendar-count { font-size: 9px; font-weight: 800; color: #493b8c; background: #e4dff6; border-radius: 20px; padding: 3px 8px; }
.calendar-first-event { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; color: #51477e; }
.calendar-free-label { color: #589083; font-size: 9px; }
.calendar-legend { display: flex; align-items: center; gap: 18px; padding: 14px 22px; color: var(--ink-soft); font-size: 10px; }
.calendar-legend span { display: flex; align-items: center; gap: 7px; }
.calendar-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.legend-booked { background: #7563b7; }.legend-free { background: #68a995; }
.calendar-legend small { margin-inline-start: auto; color: var(--muted); }
.calendar-search-result { margin: 18px 22px 0; }
.availability-note { min-height: 20px; margin-top: 6px; font-size: 10px; line-height: 1.7; color: var(--muted); }
.availability-booked { padding: 12px 15px; color: #8e3343; background: #fff0f2; border: 1px solid #f0cbd2; border-radius: 10px; font-size: 11px; }
.availability-free { padding: 12px 15px; color: #226a59; background: #eaf7f1; border: 1px solid #cce9dc; border-radius: 10px; font-size: 11px; }
.availability-booked ul, .calendar-search-result ul { margin: 7px 0 0; padding-inline-start: 20px; }
.availability-free p { margin: 5px 0 0; }

/* الشؤون المالية والرسائل */
.report-kpi small { display: block; margin-top: 6px; color: var(--muted); font-size: 9px; }
.sms-settings-card { grid-column: 1 / -1; }
.code-textarea { direction: ltr; text-align: left; font-family: ui-monospace,SFMono-Regular,Menlo,monospace; font-size: 11px; }
.message-preview-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 12px 14px; margin-bottom: 15px; background: #f0f7fa; border: 1px solid var(--line); border-radius: 10px; font-size: 11px; }
.message-preview-meta span { color: var(--ink-soft); }
.message-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.row-actions { flex-wrap: wrap; }
@media (max-width: 850px) {
  .calendar-toolbar { align-items: stretch; padding: 16px; }
  .calendar-month-controls, .calendar-search { justify-content: space-between; }
  .calendar-cell { min-height: 82px; padding: 6px; gap: 4px; }
  .calendar-first-event { display: none; }
  .calendar-legend { flex-wrap: wrap; gap: 10px; }
  .calendar-legend small { margin-inline-start: 0; width: 100%; }
}
@media (max-width: 520px) {
  .brand-logo { width: 40px; height: 40px; }
  .login-brand .brand-logo { width: 54px; height: 54px; }
  .calendar-month-controls { gap: 5px; }
  .calendar-month-controls .btn { padding-inline: 7px; }
  .calendar-month-input { width: 130px; }
  .calendar-weekdays > div { font-size: 8px; padding: 9px 2px; }
  .calendar-cell { min-height: 67px; }
  .calendar-count { padding: 2px 5px; font-size: 8px; }
}
