/* AlAadiyaat admin panel */
:root {
  --red: #b3121b; --red-dark: #8c0d14; --red-soft: #fbeaeb;
  --navy: #1d3557; --ink: #1b1f24; --text: #3a4049; --muted: #6b7380;
  --line: #e4e6ea; --bg: #f4f5f7; --card: #fff; --green: #1f8a4c;
  --font: 'Cairo', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.55; }
a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-dark); }
h1, h2, h3 { color: var(--ink); margin: 0; line-height: 1.3; }
.ic { flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .88em; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.hint { color: var(--muted); font-size: .85rem; margin: 0; }
.text-bad { color: #b42318; font-weight: 700; }

/* Layout */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 240px; background: #121820; color: #c4cad3; display: flex; flex-direction: column; z-index: 40; transition: transform .2s; }
.side-brand { display: flex; align-items: center; gap: .65rem; padding: 1.1rem 1rem; color: #fff; border-bottom: 1px solid rgba(255,255,255,.07); }
.side-brand img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.side-brand span { font-weight: 800; display: flex; flex-direction: column; line-height: 1.2; }
.side-brand small { font-weight: 600; color: #8792a2; font-size: .75rem; }
.sidebar nav { padding: .75rem .5rem; display: grid; gap: 2px; flex: 1; }
.sidebar nav a { display: flex; align-items: center; gap: .65rem; color: #c4cad3; padding: .6rem .8rem; border-radius: 8px; font-weight: 600; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.active { background: var(--red); color: #fff; }
.sidebar .count { margin-inline-start: auto; background: rgba(255,255,255,.15); color: #fff; font-size: .72rem; padding: 0 8px; border-radius: 99px; }
.sidebar nav a.active .count { background: rgba(255,255,255,.25); }
.side-foot { padding: 1rem; border-top: 1px solid rgba(255,255,255,.07); }
.side-foot a { color: #8792a2; display: flex; gap: .4rem; align-items: center; font-size: .9rem; }
.main { margin-inline-start: 240px; min-height: 100vh; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 1rem; padding: .8rem 1.5rem; position: sticky; top: 0; z-index: 30; }
.topbar h1 { font-size: 1.25rem; flex: 1; }
.side-toggle { display: none; background: none; border: 0; cursor: pointer; color: var(--ink); padding: 4px; }
.user-menu { display: flex; align-items: center; gap: .75rem; }
.who { color: var(--ink); font-weight: 600; display: flex; align-items: center; gap: .35rem; }
.who small { color: var(--muted); font-weight: 400; }
.content { padding: 1.5rem; max-width: 1400px; display: grid; gap: 1.25rem; }

/* Components */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1.25rem; min-width: 0; }
.panel + .panel { margin-top: 1.25rem; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.panel-head h2 { font-size: 1.05rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.grid-2 > .panel + .panel { margin-top: 0; }
.align-start { align-items: start; }
.empty { color: var(--muted); text-align: center; padding: 2rem 0; margin: 0; }
h3.sub { font-size: .95rem; margin: 1.25rem 0 .5rem; }
.quote { background: var(--bg); border-inline-start: 4px solid var(--red); padding: .85rem 1rem; border-radius: 8px; white-space: normal; color: var(--ink); }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.25rem; color: var(--text); display: flex; flex-direction: column; gap: .15rem; transition: border-color .15s, box-shadow .15s; }
a.kpi:hover { border-color: var(--red); box-shadow: 0 6px 18px rgba(179,18,27,.08); color: var(--text); }
.kpi-label { display: flex; align-items: center; gap: .4rem; color: var(--muted); font-weight: 600; font-size: .85rem; }
.kpi strong { font-size: 2rem; color: var(--ink); font-weight: 800; line-height: 1.2; }
.kpi .of { font-size: 1rem; color: var(--muted); font-weight: 600; margin-inline-start: 2px; }
.kpi small { color: var(--muted); font-size: .8rem; }

.table-wrap { overflow-x: auto; margin: 0 -1.25rem; padding: 0 1.25rem; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: start; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: .55rem .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .65rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td, .table tr.selected td { background: #fafafb; }
.table tr.unread td { background: #fffaf0; }
.table tr.dim td { opacity: .55; }
.table .comment { max-width: 320px; }
.ic-cell { color: var(--red); }

.status { display: inline-block; padding: 1px 10px; border-radius: 99px; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.status-new, .status-pending { background: #fff4e0; color: #9a5b00; }
.status-under_review, .status-confirmed { background: #e6efff; color: #1d4ed8; }
.status-in_progress { background: #efe7ff; color: #6d28d9; }
.status-resolved, .status-completed { background: #e8f6ee; color: #146c3a; }
.status-closed { background: #eceef1; color: #4b5563; }
.status-rejected, .status-cancelled { background: #fdecec; color: #9b1c1c; }
.prio { font-size: .8rem; font-weight: 700; }
.prio-high { color: #b42318; }
.prio-low { color: var(--muted); }
.score { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 6px; background: var(--bg); color: var(--ink); }
.score.s1, .score.s2 { background: #fdecec; color: #9b1c1c; }
.score.s4, .score.s5 { background: #e8f6ee; color: #146c3a; }
.mini-stars i { font-style: normal; color: #d5d8dd; font-size: 1rem; }
.mini-stars i.on { color: #f5b301; }
.mini-stars i.half { color: #f8d57a; }

/* Bars (single series: one hue, value labels in ink) */
.bars { display: grid; gap: .7rem; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 80px; align-items: center; gap: .75rem; }
.bar-label { font-weight: 600; color: var(--ink); font-size: .88rem; }
.bar-track { height: 12px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--red); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-row:hover .bar-fill { background: var(--red-dark); }
.bar-val { font-weight: 700; color: var(--ink); font-size: .88rem; font-variant-numeric: tabular-nums; }

.chips { display: flex; gap: .4rem; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .85rem; border-radius: 99px; background: #fff; border: 1px solid var(--line); color: var(--text); font-weight: 600; font-size: .85rem; }
.chip b { background: var(--bg); padding: 0 7px; border-radius: 99px; font-size: .75rem; }
.chip.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.active b { background: rgba(255,255,255,.2); }
.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { font: inherit; padding: .4rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.filters input[type=search] { min-width: 240px; }
.filters .inline { display: flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--muted); }
.push { margin-inline-start: auto; }
.pager { display: flex; gap: .3rem; justify-content: center; margin-top: 1rem; flex-wrap: wrap; }
.pager a { min-width: 34px; text-align: center; padding: .3rem .5rem; border: 1px solid var(--line); border-radius: 8px; color: var(--text); }
.pager a.active { background: var(--red); border-color: var(--red); color: #fff; }

.tabs { display: flex; gap: .25rem; border-bottom: 2px solid var(--line); flex-wrap: wrap; }
.tab { padding: .6rem 1rem; font-weight: 700; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab.active { color: var(--red); border-color: var(--red); }

.dl { display: grid; grid-template-columns: 150px 1fr; gap: .45rem 1rem; margin: 0; }
.dl dt { color: var(--muted); font-weight: 600; font-size: .88rem; }
.dl dd { margin: 0; color: var(--ink); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
.panel-head .actions { margin-top: 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.25rem; border-inline-start: 2px solid var(--line); margin-inline-start: .35rem; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.timeline li:last-child { padding-bottom: 0; }
.tl-meta { font-size: .8rem; color: var(--muted); }

/* Forms */
.form { display: grid; gap: .9rem; }
.form label { display: flex; flex-direction: column; gap: .3rem; font-weight: 700; color: var(--ink); font-size: .88rem; }
.form label small { font-weight: 400; }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea, .login-card input {
  font: inherit; font-weight: 400; padding: .55rem .75rem; border: 1px solid #d5d8dd; border-radius: 8px; width: 100%; background: #fff; color: var(--ink); }
.form input:focus, .form select:focus, .form textarea:focus, .login-card input:focus { outline: 0; border-color: var(--red); box-shadow: 0 0 0 3px rgba(179,18,27,.12); }
.form textarea { resize: vertical; }
.form label.check { flex-direction: row; align-items: center; gap: .5rem; margin-top: 1.6rem; }
.lang-tag { font-size: .7rem; background: var(--bg); color: var(--muted); padding: 0 6px; border-radius: 4px; margin-inline-start: .3rem; font-weight: 600; }
.icon-pick { display: flex; gap: .4rem; flex-wrap: wrap; }
.icon-pick label { flex-direction: row; }
.icon-pick input { position: absolute; opacity: 0; }
.icon-pick span { display: grid; place-items: center; width: 42px; height: 42px; border: 1.5px solid var(--line); border-radius: 8px; cursor: pointer; color: var(--muted); }
.icon-pick input:checked + span { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.hours-table input[type=time] { width: auto !important; }
.inline-form { display: inline; }
.inline-form select { font: inherit; padding: .2rem .4rem; border: 1px solid var(--line); border-radius: 6px; }
details.reset { display: inline-block; position: relative; }
details.reset summary { list-style: none; display: inline-flex; }
details.reset summary::-webkit-details-marker { display: none; }
details.reset form { position: absolute; inset-inline-end: 0; top: 110%; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .5rem; display: flex; gap: .35rem; box-shadow: 0 8px 24px rgba(0,0,0,.1); z-index: 5; width: 280px; }
details.reset input { font: inherit; padding: .3rem .5rem; border: 1px solid var(--line); border-radius: 6px; flex: 1; min-width: 0; }
.danger-zone { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px dashed var(--line); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; font: inherit; font-weight: 700; border-radius: 8px; padding: .55rem 1.1rem; border: 1px solid transparent; cursor: pointer; white-space: nowrap; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); color: #fff; }
.btn-light { background: #fff; border-color: #d5d8dd; color: var(--ink); }
.btn-light:hover { background: var(--bg); color: var(--ink); }
.btn-danger { background: #fff; border-color: #f1b5b5; color: #b42318; }
.btn-danger:hover { background: #b42318; color: #fff; }
.btn-wa { background: #25d366; color: #fff; }
.btn-wa:hover { background: #1da851; color: #fff; }
.btn-sm { padding: .35rem .8rem; font-size: .85rem; }
.btn-xs { padding: .15rem .55rem; font-size: .78rem; }
.btn-block { width: 100%; }

.alert { padding: .75rem 1rem; border-radius: 8px; font-weight: 600; border: 1px solid; }
.alert-success { background: #e8f6ee; border-color: #b6e2c6; color: #146c3a; }
.alert-error { background: #fdecec; border-color: #f5c2c2; color: #9b1c1c; }
.alert-info { background: #eef3fa; border-color: #cbd8ea; color: var(--navy); }

/* Design picker */
.design-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.design-opt { flex-direction: row !important; }
.design-opt input { position: absolute; opacity: 0; }
.design-opt span { display: flex; flex-direction: column; gap: .3rem; width: 100%; padding: 1rem 1.2rem; border: 2px solid var(--line); border-radius: 10px; cursor: pointer; }
.design-opt b { font-size: 1.05rem; color: var(--ink); }
.design-opt small { color: var(--muted); font-weight: 400; }
.design-opt a { font-size: .85rem; font-weight: 600; }
.design-opt input:checked + span { border-color: var(--red); background: var(--red-soft); }
.form label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 600; }
@media (max-width: 600px) { .design-pick { grid-template-columns: 1fr; } }

/* Photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; }
.photo { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.photo.is-hero { border-color: var(--red); box-shadow: 0 0 0 1px var(--red); }
.photo-img { position: relative; aspect-ratio: 4/3; background: var(--bg); }
.photo-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-tag { position: absolute; top: 8px; inset-inline-start: 8px; background: var(--red); color: #fff; font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 99px; }
.photo-form { padding: .7rem .7rem 0; gap: .4rem; }
.photo-form input { padding: .35rem .55rem !important; font-size: .85rem !important; }
.photo-actions { display: flex; gap: .4rem; align-items: center; padding: .5rem .7rem .7rem; flex-wrap: wrap; }
.photo-form .photo-actions { padding: 0; }
.photo-actions .order { width: 70px !important; }

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(135deg, var(--red-dark), var(--red)); }
.login-card { background: #fff; width: 100%; max-width: 400px; border-radius: 16px; padding: 2rem; display: grid; gap: .9rem; box-shadow: 0 20px 60px rgba(0,0,0,.25); text-align: center; }
.login-card label { display: flex; flex-direction: column; gap: .3rem; text-align: start; font-weight: 700; color: var(--ink); font-size: .9rem; }
.login-logo { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; margin: 0 auto; }
.login-card h1 { font-size: 1.4rem; }
.login-card p { margin: 0; font-size: .85rem; }
.login-card .back { font-size: .85rem; color: var(--muted); }
.login-card .alert { text-align: start; }

/* Responsive */
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, 1fr); } .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .main { margin-inline-start: 0; }
  .side-toggle { display: block; }
  .grid-2 { grid-template-columns: 1fr; }
  .who small, .who { display: none; }
}
@media (max-width: 600px) {
  .content { padding: 1rem; }
  .topbar { padding: .7rem 1rem; }
  .kpis, .grid-4 { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; gap: .1rem; }
  .dl dd { margin-bottom: .5rem; }
  .bar-row { grid-template-columns: 1fr 70px; }
  .bar-label { grid-column: 1 / -1; }
  .filters input[type=search] { min-width: 0; flex: 1 1 100%; }
  .push { margin-inline-start: 0; }
}
