/* ==========================================================================
   SOBE PAZARYERI ERP — QUIET MODERN MINIMAL UI (CALM WHITESPACE · ZERO CLUTTER)
   ========================================================================== */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --subtle: #f1f5f9;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --accent: #f58220;
  --accent-hover: #e2700f;
  --accent-soft: #fff7ed;
  --accent-ink: #c2410c;
  --blue: #2563eb;
  --ok-bg: #ecfdf5;
  --ok-ink: #047857;
  --warn-bg: #fffbeb;
  --warn-ink: #b45309;
  --err-bg: #fef2f2;
  --err-ink: #b91c1c;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { text-align: right; white-space: nowrap; }
.muted { color: var(--muted); }

/* SHELL */
.sobe-layout {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: 100dvh;
}

/* CALM SIDEBAR */
.sobe-sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 14px 12px;
}

.sobe-sidebar-top {
  padding: 2px 4px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.sobe-brand-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  padding: 4px;
  border-radius: 8px;
  text-align: left;
}
.sobe-brand-btn:hover { background: var(--bg); }
.sobe-brand-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.sobe-brand-name span { color: var(--accent); }

.sobe-sidenav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1 1 auto;
  overflow-y: auto;
}

.side-link {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-weight: 500;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}
.side-link-left { display: flex; align-items: center; gap: 10px; }
.side-link:hover { background: var(--bg); color: var(--ink); }
.side-link.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 700;
}
.side-link-badge {
  background: var(--subtle);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
}
.side-link.active .side-link-badge {
  background: #ffedd5;
  color: var(--accent-ink);
}

.side-sep {
  height: 1px;
  background: var(--border);
  margin: 8px 4px;
}

.sobe-sidebar-foot {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sobe-foot-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: none;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--ink-2);
  text-align: left;
}
.sobe-foot-btn:hover { background: var(--bg); }
.sobe-dot-ok { width: 7px; height: 7px; border-radius: 50%; background: #10b981; flex-shrink: 0; }
.sobe-foot-meta { font-size: 11px; color: var(--muted); padding: 0 6px; font-family: var(--mono); }

/* WORKSPACE + HEADER */
.sobe-workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.sobe-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 56px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.sobe-header-left { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; }
.sobe-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  width: 100%;
  max-width: 380px;
}
.sobe-search-box:focus-within { border-color: var(--accent); background: #fff; }
.sobe-search-box input { border: none; background: transparent; width: 100%; outline: none; font-size: 13px; }

.sobe-header-right { display: flex; align-items: center; gap: 8px; }
.sobe-header-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.sobe-header-btn:hover { background: var(--bg); border-color: var(--border-strong); }
.sobe-count-badge {
  background: var(--err-bg);
  color: var(--err-ink);
  border-radius: 999px;
  padding: 0 6px;
  font-size: 11px;
  font-weight: 700;
}

.sobe-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.sobe-mobile-only { display: none; }

/* MAIN CONTENT CONTAINER */
.sobe-main {
  padding: 26px 28px 40px;
  max-width: 1260px;
  width: 100%;
  margin: 0 auto;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* SEGMENT SUB-TABS (MAX 4-5 CLEAN TEXT PILLS) */
.subtabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
}
.subtab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 9px 14px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.subtab-btn:hover { color: var(--ink); }
.subtab-btn.active {
  color: var(--accent-ink);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* CARDS & GRIDS */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  min-width: 0;
  max-width: 100%;
}
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }

.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; margin-bottom: 6px; }
.kpi-value { font-size: 26px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* CLEAN BUTTONS */
.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn-secondary:hover { background: var(--bg); border-color: var(--border-strong); }

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border: none;
  border-radius: 7px;
  padding: 6px 10px;
  font-weight: 500;
}
.btn-ghost:hover { background: var(--subtle); color: var(--ink); }

.btn-danger {
  background: var(--err-bg);
  color: var(--err-ink);
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 7px 12px;
  font-weight: 600;
}

/* TOOLBAR & INPUTS */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; max-width: 100%; }

.input, .select, .textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 11px;
  min-height: 36px;
  max-width: 100%;
  min-width: 0;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); outline: none; }

/* TABLE (BREATHING ROOM, NO CRAMMING) */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data-table thead th {
  background: var(--bg);
  color: var(--muted);
  font-weight: 600;
  font-size: 11.5px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}
table.data-table thead th.num { text-align: right; }
table.data-table tbody td {
  padding: 13px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
table.data-table tbody tr:hover { background: #fffaf5; }
table.data-table tbody tr:last-child td { border-bottom: none; }

/* STATUS BADGES (CALM MUTED PILLS) */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.pill-ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill-warn { background: var(--warn-bg); color: var(--warn-ink); }
.pill-err { background: var(--err-bg); color: var(--err-ink); }
.pill-info { background: #eff6ff; color: #1d4ed8; }
.pill-muted { background: var(--subtle); color: var(--ink-2); }

/* LIST ROWS */
.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid #f1f5f9;
}
.list-row:last-child { border-bottom: none; }

/* POS & PACKING SPLIT */
.split-view {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) 360px;
  gap: 18px;
}
.pos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.pos-item-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  text-align: left;
}
.pos-item-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.pos-total { font-size: 32px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* MARKETPLACE GRID */
.mp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}
.mp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}
.mp-card:hover { border-color: var(--accent); background: var(--accent-soft); }

/* MOBILE CARDS (<900px) */
.mobile-cards-list { display: none; }
.mobile-record-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 14px;
  margin-bottom: 10px;
}

/* MODAL, DRAWER, TOAST */
.sobe-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 90;
}
.sobe-modal-backdrop[hidden] { display: none; }
.sobe-modal {
  background: var(--surface);
  border-radius: 14px;
  width: 100%;
  max-width: 720px;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(15,23,42,0.22);
  overflow: hidden;
}
.sobe-modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sobe-modal-title { margin: 0; font-size: 16px; font-weight: 700; color: var(--ink); }
.sobe-modal-body { padding: 18px 20px; overflow-y: auto; flex: 1 1 auto; }
.sobe-modal-foot { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--bg); display: flex; justify-content: flex-end; gap: 8px; }

.sobe-mobile-drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 264px;
  background: var(--surface);
  z-index: 95;
  padding: 14px;
  display: flex;
  flex-direction: column;
  box-shadow: 12px 0 30px rgba(15,23,42,0.18);
}
.sobe-mobile-drawer[hidden] { display: none; }
.sobe-mobile-drawer-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.sobe-btn-light { background: var(--subtle); border: 1px solid var(--border); border-radius: 7px; padding: 6px 11px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.sobe-mobile-nav-list { display: flex; flex-direction: column; gap: 4px; }
.sobe-mobile-nav-list button { background: transparent; border: none; text-align: left; padding: 11px 12px; border-radius: 8px; font-weight: 500; color: var(--ink-2); }
.sobe-mobile-nav-list button.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; }

.sobe-toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.sobe-toast { background: var(--ink); color: #fff; border-radius: 9px; padding: 10px 14px; font-size: 13px; font-weight: 500; box-shadow: 0 10px 25px rgba(15,23,42,0.22); }
.sobe-toast.err { background: #991b1b; }
.sobe-toast.ok { background: #065f46; }

/* BAR CHART */
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 130px; padding-top: 8px; }
.bar-col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.bar-fill { width: 100%; max-width: 24px; border-radius: 4px 4px 0 0; background: var(--accent); }
.bar-lbl { font-size: 10.5px; color: var(--muted); }

/* PRINT */
.sobe-print-host { display: none; }
@media print {
  body > *:not(.sobe-print-host) { display: none !important; }
  .sobe-print-host { display: block !important; padding: 16px; }
}

/* MOBILE <900px */
@media (max-width: 900px) {
  .sobe-layout { grid-template-columns: 1fr; }
  .sobe-sidebar { display: none; }
  .sobe-mobile-only { display: inline-flex; }
  .sobe-header { padding: 0 12px; }
  .sobe-search-box { max-width: none; }
  .sobe-main { padding: 16px 12px 28px; }
  .grid-2, .grid-3, .grid-4, .split-view { grid-template-columns: 1fr; }
  .table-wrap { display: none; }
  .mobile-cards-list { display: block; }
  .input, .select, .textarea { font-size: 16px; min-height: 44px; }
  .btn-primary, .btn-secondary { min-height: 44px; }
}
