/* Comp911 Servis — admin panel */
:root {
  --brand: #E8900C;
  --brand-600: #CC7A00;
  --brand-soft: #FFF4E3;
  --brand-ink: #8A5200;
  --bg: #F5F6F8;
  --surface: #FFFFFF;
  --surface-2: #F9FAFB;
  --border: #E6E8EC;
  --text: #16181D;
  --muted: #6B7280;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 4px 16px rgba(16,24,40,.05);
  --radius: 14px;
  --sidebar: #15171C;
  --sidebar-text: #C9CDD4;
  --c-qebul: #2563EB;  --c-qebul-bg: #E8F0FE;
  --c-temir: #D97706;  --c-temir-bg: #FEF3E2;
  --c-hazir: #059669;  --c-hazir-bg: #E3F7EF;
  --c-tehvil: #6B7280; --c-tehvil-bg: #EEF0F3;
  --danger: #DC2626; --danger-bg: #FDECEC;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1014; --surface: #171A20; --surface-2: #1D2128; --border: #2A2F38;
    --text: #ECEEF2; --muted: #98A0AD; --brand-soft: #2B2112; --brand-ink: #F5B456;
    --shadow: 0 1px 2px rgba(0,0,0,.3); --sidebar: #0A0B0E;
    --c-qebul: #6EA0FF; --c-qebul-bg: #16233D; --c-temir: #F5B456; --c-temir-bg: #33250F;
    --c-hazir: #34D399; --c-hazir-bg: #0F2D23; --c-tehvil: #A3AAB6; --c-tehvil-bg: #23272F;
    --danger: #F87171; --danger-bg: #3A1717;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1014; --surface: #171A20; --surface-2: #1D2128; --border: #2A2F38;
  --text: #ECEEF2; --muted: #98A0AD; --brand-soft: #2B2112; --brand-ink: #F5B456;
  --shadow: 0 1px 2px rgba(0,0,0,.3); --sidebar: #0A0B0E;
  --c-qebul: #6EA0FF; --c-qebul-bg: #16233D; --c-temir: #F5B456; --c-temir-bg: #33250F;
  --c-hazir: #34D399; --c-hazir-bg: #0F2D23; --c-tehvil: #A3AAB6; --c-tehvil-bg: #23272F;
  --danger: #F87171; --danger-bg: #3A1717;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
.ic { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.right { text-align: right; }
.strong { font-weight: 600; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; letter-spacing: .01em; }
.pre { white-space: pre-wrap; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 252px; flex: none; background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 40; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; text-decoration: none; }
.brand img { height: 26px; }
.brand span { font-size: 12px; color: #8C929C; border: 1px solid #343842; border-radius: 6px; padding: 1px 7px; }
.sidebar nav, .nav-bottom { display: flex; flex-direction: column; gap: 2px; }
.nav-bottom { margin-top: auto; padding-top: 16px; border-top: 1px solid #262A32; }
.sidebar a, .sidebar button { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--sidebar-text); font: inherit; font-size: 14px; background: none; border: 0; cursor: pointer; text-align: left; width: 100%; }
.sidebar a:hover, .sidebar button:hover { background: #1F232A; color: #fff; }
.sidebar a.active { background: var(--brand); color: #fff; }
.sidebar em { margin-left: auto; font-style: normal; font-size: 12px; background: #262A32; color: #D5D8DE; border-radius: 20px; padding: 0 8px; min-width: 24px; text-align: center; }
.sidebar a.active em { background: rgba(255,255,255,.25); color: #fff; }
.sidebar-backdrop { display: none; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 14px 28px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; }
.topbar h1 { font-size: 19px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-search { margin-left: auto; display: flex; align-items: center; gap: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 0 12px; width: 300px; color: var(--muted); }
.top-search input { border: 0; background: none; padding: 9px 0; width: 100%; outline: none; color: var(--text); font: inherit; font-size: 14px; }
.menu-btn { display: none; }
.content { padding: 24px 28px 60px; max-width: 1320px; width: 100%; }

/* ---------- Components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 900px; margin-top: 18px; }
.card.highlight { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow); }
.card-title { font-size: 16px; font-weight: 650; display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.card-head .card-title { margin-bottom: 4px; }
.step { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-ink); display: inline-grid; place-items: center; font-size: 13px; font-weight: 700; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.grid { display: grid; gap: 14px; margin-bottom: 14px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
.grid:last-child { margin-bottom: 0; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.grid .field { margin-bottom: 0; }
.field > span { font-size: 13px; font-weight: 500; color: var(--muted); }
input, textarea, select { font: inherit; font-size: 15px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; width: 100%; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; min-height: 44px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--brand); margin: 0; }
.static { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--border); font-size: 14px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; font-weight: 550; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--surface-2); border-color: #C9CDD4; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.loading { opacity: .6; pointer-events: none; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.btn-row form { display: inline; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 18px 0 12px; z-index: 5; }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; }
.alert-ok { background: var(--c-hazir-bg); color: var(--c-hazir); border-color: color-mix(in srgb, var(--c-hazir) 25%, transparent); }
.alert-err { background: var(--danger-bg); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.alert-info { background: var(--c-qebul-bg); color: var(--c-qebul); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 20px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-qebul { color: var(--c-qebul); background: var(--c-qebul-bg); }
.st-temir { color: var(--c-temir); background: var(--c-temir-bg); }
.st-hazir { color: var(--c-hazir); background: var(--c-hazir-bg); }
.st-tehvil { color: var(--c-tehvil); background: var(--c-tehvil-bg); }
.late { color: var(--danger); font-size: 12px; font-weight: 600; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { border: 1px solid var(--border); background: var(--surface-2); color: var(--text); border-radius: 20px; padding: 7px 14px; font: inherit; font-size: 14px; cursor: pointer; }
.chip:hover { border-color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

.checks { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.check { display: inline-flex; align-items: center; gap: 10px; padding: 11px 16px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: var(--surface-2); user-select: none; font-size: 15px; }
.check:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }

.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px; border: 2px dashed var(--border); border-radius: 12px; cursor: pointer; text-align: center; color: var(--muted); transition: border-color .15s, background .15s; }
.dropzone:hover { border-color: var(--brand); background: var(--brand-soft); }
.dropzone .ic { width: 28px; height: 28px; color: var(--brand); }
.dropzone strong { color: var(--text); }
.dropzone input { display: none; }
.photo-preview, .gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
.photo-preview:empty { display: none; }
.photo-preview img, .thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; }
.gallery { margin-bottom: 12px; }
.thumb { position: relative; }
.thumb form { position: absolute; top: 4px; right: 4px; }
.thumb-del { border: 0; background: rgba(0,0,0,.55); color: #fff; border-radius: 6px; padding: 4px; cursor: pointer; display: grid; opacity: 0; transition: opacity .15s; }
.thumb:hover .thumb-del { opacity: 1; }
.thumb-del .ic { width: 15px; height: 15px; }

/* ---------- Dashboard ---------- */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; margin-bottom: 18px; }
.hero-new { display: flex; align-items: center; gap: 18px; padding: 24px; border-radius: var(--radius); background: linear-gradient(135deg, #F5A11F, #D97E00); color: #fff; text-decoration: none; box-shadow: 0 8px 24px rgba(232,144,12,.3); transition: transform .15s; }
.hero-new:hover { transform: translateY(-2px); }
.hero-new strong { display: block; font-size: 21px; }
.hero-new small { opacity: .9; font-size: 13.5px; }
.hero-icon { width: 54px; height: 54px; border-radius: 14px; background: rgba(255,255,255,.2); display: grid; place-items: center; flex: none; }
.hero-icon .ic { width: 30px; height: 30px; }
.hero-search { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 12px 12px 18px; color: var(--muted); }
.hero-search input { border: 0; box-shadow: none !important; padding: 10px 0; font-size: 16px; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 26px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; box-shadow: var(--shadow); display: flex; flex-direction: column; border-top: 3px solid var(--border); transition: transform .15s; }
.stat:hover { transform: translateY(-2px); }
.stat span { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat strong { font-size: 30px; font-weight: 700; margin: 2px 0; }
.stat small { font-size: 12px; color: var(--muted); }
.s-qebul { border-top-color: var(--c-qebul); } .s-temir { border-top-color: var(--c-temir); }
.s-hazir { border-top-color: var(--c-hazir); } .s-tehvil { border-top-color: var(--c-tehvil); }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.section-head h2 { font-size: 17px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.orders, table.simple { width: 100%; border-collapse: collapse; font-size: 14px; }
.orders th, .simple th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); padding: 11px 16px; border-bottom: 1px solid var(--border); }
.orders td, .simple td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.orders tbody tr { cursor: pointer; transition: background .1s; }
.orders tbody tr:hover { background: var(--surface-2); }
.orders tbody tr:last-child td { border-bottom: 0; }
.orders a { text-decoration: none; }
.orders td a.mono { color: var(--brand-ink); white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 40px; }

.toolbar { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px; overflow-x: auto; }
.tabs a { padding: 8px 14px; border-radius: 9px; text-decoration: none; font-size: 14px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.tabs a.on { background: var(--brand); color: #fff; }
.search-inline { display: flex; gap: 8px; }
.search-inline input { width: 260px; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pager a { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); text-decoration: none; }
.pager a.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- Order view ---------- */
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.page-title { display: flex; align-items: center; gap: 12px; }
.page-title h2 { font-size: 24px; }
.act-ready { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 18px 20px; border-radius: var(--radius); background: var(--c-hazir-bg); border: 1px solid color-mix(in srgb, var(--c-hazir) 30%, transparent); margin-bottom: 18px; }
.act-ready strong { display: block; color: var(--c-hazir); font-size: 17px; }
.act-ready span { font-size: 14px; }
.status-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 18px; }
.step-btn { width: 100%; padding: 12px 8px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; transition: all .15s; }
.step-btn:hover { border-color: currentColor; }
.step-btn.st-qebul:hover, .step-btn.st-qebul.on { color: var(--c-qebul); }
.step-btn.st-temir:hover, .step-btn.st-temir.on { color: var(--c-temir); }
.step-btn.st-hazir:hover, .step-btn.st-hazir.on { color: var(--c-hazir); }
.step-btn.st-tehvil:hover, .step-btn.st-tehvil.on { color: var(--c-tehvil); }
.step-btn.on { cursor: default; border-color: currentColor; box-shadow: inset 0 0 0 1px currentColor; }
.step-btn.st-qebul.on { background: var(--c-qebul-bg); } .step-btn.st-temir.on { background: var(--c-temir-bg); }
.step-btn.st-hazir.on { background: var(--c-hazir-bg); } .step-btn.st-tehvil.on { background: var(--c-tehvil-bg); }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.col-side { position: sticky; top: 84px; }
.info { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 20px; margin: 0; }
.info div { min-width: 0; }
.info .wide { grid-column: 1 / -1; }
.info dt { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 2px; }
.info dd { margin: 0; overflow-wrap: anywhere; }
.info dd a { color: var(--brand-ink); }
.doc { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.doc:last-of-type { border-bottom: 0; }
.doc-name small { display: block; color: var(--muted); font-size: 12px; }
.history { margin-top: 10px; font-size: 13px; }
.history summary { cursor: pointer; color: var(--muted); }
.history ul { padding-left: 18px; margin: 8px 0 0; }
.print-frame { position: fixed; width: 0; height: 0; border: 0; visibility: hidden; }
.logo-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 14px; }
.logo-row .field { margin: 0; }
.logo-preview { height: 40px; padding: 8px; background: #fff; border: 1px solid var(--border); border-radius: 8px; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 20% 0%, var(--brand-soft), var(--bg) 55%); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); padding: 32px 28px; }
.login-logo { display: block; height: 40px; margin: 0 auto 6px; }
.login-card .muted { margin: 0 0 22px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .cols { grid-template-columns: 1fr; }
  .col-side { position: static; }
  .g4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; }
  .nav-open .sidebar { transform: none; }
  .nav-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 35; }
  .menu-btn { display: grid; border: 0; background: none; color: var(--text); padding: 6px; cursor: pointer; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .top-search { display: none; }
  .top-new { margin-left: auto; padding: 8px 12px; }
  .content { padding: 16px 16px 60px; }
  .hero { grid-template-columns: 1fr; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .info { grid-template-columns: 1fr 1fr; }
  .search-inline { width: 100%; }
  .search-inline input { width: 100%; }
  .card { padding: 16px; }
  .thumb-del { opacity: 1; }
}
@media (max-width: 600px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .stat:first-child { grid-column: 1 / -1; }
  .g4 { grid-template-columns: 1fr; }
  .top-new span { display: none; }
  .status-steps { grid-template-columns: 1fr 1fr; }
  .hero-new strong { font-size: 18px; }
  .hero-search { padding: 8px 8px 8px 14px; }
  .sticky-actions .btn-lg { flex: 1; }
  table.orders thead { display: none; }
  table.orders, .orders tbody, .orders tr, .orders td { display: block; width: 100%; }
  .orders tr { padding: 12px 14px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
  .orders td { padding: 0; border: 0; }
  .orders td[data-l="Status"] { grid-column: 2; grid-row: 1; }
  .orders td[data-l="Cihaz"] br { display: none; }
  .orders td[data-l="Cihaz"] .muted::after { content: " · "; }
  .orders td[data-l="Qəbul tarixi"] { font-size: 12.5px; color: var(--muted); }
  .info { grid-template-columns: 1fr; }
  .page-title h2 { font-size: 20px; }
}
