:root { color-scheme: light; }
* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f8fafc;
  color: #0f172a;
  margin: 0;
  padding: 0;
}
input, button, select {
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-family: inherit;
}
button { background: #111827; color: white; border: none; cursor: pointer; }
button:hover { background: #1f2937; }
button.secondary { background: white; color: #111827; border: 1px solid #cbd5e1; }
button.danger { background: #dc2626; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- login screen --- */
#login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
#login-screen .card { width: 360px; }
.card { background: white; border: 1px solid #e2e8f0; border-radius: 12px; padding: 20px; margin-bottom: 20px; overflow-x: auto; }
.card h2 { font-size: 15px; margin: 0 0 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 8px; }
.error { color: #dc2626; font-size: 13px; margin-top: 6px; }

/* --- app shell --- */
#app-shell { display: none; min-height: 100vh; grid-template-columns: 240px 1fr; }
#app-shell.visible { display: grid; }
#sidebar { background: #111827; color: #e2e8f0; padding: 16px 0; overflow-y: auto; }
#sidebar .brand { padding: 0 20px 16px; font-weight: 700; font-size: 15px; color: white; border-bottom: 1px solid #1f2937; margin-bottom: 8px; }
#sidebar nav { display: flex; flex-direction: column; }
.nav-group-label { padding: 14px 20px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: #64748b; }
.nav-link { padding: 8px 20px; color: #cbd5e1; text-decoration: none; font-size: 13px; cursor: pointer; display: block; }
.nav-link:hover { background: #1f2937; color: white; }
.nav-link.active { background: #1f2937; color: white; border-left: 3px solid #6366f1; padding-left: 17px; }
.nav-link.sub { padding-left: 32px; }
.nav-link.sub.active { padding-left: 29px; }

#main-area { display: flex; flex-direction: column; min-width: 0; }
#topbar { background: white; border-bottom: 1px solid #e2e8f0; padding: 14px 24px; display: flex; justify-content: space-between; align-items: center; }
#topbar h1 { font-size: 16px; margin: 0; }
#topbar .who { font-size: 13px; color: #64748b; }
#content { padding: 24px; max-width: 1100px; width: 100%; margin: 0 auto; }

table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid #e2e8f0; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge.active { background: #dcfce7; color: #166534; }
.badge.suspended { background: #fee2e2; color: #991b1b; }
.badge.none { background: #f1f5f9; color: #64748b; }
.muted { color: #64748b; font-size: 12px; }
code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-tile { background: white; border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px; }
.stat-tile .value { font-size: 24px; font-weight: 700; }
.stat-tile .label { font-size: 12px; color: #64748b; margin-top: 2px; }

.placeholder-card { background: white; border: 1px dashed #cbd5e1; border-radius: 12px; padding: 32px; text-align: center; }
.placeholder-card .title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.placeholder-card .desc { font-size: 13px; color: #64748b; max-width: 420px; margin: 0 auto; }
.placeholder-tag { display: inline-block; margin-top: 12px; font-size: 11px; font-weight: 600; letter-spacing: 0.03em; color: #92400e; background: #fef3c7; padding: 3px 10px; border-radius: 999px; }

/* Utility classes — used instead of inline style="" attributes so the CSP
   can stay free of style-src-attr 'unsafe-inline' (see app.ts's CSP
   comment: Helmet blocks inline style/script attributes by default, and
   this admin UI has no build step to inject nonces). */
.hidden { display: none; }
.row-tight { margin: 0; }
.w-narrow { width: 80px; }
.stat-tile .value.ok { color: #166534; font-size: 15px; }
.stat-tile .value.fail { color: #991b1b; font-size: 15px; }

/* --- Phase 2: My Shop screens --- */
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: #475569; margin: 0 0 10px; }
.section-title:not(:first-child) { margin-top: 28px; }

.list-toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.list-toolbar input[type="search"] { flex: 1; min-width: 200px; }
.list-toolbar select { min-width: 160px; }
.toolbar-check { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 400; color: #334155; white-space: nowrap; }
.toolbar-check input { width: auto; }

.badge-pending { background: #fef3c7; color: #92400e; }
.badge-repaired { background: #dbeafe; color: #1e40af; }
.badge-delivered { background: #dcfce7; color: #166534; }

.row-action { font-size: 12px; padding: 5px 10px; }

.form-error {
  background: #fee2e2; color: #991b1b; border: 1px solid #fecaca;
  border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px;
}
.form-success {
  background: #dcfce7; color: #166534; border: 1px solid #bbf7d0;
  border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px;
}

/* --- Forms (customer modal, shop settings) --- */
fieldset { border: none; border-top: 1px solid #e2e8f0; padding: 14px 0 0; margin: 0 0 14px; }
fieldset:first-of-type { border-top: none; padding-top: 0; }
legend { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: #64748b; padding: 0; margin-bottom: 10px; }
fieldset label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: #334155; margin-bottom: 10px; }
fieldset label input, fieldset label select, fieldset label textarea { font-weight: 400; width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 12px; }
.form-checks { display: flex; flex-direction: column; gap: 8px; }
.form-checks .check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.form-checks .check input { width: auto; }

.logo-row { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.logo-row img { width: 64px; height: 64px; object-fit: contain; border: 1px solid #e2e8f0; border-radius: 10px; padding: 6px; background: #f8fafc; }

/* --- Modal --- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow-y: auto; z-index: 1000;
}
.modal-card { background: white; border-radius: 14px; width: 100%; max-width: 640px; box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid #e2e8f0; }
.modal-header h2 { font-size: 15px; margin: 0; }
.modal-body { padding: 20px; max-height: 65vh; overflow-y: auto; }
.modal-footer { padding: 14px 20px; border-top: 1px solid #e2e8f0; display: flex; justify-content: flex-end; gap: 8px; }
.icon-btn { background: transparent; color: #64748b; border: none; font-size: 16px; padding: 4px 8px; }
.icon-btn:hover { background: #f1f5f9; color: #0f172a; }

/* --- Mobile: collapsible sidebar ---
   .sidebar-backdrop must default to display:none OUTSIDE the media query
   too: it's the first child of the #app-shell grid at every width, and a
   bare <div> is display:block by default — without this base rule it
   silently eats the sidebar's grid column (240px) at desktop widths too,
   pushing #sidebar and #main-area both into the wrong track. Caught via a
   real getBoundingClientRect() check during Phase 2 verification, not
   just a visual glance — the layout still "looked" like two columns. */
#mobile-nav-toggle { display: none; }
.sidebar-backdrop { display: none; }
@media (max-width: 860px) {
  #app-shell.visible { display: block; }
  #sidebar {
    position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%);
    transition: transform 0.2s ease; z-index: 900; box-shadow: 4px 0 24px rgba(0,0,0,0.2);
  }
  #sidebar.open { transform: translateX(0); }
  #main-area { min-height: 100vh; }
  #mobile-nav-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; padding: 0; margin-right: 10px;
    background: white; color: #111827; border: 1px solid #cbd5e1;
  }
  #topbar { padding: 14px 16px; }
  #topbar-left { display: flex; align-items: center; }
  .sidebar-backdrop.visible { display: block; position: fixed; inset: 0; background: rgba(15,23,42,0.4); z-index: 890; }
}

/* --- Phase 3: Kasa/Raporlar payment & trend bars --- */
.payment-bar-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f1f5f9; }
.payment-bar-row:last-child { border-bottom: none; }
.payment-bar-label { width: 110px; flex-shrink: 0; font-size: 12px; font-weight: 600; color: #334155; }
.payment-bar-track { flex: 1; background: #f1f5f9; border-radius: 999px; height: 10px; overflow: hidden; }
.payment-bar-fill { background: #6366f1; height: 100%; border-radius: 999px; transition: width 0.3s ease; }
.payment-bar-value { width: 130px; flex-shrink: 0; text-align: right; font-size: 12px; font-weight: 600; }

.trend-bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding: 10px 0; }
.trend-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.trend-bar { width: 100%; background: #6366f1; border-radius: 4px 4px 0 0; min-height: 2px; }
.trend-bar-label { font-size: 10px; color: #64748b; white-space: nowrap; }

.simple-list-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.simple-list-row:last-child { border-bottom: none; }
