:root {
  color-scheme: light;
  --ink: #1a302c;
  --muted: #70817b;
  --line: #e5ebe7;
  --paper: #fff;
  --canvas: #f4f7f5;
  --green: #176b58;
  --green-dark: #125343;
  --mint: #e9f4ee;
  --gold: #b88734;
  --red: #b84f45;
  --blue: #4976a2;
  --shadow: 0 14px 40px #203f3412;
  font-family: "IBM Plex Sans Arabic", Tahoma, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font-size: 14px; line-height: 1.55; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .6; }
[hidden] { display: none !important; }
.auth-gate { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 20% 20%, #e5f2eb, transparent 36%), var(--canvas); }
.auth-card { width: min(420px, 100%); background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 32px; box-shadow: var(--shadow); }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-lockup strong { display: block; font-size: 17px; }
.brand-lockup small { display: block; color: var(--muted); font-size: 10px; }
.brand-mark { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 13px; background: var(--green); color: #fff; font-size: 23px; font-weight: 800; box-shadow: 0 7px 17px #176b5830; }
.auth-card h1 { font-size: 23px; margin: 32px 0 4px; }
.auth-card p { color: var(--muted); font-size: 12px; margin: 0 0 23px; }
.auth-card label, .team-form label { display: block; margin: 14px 0 6px; color: #53645e; font-size: 11px; font-weight: 700; }
.auth-card input, .team-form input, .team-form select { display: block; width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 9px; padding: 0 11px; color: var(--ink); background: #fff; outline: 0; }
.auth-card input:focus, input:focus, select:focus, textarea:focus { border-color: #84ae9e; box-shadow: 0 0 0 3px #176b5815; }
.auth-note { display: block; text-align: center; margin-top: 17px; color: #8a9791; font-size: 10px; }
.form-error { min-height: 18px; color: var(--red) !important; margin: 9px 0 !important; font-size: 11px !important; }
.app { min-height: 100vh; }
.sidebar { width: 250px; position: fixed; z-index: 5; inset: 0 0 0 auto; display: flex; flex-direction: column; padding: 24px 17px 18px; background: #fff; border-left: 1px solid var(--line); }
.sidebar .brand-lockup { padding: 0 6px 33px; }
.nav-label, .eyebrow { color: #87948e; font-size: 10px; font-weight: 700; letter-spacing: .4px; }
.nav-label { padding: 0 11px 9px; }
.nav { display: grid; gap: 5px; }
.nav button { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 42px; border: 0; border-radius: 10px; padding: 0 12px; background: transparent; color: #596b64; text-align: right; font-size: 12px; }
.nav button > span:first-child { width: 20px; color: #73837c; text-align: center; font-size: 16px; }
.nav button:hover, .nav button.active { background: var(--mint); color: var(--green); font-weight: 700; }
.nav button.active > span:first-child { color: var(--green); }
.nav-badge, .count-pill { margin-right: auto; min-width: 21px; padding: 1px 6px; border-radius: 15px; background: #fbf0dd; color: #8c692d; text-align: center; font-size: 10px; font-weight: 700; }
.mobile-nav { display: none; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 15px; }
.profile { display: flex; align-items: center; gap: 9px; margin: 0 3px 12px; min-width: 0; }
.avatar { flex: 0 0 31px; height: 31px; display: grid; place-items: center; border-radius: 10px; background: var(--mint); color: var(--green); font-weight: 800; }
.profile strong, .profile small { display: block; overflow: hidden; max-width: 170px; text-overflow: ellipsis; white-space: nowrap; }
.profile strong { font-size: 10px; }
.profile small { color: var(--muted); font-size: 9px; }
.main { width: calc(100% - 250px); margin-right: 250px; padding: 0 32px 45px; }
.topbar { min-height: 78px; display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.breadcrumb { color: var(--muted); font-size: 11px; }
.breadcrumb span { padding: 0 6px; color: #aab5af; }
.breadcrumb strong { color: var(--ink); }
.topbar-spacer { flex: 1; }
.today-label { color: var(--muted); font-size: 10px; }
.mobile-brand { display: none; align-items: center; gap: 8px; }
.mobile-brand .brand-mark { width: 32px; height: 32px; border-radius: 10px; font-size: 18px; }
.page-view { display: none; }
.page-view.active { display: block; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 19px; }
.page-heading h1 { margin: 5px 0 2px; font-size: 23px; line-height: 1.35; letter-spacing: -.4px; }
.page-heading p { margin: 0; color: var(--muted); font-size: 11px; }
.filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 7px; }
.filters select, .filters input, .table-tools input, .table-tools select { height: 36px; min-width: 110px; border: 1px solid var(--line); border-radius: 8px; padding: 0 9px; background: white; color: #50625b; font-size: 10px; }
.filters input { width: 125px; }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 11px; margin-bottom: 13px; }
.metric { min-height: 112px; border: 1px solid var(--line); border-radius: 13px; padding: 15px; background: var(--paper); box-shadow: 0 3px 15px #24443606; }
.metric span, .metric small { display: block; color: var(--muted); font-size: 10px; }
.metric strong { display: block; margin: 7px 0 1px; font-size: 25px; line-height: 1.1; letter-spacing: -.5px; }
.metric.warning strong { color: var(--gold); }
.metric.danger strong { color: var(--red); }
.weekly-strip { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 8px; align-items: center; border: 1px solid #dce9e1; border-radius: 13px; padding: 12px 16px; margin-bottom: 13px; background: linear-gradient(110deg, #f8fcf9, #eef6f1); }
.weekly-strip > div { display: grid; gap: 2px; }
.weekly-strip > div:first-child { border-left: 1px solid #dce8df; padding-left: 10px; }
.weekly-strip strong { font-size: 13px; }
.weekly-strip small { color: var(--muted); font-size: 9px; }
.board-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 13px; margin-bottom: 13px; }
.panel { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); box-shadow: 0 3px 15px #24443606; }
.panel-heading { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 17px; border-bottom: 1px solid #eff2f0; }
.panel-heading h2 { margin: 0; font-size: 12px; }
.panel-heading p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.text-button { border: 0; padding: 4px; background: none; color: var(--green); font-size: 10px; font-weight: 700; white-space: nowrap; }
.action-list { display: grid; max-height: 310px; overflow: auto; }
.action-item { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; padding: 12px 17px; border-bottom: 1px solid #f0f3f1; }
.action-item:last-child { border-bottom: 0; }
.action-item strong { font-size: 10px; }
.action-item p { grid-column: 1/-1; margin: 0; color: var(--muted); font-size: 9px; line-height: 1.7; }
.action-item button { grid-column: 2; grid-row: 1; border: 0; background: none; color: var(--green); font-size: 9px; font-weight: 700; }
.empty-state, .loading { padding: 23px 15px; text-align: center; color: #8a9791; font-size: 10px; }
.table-panel { margin-bottom: 16px; }
.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: right; white-space: nowrap; }
th { padding: 10px 13px; border-bottom: 1px solid var(--line); background: #f8faf8; color: #86948d; font-size: 9px; font-weight: 700; }
td { padding: 11px 13px; border-bottom: 1px solid #eff2f0; color: #52625b; font-size: 9px; }
tbody tr[data-project-id] { cursor: pointer; transition: background .15s; }
tbody tr[data-project-id]:hover { background: #f7fbf8; }
tbody tr:last-child td { border-bottom: 0; }
.project-cell { display: grid; gap: 1px; }
.project-cell strong { color: var(--ink); font-size: 10px; }
.project-cell small { color: #87948e; font-size: 8px; }
.state-chip { display: inline-block; border-radius: 20px; padding: 3px 7px; background: #eef5f0; color: #3d7756; font-size: 8px; }
.state-chip.delayed, .state-chip.pending { background: #fbf3e5; color: #947333; }
.state-chip.stopped, .state-chip.revision { background: #f2eeee; color: #895c57; }
.progress-cell { min-width: 95px; }
.progress-number { display: block; margin-bottom: 4px; color: var(--ink); font-size: 9px; }
.progress-track { height: 5px; overflow: hidden; border-radius: 8px; background: #edf1ee; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.table-note { padding: 10px 14px; color: #8c9993; font-size: 9px; border-top: 1px solid #eff2f0; }
.table-tools { display: flex; gap: 8px; margin-bottom: 12px; }
.table-tools input { flex: 1; max-width: 380px; }
.task-grid, .approval-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.task-card, .approval-card { min-width: 0; border: 1px solid var(--line); border-radius: 13px; padding: 15px; background: #fff; box-shadow: 0 3px 15px #24443606; }
.task-card-top, .approval-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.task-card h2, .approval-card h2 { margin: 4px 0; font-size: 13px; }
.task-card p, .approval-card p { margin: 3px 0; color: var(--muted); font-size: 10px; }
.task-meta, .report-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 12px 0; color: #687970; font-size: 9px; }
.task-actions, .approval-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.task-progress { margin: 10px 0; }
.team-layout { display: grid; grid-template-columns: minmax(240px, .7fr) minmax(0, 1.5fr); gap: 13px; align-items: start; }
.team-form { padding: 17px; }
.team-form h2 { margin: 0; font-size: 13px; }
.team-form .field-help { display: block; color: var(--muted); font-size: 9px; line-height: 1.7; }
.team-form .btn { margin-top: 15px; }
.btn { min-height: 36px; display: inline-flex; justify-content: center; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; background: #fff; color: #50615a; font-size: 10px; font-weight: 700; transition: .15s; }
.btn:hover { border-color: #c6d8ce; box-shadow: 0 3px 10px #18392b0b; }
.btn.primary { border-color: var(--green); background: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); }
.btn.subtle { min-height: 32px; background: #f8faf8; color: #63726c; }
.btn.wide { width: 100%; }
.btn.danger { border-color: #f0d6d2; background: #fff8f7; color: var(--red); }
.btn.small { min-height: 29px; padding: 0 9px; font-size: 9px; }
.modal-layer { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 18px; background: #122b25a8; backdrop-filter: blur(3px); }
.modal-card { width: min(680px, 100%); max-height: min(92vh, 950px); display: flex; flex-direction: column; overflow: hidden; border-radius: 16px; background: #fff; box-shadow: 0 30px 100px #0003; }
.modal-card.modal-large { width: min(1050px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 18px 21px 14px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 3px 0 2px; font-size: 16px; }
.modal-head p { margin: 0; color: var(--muted); font-size: 10px; }
.icon-close { flex: 0 0 31px; width: 31px; height: 31px; border: 0; border-radius: 9px; background: #f2f5f3; color: #5b6c64; font-size: 21px; line-height: 1; }
.modal-body { overflow: auto; padding: 17px 21px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 13px 21px; border-top: 1px solid var(--line); background: #fafcfb; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid label { display: grid; gap: 5px; color: #56665e; font-size: 9px; font-weight: 700; }
.form-grid input, .form-grid select, .form-grid textarea { min-width: 0; width: 100%; min-height: 37px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; outline: 0; background: #fff; color: var(--ink); font-size: 10px; resize: vertical; }
.form-grid textarea { min-height: 58px; }
.span-two { grid-column: 1/-1; }
.workplan-summary { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; padding: 12px 14px; border-radius: 11px; background: #f1f7f3; }
.workplan-summary strong { font-size: 11px; }
.workplan-summary small { display: block; color: var(--muted); font-size: 9px; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 17px 0 9px; }
.section-title h3 { margin: 0; font-size: 12px; }
.phase-card { margin-bottom: 11px; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.phase-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: #f8faf8; border-bottom: 1px solid var(--line); }
.phase-head strong { font-size: 11px; }
.phase-editor { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.phase-editor input { min-width: 90px; height: 29px; border: 1px solid var(--line); border-radius: 6px; padding: 0 7px; font-size: 9px; }
.phase-tasks { overflow: auto; }
.phase-tasks table { min-width: 710px; }
.task-form-panel { margin-top: 15px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfb; }
.task-form-panel h3 { margin: 0 0 10px; font-size: 12px; }
.member-form { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.member-form h3 { width: 100%; margin: 0; font-size: 11px; }
.member-form input { flex: 1; min-width: 160px; height: 34px; border: 1px solid var(--line); border-radius: 7px; padding: 0 9px; font-size: 10px; }
.inline-note { color: var(--muted); font-size: 9px; }
.report-photo-grid { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.report-photo-grid img { width: 78px; height: 66px; object-fit: cover; border-radius: 7px; border: 1px solid var(--line); cursor: zoom-in; }
.history-list { margin-top: 9px; border-top: 1px solid #eef1ef; padding-top: 8px; }
.history-item { color: #75847d; font-size: 9px; padding: 3px 0; }
.toast { position: fixed; z-index: 40; left: 20px; bottom: 20px; max-width: min(460px, calc(100vw - 40px)); padding: 11px 15px; border-radius: 10px; background: #1c4035; color: #fff; box-shadow: var(--shadow); font-size: 10px; opacity: 0; transform: translateY(8px); transition: .18s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 1180px) {
  .main { padding: 0 22px 36px; }
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .board-grid { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .sidebar { width: 205px; padding: 20px 12px; }
  .main { width: calc(100% - 205px); margin-right: 205px; padding: 0 16px 30px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .filters { justify-content: flex-start; }
  .weekly-strip { grid-template-columns: repeat(2, 1fr); }
  .weekly-strip > div:first-child { grid-column: 1/-1; border-left: 0; border-bottom: 1px solid #dce8df; padding: 0 0 8px; }
  .team-layout { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .sidebar { display: none; }
  .main { width: 100%; margin: 0; padding: 0 13px 28px; }
  .topbar { min-height: 61px; margin-bottom: 18px; }
  .mobile-brand { display: flex; }
  .breadcrumb, .today-label { display: none; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric { min-height: 98px; padding: 12px; }
  .metric strong { font-size: 22px; }
  .filters { width: 100%; }
  .filters select, .filters input { flex: 1; min-width: 98px; }
  .weekly-strip { padding: 10px; }
  .task-grid, .approval-grid { grid-template-columns: 1fr; }
  .table-wrap table { min-width: 760px; }
  .modal-layer { padding: 8px; align-items: end; }
  .modal-card, .modal-card.modal-large { max-height: 94vh; border-radius: 16px 16px 7px 7px; }
  .modal-head { padding: 15px; }
  .modal-body { padding: 14px; }
  .modal-actions { padding: 11px 14px; }
  .form-grid { gap: 9px; }
  .toast { left: 12px; right: 12px; bottom: 12px; text-align: center; }
  .topbar > .btn { min-height: 32px; padding: 0 8px; font-size: 9px; }
  .mobile-nav { position: fixed; z-index: 10; inset: auto 0 0; display: flex; justify-content: space-around; gap: 2px; min-height: 62px; padding: 5px 4px max(5px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fffffff2; backdrop-filter: blur(12px); }
  .mobile-nav button { display: flex; flex: 1; flex-direction: column; justify-content: center; align-items: center; gap: 2px; border: 0; border-radius: 8px; background: none; color: #829089; font-size: 8px; }
  .mobile-nav button > span { font-size: 17px; line-height: 1; }
  .mobile-nav button.active { color: var(--green); font-weight: 700; background: #f0f7f2; }
  .main { padding-bottom: 86px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
