/* ============================================================
   BusinessOS Design System v6 — mobile-first
   Every class name from the previous stylesheet is preserved,
   so no template breaks. This changes how things LOOK only.
   Base rules = phone. @media blocks upgrade to tablet/desktop.
   ============================================================ */
:root {
  --bg: #f4f6fa; --surface: #ffffff; --surface-alt: #fafbfd;
  --text: #0f172a; --text-muted: #64748b; --text-soft: #94a3b8;
  --border: #e5e9f0; --border-strong: #cbd5e1;
  --primary: #2563eb; --primary-dark: #1d4ed8; --accent: #f59e0b;
  --success: #16a34a; --success-bg: #dcfce7;
  --danger: #dc2626; --danger-bg: #fee2e2;
  --warning: #f59e0b; --warning-bg: #fef3c7;
  --radius: 14px; --radius-sm: 10px; --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06);
  --shadow: 0 2px 4px rgba(15,23,42,.04), 0 6px 16px rgba(15,23,42,.06);
  --ease: cubic-bezier(.4,0,.2,1);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Arabic", sans-serif;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body { margin:0; background:var(--bg); color:var(--text); font-size:15px; line-height:1.55; -webkit-font-smoothing:antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar { display:flex; align-items:center; justify-content:space-between; background:var(--surface);
  border-bottom:1px solid var(--border); padding:12px 16px; flex-wrap:wrap; gap:10px;
  position:sticky; top:0; z-index:50; box-shadow:var(--shadow-sm); }
.brand { font-weight:800; font-size:18px; color:var(--text); letter-spacing:-.02em; }
.brand span { color: var(--primary); }
.topnav { display:flex; align-items:center; gap:6px; font-size:14px; width:100%;
  overflow-x:auto; -webkit-overflow-scrolling:touch; scrollbar-width:none; padding-bottom:2px; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { color:var(--text-muted); padding:8px 12px; border-radius:var(--radius-pill);
  white-space:nowrap; font-weight:600; transition:background .18s var(--ease), color .18s var(--ease); }
.topnav a:hover { background:var(--bg); color:var(--text); text-decoration:none; }
.biz-name { font-weight:700; padding:6px 12px; border-radius:var(--radius-pill);
  background:rgba(37,99,235,.10); color:var(--primary); white-space:nowrap;
  display:inline-flex; align-items:center; gap:6px; }
.logout { color: var(--text-soft) !important; }
.content { max-width:1180px; margin:0 auto; padding:18px 14px 60px; }

h1 { font-size:24px; font-weight:800; margin:0 0 4px; letter-spacing:-.02em; }
h2 { font-size:17px; font-weight:700; margin:22px 0 10px; letter-spacing:-.01em; }
.page-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:18px; }
.eyebrow, .section-kicker { font-size:11px; font-weight:700; letter-spacing:.09em; text-transform:uppercase; color:var(--text-soft); margin:0 0 4px; }
.section-title { font-size:18px; font-weight:700; margin:0; }

.flash { padding:13px 16px; border-radius:var(--radius-sm); margin-bottom:14px; font-size:14px; font-weight:500; display:flex; gap:8px; border-left:4px solid transparent; }
.flash-error { background:var(--danger-bg); color:#991b1b; border-left-color:var(--danger); }
.flash-success { background:var(--success-bg); color:#14532d; border-left-color:var(--success); }

.card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:18px; box-shadow:var(--shadow-sm); margin-bottom:14px; }
.workflow-card { border-top:3px solid var(--primary); }
.alert-card { background:var(--warning-bg); border:1px solid #fcd34d; border-radius:var(--radius); padding:14px 16px; margin-bottom:14px; display:flex; flex-direction:column; gap:4px; font-size:14px; }
.grid { display:grid; gap:12px; }
.grid-3 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: 1fr; }

.stat { display:flex; flex-direction:column; gap:2px; padding:20px; }
.stat .num { font-size:34px; font-weight:800; line-height:1.1; letter-spacing:-.03em; color:var(--text); font-variant-numeric:tabular-nums; }
.stat .label { color:var(--text-muted); font-size:13px; font-weight:600; }

.table-wrap { overflow-x:auto; -webkit-overflow-scrolling:touch; border-radius:var(--radius-sm); border:1px solid var(--border); background:var(--surface); }
table { width:100%; border-collapse:collapse; font-size:14px; min-width:460px; }
th, td { text-align:left; padding:12px 14px; border-bottom:1px solid var(--border); }
th { color:var(--text-soft); font-weight:700; font-size:11px; text-transform:uppercase; letter-spacing:.06em; background:var(--surface-alt); }
tr:last-child td { border-bottom:none; }
tbody tr { transition: background .15s var(--ease); }
tbody tr:hover { background: var(--surface-alt); }

button, .btn { display:inline-flex; align-items:center; justify-content:center; gap:7px;
  background:var(--primary); color:#fff; border:1px solid transparent; border-radius:var(--radius-sm);
  padding:12px 18px; font-size:15px; font-weight:600; font-family:inherit; cursor:pointer;
  text-decoration:none; min-height:46px;
  transition:transform .12s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease), filter .18s var(--ease);
  box-shadow:var(--shadow-sm); }
button:hover, .btn:hover { filter:brightness(1.06); box-shadow:var(--shadow); text-decoration:none; }
button:active, .btn:active { transform: translateY(1px); box-shadow: var(--shadow-sm); }
button:disabled { opacity:.5; cursor:not-allowed; transform:none; }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline:3px solid rgba(37,99,235,.35); outline-offset:1px; }
.btn-secondary, button.btn-secondary { background:var(--surface); color:var(--text); border:1px solid var(--border-strong); }
.btn-secondary:hover { background:var(--surface-alt); filter:none; }
.btn-danger, button.btn-danger { background: var(--danger); }
.btn-print { background: var(--primary); }
.btn-whatsapp { background: #25D366; }

form.inline { display: inline; }
.form-grid { display:grid; grid-template-columns:1fr; gap:12px; }
.field-wide { grid-column: 1 / -1; }
.compact-form { display:flex; flex-wrap:wrap; gap:10px; align-items:flex-end; }
label { display:block; font-size:12px; font-weight:600; color:var(--text-muted); margin-bottom:5px; text-transform:uppercase; letter-spacing:.04em; }
input, select, textarea { width:100%; padding:12px 14px; font-size:16px; font-family:inherit; color:var(--text);
  background:var(--surface); border:1px solid var(--border-strong); border-radius:var(--radius-sm); min-height:46px;
  transition:border-color .18s var(--ease), box-shadow .18s var(--ease); }
input:focus, select:focus, textarea:focus { border-color:var(--primary); box-shadow:0 0 0 3px rgba(37,99,235,.15); outline:none; }
textarea { min-height:100px; resize:vertical; line-height:1.5; }
input[type="color"] { padding:4px; height:46px; cursor:pointer; }
input[type="file"] { padding:9px; background:var(--surface-alt); font-size:14px; }

.badge, .status-chip, .module-pill, .module-tag { display:inline-flex; align-items:center; gap:5px;
  padding:5px 11px; border-radius:var(--radius-pill); font-size:12px; font-weight:700; letter-spacing:.02em;
  background:var(--bg); color:var(--text-muted); border:1px solid var(--border); white-space:nowrap; }
.badge-active, .status-active, .status-approved, .status-done, .status-completed,
.status-paid, .status-ready, .status-delivered { background:var(--success-bg); color:#14532d; border-color:#86efac; }
.status-open, .status-received, .status-booked, .status-planning, .status-pending { background:#dbeafe; color:#1e40af; border-color:#93c5fd; }
.status-awaiting_approval, .status-in_progress, .status-diagnosing, .badge-blueprint,
.status-blueprint, .status-on_hold, .status-reserved { background:var(--warning-bg); color:#92400e; border-color:#fcd34d; }
.status-cancelled, .status-overdue, .status-void, .status-suspended,
.badge-suspended { background:var(--danger-bg); color:#991b1b; border-color:#fca5a5; }
.required-tag { background:rgba(37,99,235,.12); color:var(--primary); border-color:transparent; }
.module-pill { background:var(--surface); box-shadow:var(--shadow-sm); }

.pos-grid { display:grid; gap:10px; grid-template-columns:repeat(auto-fill, minmax(140px,1fr)); }
.product-btn, .variant-btn, .pick { display:flex; flex-direction:column; align-items:flex-start; gap:3px;
  background:var(--surface); color:var(--text); border:1px solid var(--border-strong); border-radius:var(--radius-sm);
  padding:14px; min-height:76px; font-weight:600; text-align:left; cursor:pointer; box-shadow:var(--shadow-sm);
  transition:transform .12s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease); }
.product-btn:hover, .variant-btn:hover, .pick:hover { border-color:var(--primary); box-shadow:var(--shadow); filter:none; }
.product-btn:active, .variant-btn:active, .pick:active { transform: scale(.97); }
.product-btn .cost, .product-btn .qty, .muted { color:var(--text-muted); font-size:12px; font-weight:500; }

.totals { display:flex; flex-direction:column; gap:6px; }
.row, .total-line { display:flex; justify-content:space-between; align-items:center; padding:6px 0; font-size:14px; }
.grand { font-size:20px; font-weight:800; color:var(--primary); border-top:2px solid var(--border); padding-top:12px; margin-top:6px; }
.empty-state { text-align:center; padding:44px 20px; color:var(--text-muted); background:var(--surface-alt);
  border:1px dashed var(--border-strong); border-radius:var(--radius); }
.answer-box { background:var(--surface-alt); border:1px solid var(--border); border-radius:var(--radius-sm);
  padding:16px; margin-top:12px; white-space:pre-wrap; line-height:1.6; }

@media (min-width: 768px) {
  .topbar { padding:14px 24px; flex-wrap:nowrap; }
  .topnav { width:auto; gap:4px; overflow-x:visible; }
  .content { padding:26px 22px 70px; }
  h1 { font-size: 28px; }
  .grid { gap: 16px; }
  .grid-3 { grid-template-columns: repeat(auto-fit, minmax(210px,1fr)); }
  .grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px,1fr)); }
  .form-grid { grid-template-columns: repeat(auto-fit, minmax(190px,1fr)); }
  table { min-width: 0; }
  input, select, textarea { font-size: 15px; }
  button, .btn { min-height:42px; padding:10px 18px; }
  .stat .num { font-size: 38px; }
  .pos-grid { grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); }
}
@media (min-width: 1100px) {
  .content { padding: 30px 26px 80px; }
  .stat { padding: 22px 24px; }
  .card { padding: 22px; }
}

[dir="rtl"] th, [dir="rtl"] td { text-align: right; }
[dir="rtl"] .flash { border-left:none; border-right:4px solid transparent; }
[dir="rtl"] .flash-error { border-right-color: var(--danger); }
[dir="rtl"] .flash-success { border-right-color: var(--success); }
[dir="rtl"] .product-btn, [dir="rtl"] .pick { text-align:right; align-items:flex-end; }

@media print {
  .topbar, .topnav, .flash, button, .btn { display:none !important; }
  body { background:#fff; }
  .card { box-shadow:none; border:none; padding:0; }
  .content { padding:0; max-width:none; }
}
@media (prefers-reduced-motion: reduce) { * { transition:none !important; animation:none !important; } }

/* ============================================================
   Personal Money Manager Pro v7.3 — dense desktop, calm mobile
   ============================================================ */
.period-pills { display:flex; flex-wrap:wrap; gap:8px; }
.period-pills .btn-secondary { min-height:38px; padding:8px 12px; font-size:13px; }
.period-pills .is-selected { background:var(--primary); color:#fff; border-color:var(--primary); }
.report-toolbar { display:flex; flex-direction:column; gap:12px; }
.custom-range-form { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.custom-range-form button { grid-column:1 / -1; }
.amount-positive { color:var(--success) !important; }
.amount-negative { color:var(--danger) !important; }
.report-list { display:flex; flex-direction:column; gap:13px; margin-top:14px; }
.report-list-row { display:flex; flex-direction:column; gap:6px; }
.report-list-main, .summary-line { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.mini-bar { height:7px; background:var(--bg); border-radius:999px; overflow:hidden; }
.mini-bar > span { display:block; height:100%; border-radius:inherit; background:var(--primary); min-width:0; }
.summary-stack { display:flex; flex-direction:column; gap:12px; margin-top:14px; }
.currency-summary + .currency-summary { padding-top:10px; border-top:1px solid var(--border); }
.compact-empty { padding:24px 14px; margin-top:12px; }
.action-button { min-height:34px; padding:6px 10px; font-size:12px; }
.action-menu summary { list-style:none; }
.action-menu summary::-webkit-details-marker { display:none; }
.inline-action-form { display:flex; gap:6px; align-items:center; margin-top:8px; min-width:260px; }
.inline-action-form input { min-height:38px; padding:8px 10px; font-size:14px; }
.inline-action-form button { min-height:38px; padding:8px 10px; font-size:12px; }

@media (min-width: 768px) {
  .report-toolbar { flex-direction:row; align-items:center; justify-content:space-between; }
  .custom-range-form { display:flex; align-items:center; }
  .custom-range-form input { width:145px; min-height:38px; padding:7px 9px; font-size:13px; }
  .custom-range-form button { min-height:38px; padding:8px 12px; font-size:13px; }
}

@media (max-width: 640px) {
  .content { padding:14px 10px 88px; }
  .card { padding:14px; border-radius:12px; }
  .stat { padding:16px; }
  .stat .num { font-size:28px; }
  .metric-grid { grid-template-columns:1fr 1fr; }
  .metric-grid .card:last-child { grid-column:1 / -1; }
  .responsive-table { border:0; background:transparent; overflow:visible; }
  .responsive-table table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display:block; width:100%; min-width:0; }
  .responsive-table thead { display:none; }
  .responsive-table tr { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:8px 12px; margin-bottom:10px; box-shadow:var(--shadow-sm); }
  .responsive-table td { border:0; padding:7px 0; display:flex; justify-content:space-between; align-items:flex-start; gap:12px; text-align:end; }
  .responsive-table td::before { content:attr(data-label); color:var(--text-muted); font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; text-align:start; }
  .responsive-table td:first-child { padding-top:4px; }
  .responsive-table td:last-child { padding-bottom:4px; }
  .inline-action-form { min-width:0; width:100%; flex-direction:column; align-items:stretch; }
  .inline-action-form input, .inline-action-form button { width:100%; }
  .period-pills { display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); }
  .period-pills .btn-secondary { width:100%; }
}
