@font-face {
  font-family: "Noto Sans Georgian";
  src: url("../fonts/noto-sans-georgian/NotoSansGeorgian-400.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans Georgian";
  src: url("../fonts/noto-sans-georgian/NotoSansGeorgian-700.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Noto Sans Georgian";
  src: url("../fonts/noto-sans-georgian/NotoSansGeorgian-900.ttf") format("truetype");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}
:root {
  --bg: #f6f7fb;
  --sidebar: #111827;
  --primary: #16a34a;
  --primary-dark: #15803d;
  --brand-blue: #2563eb;
  --brand-cyan: #0891b2;
  --brand-indigo: #4f46e5;
  --brand-violet: #7c3aed;
  --brand-pink: #db2777;
  --brand-amber: #f59e0b;
  --brand-rose: #e11d48;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #f59e0b;
  --info: #0891b2;
  --text: #111827;
  --muted: #64748b;
  --card: #ffffff;
  --surface: #ffffff;
  --hover: #f1f5f9;
  --border: #e5e7eb;
  --shadow: 0 18px 45px rgba(79, 70, 229, 0.13);
  --shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.08);
  --font-ui: "Noto Sans Georgian", "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: "Noto Sans Georgian", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-number: "Segoe UI", "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 15.5px;
  line-height: 1.6;
  font-weight: 450;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--text);
  background: #f5f7fb;
}
a { color: inherit; text-decoration: none; }
input, select, textarea, button { font-family: var(--font-ui); font-size: 14px; }
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(5, 46, 22, .88), rgba(21, 128, 61, .66)),
    url("../images/siteicon.jpeg") center/cover no-repeat;
}
.login-wrap {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1fr 430px;
  min-height: 560px;
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(4, 30, 14, .32);
  overflow: hidden;
}
.login-hero {
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
  background:
    linear-gradient(160deg, rgba(6, 78, 59, .95), rgba(21, 128, 61, .84)),
    url("../images/siteicon.jpeg") center/cover no-repeat;
}
.login-hero img { width: 62px; height: 62px; object-fit: cover; border-radius: 8px; border: 2px solid rgba(255,255,255,.65); }
.login-hero h1 { margin: 18px 0 8px; font-family: var(--font-display); font-size: 40px; line-height: 1.08; font-weight: 900; }
.login-hero p { margin: 0; color: rgba(255,255,255,.86); max-width: 440px; }
.login-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 28px; }
.login-metrics span { display: grid; gap: 2px; padding: 12px; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; background: rgba(255,255,255,.1); font-size: 12px; }
.login-metrics strong { font-size: 20px; }
.login-card {
  width: 100%;
  background: var(--card);
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-card h1 { margin: 0 0 8px; font-family: var(--font-display); font-size: 30px; line-height: 1.2; font-weight: 900; }
.login-card p { color: var(--muted); margin-top: 0; margin-bottom: 26px; }
.login-card .btn { width: 100%; min-height: 46px; }
.login-card input { min-height: 46px; }
.login-note { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px 1fr; }
.sidebar { background: linear-gradient(180deg, #111827 0%, #172554 42%, #064e3b 100%); color: #fff; padding: 22px 18px; position: sticky; top: 0; height: 100vh; overflow: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 900; font-size: 21px; margin-bottom: 24px; padding: 12px; border-radius: 12px; background: linear-gradient(135deg, rgba(34,197,94,.25), rgba(79,70,229,.28)); box-shadow: inset 0 1px 0 rgba(255,255,255,.16); }
.brand img { width: 34px; height: 34px; object-fit: cover; border-radius: 8px; }
.sidebar nav { display: grid; gap: 6px; }
.sidebar a { color: #dbeafe; padding: 10px 12px; border-radius: 8px; font-size: 14px; font-weight: 750; line-height: 1.35; transition: background .13s, color .13s; }
.sidebar a:hover { background: rgba(37,99,235,.22); color: #fff; }
.sidebar a.active { background: rgba(37,99,235,.28); color: #fff; border-left: 3px solid #60a5fa; padding-left: 9px; box-shadow: 0 4px 14px rgba(37,99,235,.18); }
.nav-group-label { display: block; color: #94a3b8; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 14px 12px 4px; margin-top: 4px; border-top: 1px solid rgba(148,163,184,.15); }
.main { min-width: 0; }
.topbar { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 28px; background: rgba(255,255,255,0.88); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; box-shadow: 0 8px 26px rgba(15,23,42,.04); }
.topbar-title { min-width: 0; }
.topbar h1 { margin: 0; font-family: var(--font-display); font-size: 27px; line-height: 1.18; font-weight: 900; }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.user-chip { display: grid; justify-items: end; gap: 2px; font-size: 14px; line-height: 1.35; }
.user-chip small { color: var(--muted); }
.user-chip a { color: var(--danger); font-weight: 800; }
.language-switch label, .auth-language { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.language-switch select, .auth-language select { padding: 6px 8px; min-height: 34px; border-radius: 8px; }
.burger-btn { display: none; width: 42px; height: 42px; border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 9px; }
.burger-btn span { display: block; width: 100%; height: 2px; background: var(--text); margin: 4px 0; border-radius: 999px; }
.sidebar-backdrop { display: none; }
.content { padding: 28px; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: rgba(255,255,255,.96); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-soft); padding: 22px; position: relative; }
.stat, .action-card { overflow: hidden; }
.card::before { display: none; }
.card h2, .card h3 { margin: 0 0 14px; font-family: var(--font-display); font-weight: 900; line-height: 1.22; }
.card h2 { font-size: 21px; }
.card h3 { font-size: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin-bottom: 3px; }
.card-head p { margin: 0; }
.table-card { padding: 0; }
.table-card .card-head { padding: 18px 22px; border-bottom: 1px solid var(--border); }
.table-card .table-wrap, .table-card > table { margin-top: 8px; }
.form-card { max-width: 1120px; }
.wide-form { max-width: none; width: 100%; }
.stat { display: grid; gap: 8px; min-height: 112px; color: #fff; border: 0; }
.stat::before { display: none; }
.stat span { color: rgba(255,255,255,.86); font-size: 13px; font-weight: 750; }
.stat strong { font-family: var(--font-number); font-size: 27px; line-height: 1.08; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat em { font-style: normal; font-size: 12px; color: rgba(255,255,255,.78); }
.kpi-grid .stat { min-height: 128px; }
.dashboard-actions { margin-bottom: 24px; }
.dashboard-actions + .kpi-grid { margin-top: 0; }
.dashboard-actions .action-card { min-height: 176px; }
.kpi-grid { gap: 22px; }
.kpi-grid + .kpi-grid { margin-top: 22px !important; }
.dashboard-actions + .kpi-grid,
.kpi-grid + .grid,
.dashboard-actions + .grid { clear: both; }
.accent-green { background: linear-gradient(135deg, #15803d, #22c55e); }
.accent-blue { background: linear-gradient(135deg, #2563eb, #06b6d4); }
.accent-orange { background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff; }
.accent-purple { background: linear-gradient(135deg, #7c3aed, #db2777); }
.toolbar, .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.toolbar { margin-bottom: 16px; }
.page-actions { justify-content: space-between; align-items: end; }
.filter-bar { background: rgba(255,255,255,.9); border: 1px solid var(--border); border-radius: 8px; padding: 12px; box-shadow: 0 12px 30px rgba(15,23,42,.06); }
.filter-stack { padding: 0 22px 22px; }
.stack { display: grid; gap: 12px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 850; line-height: 1.35; }
input, select, textarea { border: 1px solid var(--border); border-radius: 8px; padding: 11px 12px; background: #fff; color: var(--text); min-width: 0; font-weight: 500; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-blue); box-shadow: 0 0 0 4px rgba(37,99,235,.13); }
input:focus-visible, select:focus-visible, textarea:focus-visible, .btn:focus-visible, a:focus-visible { outline: 3px solid var(--brand-blue); outline-offset: 2px; }
.select-search { margin-bottom: 6px; border-color: #bae6fd; background: #f0f9ff; }
.table-quick-search { max-width: 260px; border-color: #bbf7d0; background: #f0fdf4; }
textarea { min-height: 84px; resize: vertical; }
.field-inline { min-width: 170px; }
.btn { border: 0; border-radius: 8px; padding: 11px 15px; min-height: 44px; cursor: pointer; font-size: 14px; font-weight: 900; line-height: 1.2; display: inline-flex; justify-content: center; align-items: center; gap: 8px; transition: .14s ease; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: linear-gradient(135deg, #1d4ed8, var(--brand-blue)); color: #fff; box-shadow: 0 4px 14px rgba(37,99,235,.28); }
.btn.primary:hover { background: linear-gradient(135deg, #1e40af, #2563eb); box-shadow: 0 8px 20px rgba(37,99,235,.38); }
.btn.success { background: linear-gradient(135deg, var(--success), #22c55e); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.light { background: linear-gradient(135deg, #eef2ff, #ecfeff); color: #1d4ed8; border: 1px solid #c7d2fe; }
.btn.warning { background: linear-gradient(135deg, var(--brand-amber), #f97316); color: #111827; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; }
th, td { padding: 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; font-size: 14px; line-height: 1.45; }
th { color: #334155; font-size: 12px; text-transform: uppercase; letter-spacing: .02em; font-weight: 900; }
td strong { font-weight: 850; }
td:nth-child(n+4), th:nth-child(n+4) { font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #f0fdf4; }
.data-table th { background: linear-gradient(180deg, #f8fafc, #eef2ff); position: sticky; top: 0; z-index: 1; }
.data-table td:first-child { min-width: 220px; }
.muted { color: var(--muted); }
.pill { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: 11.5px; line-height: 1.2; font-weight: 900; background: #dcfce7; color: var(--primary); }
.data-table tr:nth-child(4n+1) .pill { background: #dbeafe; color: #1d4ed8; }
.data-table tr:nth-child(4n+2) .pill { background: #fef3c7; color: #92400e; }
.data-table tr:nth-child(4n+3) .pill { background: #fce7f3; color: #9d174d; }
.pill.off { background: #fee2e2; color: var(--danger); }
.role-badge { display: inline-flex; padding: 6px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 900; line-height: 1.2; background: #eef2ff; color: #3730a3; }
.role-super_admin { background: #fef3c7; color: #92400e; }
.role-admin { background: #e0f2fe; color: #075985; }
.role-seller { background: #dcfce7; color: #166534; }
.role-client { background: #fce7f3; color: #9d174d; }
.role-consultant { background: #e0f2fe; color: #0e7490; }
.alert { padding: 10px 12px; border-radius: 8px; background: #ecfdf5; color: var(--primary); margin-bottom: 12px; }
.alert.danger { background: #fee2e2; color: var(--danger); }
.toast { position: fixed; right: 18px; bottom: 18px; background: #111827; color: #fff; padding: 12px 14px; border-radius: 8px; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; z-index: 30; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }
.pos-grid { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 18px; }
.pos-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 430px; gap: 18px; align-items: start; }
.pos-products, .pos-cart { background: rgba(255,255,255,.96); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-soft); padding: 18px; overflow: hidden; }
.pos-panel-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.pos-panel-head h2 { margin: 0 0 3px; font-size: 22px; }
.pos-panel-head p { margin: 0; color: var(--muted); }
.pos-search-row { display: grid; grid-template-columns: 1fr 210px; gap: 10px; margin-bottom: 12px; }
.pos-category-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pos-category-pills .pill { border: 0; cursor: pointer; }
.pos-category-pills .pill.active { background: #dbeafe; color: #1d4ed8; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; max-height: calc(100vh - 260px); overflow: auto; padding-right: 4px; }
.product-card { border: 1px solid var(--border); background: #fff; border-radius: 8px; padding: 10px; display: grid; gap: 9px; text-align: left; cursor: pointer; box-shadow: 0 10px 24px rgba(15,23,42,.05); }
.product-card:hover { border-color: #93c5fd; transform: translateY(-1px); box-shadow: 0 16px 30px rgba(37,99,235,.12); }
.product-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.product-card span { display: grid; gap: 2px; }
.product-card small { color: var(--muted); }
.product-card b { color: var(--primary-dark); font-size: 16px; }
.cart-list { display: grid; gap: 10px; max-height: 280px; overflow: auto; }
.cart-item { display: grid; grid-template-columns: minmax(120px, 1fr) auto minmax(150px, 220px) auto; gap: 10px; align-items: center; border: 1px solid var(--border); border-radius: 8px; padding: 10px; background: #fbfdff; }
.cart-item span, .cart-item small { display: block; color: var(--muted); font-size: 12px; }
.cart-item-main { min-width: 0; }
.cart-item-main strong { display: block; overflow-wrap: anywhere; }
.qty-stepper { display: grid; grid-template-columns: 34px 58px 34px; align-items: center; }
.qty-stepper button { height: 34px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-weight: 900; }
.qty-stepper input { height: 34px; border-radius: 0; text-align: center; padding: 4px; }
.price-controls { display: grid; grid-template-columns: 1fr; gap: 6px; }
.price-controls label { display: grid; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 800; }
.price-controls input { height: 38px; padding: 4px 8px; font-size: 15px; font-weight: 850; }
.line-total-compact { font-family: var(--font-number); font-size: 13px; color: var(--text); }
.totals-box { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: linear-gradient(135deg, #f8fafc, #ecfdf5); display: grid; gap: 8px; }
.totals-box div { display: flex; justify-content: space-between; gap: 10px; }
.totals-box strong { font-family: var(--font-number); font-variant-numeric: tabular-nums; }
.grand-total { border-top: 1px dashed #cbd5e1; padding-top: 8px; font-size: 18px; }
.checkout-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checkout-actions [data-save-draft] { grid-column: 1 / -1; }
.empty-state { border: 1px dashed #cbd5e1; border-radius: 8px; padding: 18px; text-align: center; color: var(--muted); background: #f8fafc; }
.product-search-panel { min-height: 520px; }
.checkout-panel { align-self: start; }
.cart-total { font-family: var(--font-number); font-size: 30px; line-height: 1.1; font-weight: 900; font-variant-numeric: tabular-nums; }
.search-results { display: grid; gap: 8px; }
.result-card { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; box-shadow: 0 10px 24px rgba(15,23,42,.06); text-align: left; }
.result-card:hover { border-color: #93c5fd; box-shadow: 0 14px 30px rgba(37,99,235,.13); }
.result-card.active, .refund-sale-card.active { border-color: #22c55e; background: #f0fdf4; box-shadow: 0 0 0 3px rgba(34,197,94,.13); }
.refund-sale-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; max-height: 280px; overflow: auto; padding-right: 4px; }
.nested-table { padding-top: 0; }
.product-image { width: 58px; height: 58px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.mini-form { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 10px; align-items: end; margin-bottom: 12px; }
.segmented { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 5px; border: 1px solid var(--border); border-radius: 8px; background: #f8fafc; }
.segmented label { display: flex; justify-content: center; align-items: center; gap: 8px; color: var(--text); padding: 9px; border-radius: 6px; cursor: pointer; }
.segmented label:has(input:checked) { background: linear-gradient(135deg, #dcfce7, #dbeafe); color: #14532d; box-shadow: inset 0 0 0 1px #86efac; }
.inline-panel { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: #fbfffc; }
.inline-panel summary { cursor: pointer; font-weight: 900; color: var(--primary-dark); }
.inline-panel .grid { margin-top: 12px; }
.chart-card canvas { width: 100%; display: block; }
.chart-card { min-height: 260px; }
.action-card { display: grid; gap: 8px; min-height: 158px; color: #fff; border: 0; }
.action-card::before { display: none; }
.action-card strong { font-family: var(--font-display); font-size: 23px; line-height: 1.15; font-weight: 900; }
.action-card p { margin: 0; color: rgba(255,255,255,.86); }
.action-icon { width: 42px; height: 42px; border-radius: 8px; display: grid; place-items: center; background: rgba(255,255,255,.18); font-weight: 900; font-size: 22px; }
.sale-retail { background: linear-gradient(135deg, #15803d, #0891b2); }
.sale-wholesale { background: linear-gradient(135deg, #7c3aed, #db2777); }
.print-shell { padding: 24px; background: #fff; }
.pos-workspace { grid-template-columns: 1fr; max-width: 1480px; margin: 0 auto; }
.pos-products, .pos-cart { padding: 20px; }
.pos-cart { display: grid; gap: 16px; }
.pos-checkout-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); gap: 16px; align-items: start; }
.product-grid { max-height: 430px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.cart-list { max-height: none; overflow: visible; }
.cart-item { grid-template-columns: minmax(210px, 1.4fr) minmax(130px, auto) minmax(180px, .7fr) 42px; background: linear-gradient(135deg, #ffffff, #f8fbff); }
.price-controls { grid-template-columns: minmax(0, 1fr); }
.price-controls label:first-child input { border-color: #86efac; background: #f0fdf4; font-weight: 850; }
.data-table tr[data-row-link] { cursor: pointer; }
.data-table tr[data-row-link]:hover td:first-child strong { color: var(--primary-dark); }
.pagination { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; padding: 14px 18px 18px; border-top: 1px solid var(--border); }
.page-link { min-width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 8px; border: 1px solid var(--border); background: #fff; color: #1d4ed8; font-weight: 900; }
.page-link.active { background: linear-gradient(135deg, var(--primary), var(--brand-cyan)); color: #fff; border-color: transparent; }
.page-link.disabled { opacity: .45; pointer-events: none; }
.page-gap, .page-meta { color: var(--muted); font-size: 13px; }
.detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.grid.two .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.detail-grid div { border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: #f8fafc; }
.detail-grid .wide { grid-column: span 2; }
.detail-grid span { display: block; color: var(--muted); font-size: 12px; font-weight: 850; margin-bottom: 4px; }
.detail-grid strong { overflow-wrap: anywhere; }
.json-dump { max-width: 360px; max-height: 220px; overflow: auto; margin: 8px 0 0; padding: 10px; border-radius: 8px; background: #0f172a; color: #e2e8f0; font-size: 12px; line-height: 1.45; white-space: pre-wrap; }
.product-cell { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.product-cell img { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.editable-table input, .editable-table select { min-width: 120px; }
.sale-edit-form .mini-form { grid-template-columns: 1fr; border: 1px solid var(--border); border-radius: 8px; padding: 12px; background: #fbfdff; margin: 0; }
.notice { display: grid; gap: 4px; margin: 0 0 16px; padding: 14px 16px; border: 1px solid var(--border); border-left-width: 4px; border-radius: 8px; background: #f8fafc; }
.notice.warning { border-left-color: #d97706; background: #fffbeb; color: #78350f; }
.notice.danger { border-left-color: #dc2626; background: #fef2f2; color: #7f1d1d; }
.status-badge { display: inline-flex; align-items: center; width: fit-content; padding: 4px 8px; border-radius: 6px; background: #eef2f7; color: #334155; font-size: 12px; font-weight: 850; }
.status-badge.success { background: #dcfce7; color: #166534; }
.status-badge.info { background: #dbeafe; color: #1e40af; }
.status-badge.warning { background: #fef3c7; color: #92400e; }
.status-badge.danger { background: #fee2e2; color: #991b1b; }
.status-badge.neutral { background: #f1f5f9; color: #475569; }
.rsge-tabs { margin-bottom: 14px; }
.rsge-sync-bar { margin-bottom: 18px; align-items: end; }
.rsge-sync-bar > div { margin-right: auto; }
.rsge-sync-bar small { display: block; margin-top: 3px; }
.rsge-form section { margin: 0; }
.rsge-form .table-wrap input, .rsge-form .table-wrap select { min-width: 110px; }
.check-row { display: flex; align-items: center; gap: 9px; min-height: 42px; }
.check-row input { width: auto; }
.sticky-actions { position: sticky; bottom: 12px; z-index: 5; display: flex; justify-content: flex-end; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: rgba(255,255,255,.96); box-shadow: var(--shadow); }
.compact { gap: 6px; }
.rsge-settings-grid code { font-size: 13px; }
.launch-banner { margin-bottom: 16px; border-radius: 8px; padding: 12px 14px; font-weight: 850; }
.launch-banner.warning { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; }
.badge { display: inline-flex; align-items: center; gap: 6px; width: fit-content; min-height: 26px; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 900; line-height: 1.2; background: #f1f5f9; color: #475569; }
.badge.success { background: #dcfce7; color: #166534; }
.badge.info { background: #dbeafe; color: #1e40af; }
.badge.warning { background: #fef3c7; color: #92400e; }
.badge.danger { background: #fee2e2; color: #991b1b; }
.badge.neutral { background: #f1f5f9; color: #475569; }
.text-danger { color: var(--danger) !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.btn-large { min-height: 46px; padding: 13px 18px; }
.icon-btn { width: 44px; min-height: 44px; border: 0; border-radius: 8px; font-size: 20px; font-weight: 900; cursor: pointer; }
.icon-btn.danger { background: var(--danger); color: #fff; }
.field-grow { flex: 1 1 280px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .span-2, .span-2 { grid-column: span 2; }
.form-section { border: 1px solid var(--border); border-radius: 8px; padding: 14px; background: #fff; }
.form-section legend { padding: 0 6px; font-weight: 900; color: #334155; }
.checkbox-label, .toggle-row { display: flex; align-items: center; gap: 9px; min-height: 44px; color: var(--text); }
.checkbox-label input, .toggle-row input { width: auto; min-height: auto; }
.toggle-row span { display: grid; gap: 2px; }
.toggle-row small { color: var(--muted); font-weight: 600; }
.segmented-control { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.segmented-control label { display: block; cursor: pointer; }
.segmented-control input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-control span { min-height: 44px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 8px; background: #f8fafc; color: var(--text); font-weight: 900; text-align: center; }
.segmented-control input:checked + span { border-color: #86efac; background: #dcfce7; color: #166534; }
.chip { border: 1px solid var(--border); border-radius: 999px; background: #fff; color: #334155; min-height: 34px; padding: 6px 11px; font-weight: 850; cursor: pointer; }
.chip.active { border-color: #86efac; background: #dcfce7; color: #166534; }
.operational-section { border: 1px solid var(--border); border-radius: 8px; background: #fff; box-shadow: var(--shadow-soft); }
.rsge-pos-section { margin-top: 16px; background: #fbfffc; }
.rsge-pos-fields { display: grid; gap: 12px; margin-top: 12px; }
.readiness-panel { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid #fcd34d; background: #fffbeb; color: #92400e; border-radius: 8px; padding: 11px 12px; }
.readiness-panel.ready { border-color: #86efac; background: #f0fdf4; color: #166534; }
.price-input input { border-color: #86efac; background: #f0fdf4; min-width: 150px; font-weight: 900; }
.module-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.module-action { display: flex; align-items: center; gap: 12px; min-height: 92px; padding: 18px; border-radius: 8px; color: #fff; box-shadow: var(--shadow-soft); }
.module-action small { display: block; margin-top: 4px; color: rgba(255,255,255,.86); }
.module-action.retail { background: linear-gradient(135deg, #15803d, #0891b2); }
.module-action.wholesale { background: linear-gradient(135deg, #4f46e5, #db2777); }
.module-action-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,255,255,.18); font-size: 22px; font-weight: 900; }
.filter-panel { margin-bottom: 18px; border: 1px solid var(--border); border-radius: 10px; background: #fff; box-shadow: var(--shadow-soft); }
.filter-panel summary { min-height: 48px; padding: 13px 16px; cursor: pointer; font-weight: 900; display: flex; align-items: center; justify-content: space-between; list-style: none; }
.filter-panel summary::-webkit-details-marker { display: none; }
.filter-panel summary::after { content: "▾"; font-size: 18px; color: var(--muted); transition: transform .2s; }
.filter-panel[open] summary::after { transform: rotate(180deg); }
.filter-panel .filter-bar { margin: 0; border: 0; box-shadow: none; border-radius: 0; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 8px 12px; align-items: end; padding: 12px 16px 4px; }
.filter-grid label { margin: 0; }
.filter-actions { display: flex; gap: 8px; padding: 8px 16px 12px; flex-wrap: wrap; }
.detail-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.detail-hero h1 { margin: 5px 0 3px; font-size: 30px; line-height: 1.15; }
.detail-hero p { margin: 0; color: var(--muted); }
.back-link { color: #1d4ed8; font-weight: 900; }
.hero-statuses { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.detail-action-bar { position: sticky; top: 79px; z-index: 4; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: flex-end; margin-bottom: 16px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: rgba(255,255,255,.95); box-shadow: var(--shadow-soft); }
.detail-action-bar form { margin: 0; }
.summary-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.summary-strip > div { border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 14px; box-shadow: var(--shadow-soft); }
.summary-strip span, .info-grid dt { display: block; color: var(--muted); font-size: 12px; font-weight: 850; }
.summary-strip strong { display: block; margin-top: 4px; font-size: 22px; font-family: var(--font-number); }
.detail-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.detail-section { border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 18px; box-shadow: var(--shadow-soft); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-heading h2 { margin: 0; font-size: 20px; }
.section-heading a { color: #1d4ed8; font-weight: 900; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.info-grid > div { border: 1px solid var(--border); border-radius: 8px; padding: 10px; background: #f8fafc; }
.info-grid dd { margin: 3px 0 0; font-weight: 850; overflow-wrap: anywhere; }
.alert-inline.danger { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }
.technical-section { margin-top: 18px; border: 1px solid var(--border); border-radius: 8px; background: #fff; padding: 14px; }
.technical-section summary { cursor: pointer; font-weight: 900; }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; margin-bottom: 18px; }
.settings-submit { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.profile-editor { padding: 0 22px 18px; display: grid; gap: 12px; }
.profile-list { display: grid; gap: 12px; padding: 0 22px 22px; }
.profile-card { border: 1px solid var(--border); border-radius: 8px; background: #fbfdff; padding: 14px; display: grid; gap: 12px; }
.profile-card-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.profile-card-head label { flex: 1; }
.unified-sale { max-width: 1500px; }
.unified-sale .pos-products { min-height: 420px; }
.unified-sale .product-grid { max-height: 470px; }
.unified-sale .pos-cart { scroll-margin-top: 96px; }
.customer-fields [hidden], [hidden] { display: none !important; }
.waybill-intent { margin-top: 16px; border-color: #93c5fd; background: #eff6ff; }
.transport-admin-grid { align-items: start; }
.transport-admin-grid .card { display: grid; gap: 16px; }
.record-list { display: grid; gap: 8px; max-height: 320px; overflow: auto; }
.record-list > div { display: grid; gap: 2px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; background: #f8fafc; }
.record-list small { color: var(--muted); }
.inline-editor { min-width: 260px; }
.inline-editor > summary { list-style: none; cursor: pointer; }
.inline-editor > form { min-width: min(520px, 80vw); margin-top: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: #fff; box-shadow: var(--shadow); }
.transport-preset-row { margin-bottom: 18px; padding: 14px; border: 1px solid #bfdbfe; border-radius: 8px; background: #eff6ff; }
/* TIN lookup */
.tin-lookup-group { display: flex; gap: 6px; align-items: stretch; }
.tin-lookup-group input { flex: 1; }
.tin-lookup-group .btn-sm { padding: 8px 10px; font-size: 15px; flex: 0 0 auto; white-space: nowrap; }
/* RS.ge form section dividers */
.rsge-section-divider { font-size: 11.5px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--border); padding-bottom: 6px; margin: 20px 0 14px; }
.rsge-presets-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; padding: 14px; border: 1px solid #bfdbfe; border-radius: 8px; background: #eff6ff; }
.rsge-preset-label { color: var(--muted); font-size: 12px; font-weight: 900; display: grid; gap: 4px; }
.rsge-preset-select { font-size: 13px; padding: 8px 10px; }
.rsge-checkboxes { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 4px; }
/* Table: numeric columns */
.rsge-products-table td.num { font-family: var(--font-number); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Standalone waybill product picker */
.standalone-product-search { padding: 14px 16px; border-bottom: 1px solid var(--border); position: relative; }
.standalone-search-row { display: flex; align-items: center; gap: 10px; }
.standalone-search-input { flex: 1; font-size: 15px; }
.standalone-search-hint { font-size: 12px; white-space: nowrap; }
.standalone-search-results { position: absolute; left: 16px; right: 16px; top: calc(100% - 8px); z-index: 200; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; padding: 4px; }
.standalone-result-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 6px; text-align: left; background: transparent; border: none; cursor: pointer; width: 100%; }
.standalone-result-item:hover { background: var(--hover); }
.standalone-result-name { flex: 1; font-weight: 600; font-size: 14px; }
.standalone-result-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.standalone-result-price { font-family: var(--font-number); font-size: 14px; font-weight: 700; white-space: nowrap; }
.standalone-no-results { padding: 12px; text-align: center; color: var(--muted); font-size: 13px; }
.standalone-total { padding: 10px 16px; text-align: right; font-size: 15px; border-top: 1px solid var(--border); }
.rsge-waybill-toggle { font-weight: 700; }
/* Record items (transport cards) */
.record-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: #f8fafc; }
.record-item-main { flex: 1; display: grid; gap: 2px; }
.record-item small { color: var(--muted); font-size: 12px; }
/* Improved table: better header contrast */
.data-table th { background: linear-gradient(180deg, #eef2ff, #e0e7ff); border-bottom: 2px solid #c7d2fe; }
.data-table tbody tr:last-child td { border-bottom: 0; }
/* Waybill status badge improvements */
.badge[data-status="active"] { background: #dcfce7; color: #166534; }
.badge[data-status="draft"] { background: #dbeafe; color: #1e40af; }
.badge[data-status="completed"] { background: #f0fdf4; color: #15803d; border: 1px solid #86efac; }
.badge[data-status="error"] { background: #fee2e2; color: #991b1b; }
.badge[data-status="cancelled"], .badge[data-status="deleted"] { background: #f1f5f9; color: #64748b; text-decoration: line-through; }
/* num column alignment */
.num { text-align: right; }
@media print { .no-print { display: none !important; } body { background: #fff; } .card { box-shadow: none; border: 0; } }
@media (max-width: 1100px) {
  .rsge-presets-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { min-height: 260px; }
  .app-shell { grid-template-columns: 1fr; }
  .burger-btn { display: inline-grid; place-items: center; flex: 0 0 auto; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(320px, 86vw); height: 100vh; transform: translateX(-105%); transition: transform .22s ease; z-index: 40; }
  .sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.42); z-index: 35; }
  .sidebar-open .sidebar-backdrop { display: block; }
  .sidebar nav { grid-template-columns: 1fr; }
  .pos-grid, .pos-workspace { grid-template-columns: 1fr; }
  .rsge-presets-row { grid-template-columns: 1fr; }
  .pos-checkout-grid, .detail-grid { grid-template-columns: 1fr; }
  .settings-grid, .detail-sections, .summary-strip, .module-actions { grid-template-columns: 1fr; }
  .grid.two .detail-grid { grid-template-columns: 1fr; }
  .detail-grid .wide { grid-column: auto; }
  .product-grid { max-height: none; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .topbar { align-items: flex-start; }
  .rsge-sync-bar { align-items: stretch; }
}
@media (max-width: 768px) {
  .grid.two, .grid.three, .grid.four { grid-template-columns: 1fr; }
  .kpi-grid.grid.four { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .filter-grid { grid-template-columns: 1fr !important; }
  .filter-grid label[style*="span"] { grid-column: auto !important; }
}
@media (max-width: 640px) {
  .login-body { padding: 14px; }
  .login-hero, .login-card { padding: 24px; }
  .login-hero h1 { font-size: 30px; }
  .login-metrics { grid-template-columns: 1fr; }
  .content, .topbar { padding: 18px; }
  .topbar { flex-direction: column; }
  .topbar { flex-direction: row; align-items: center; }
  .topbar-title { flex: 1; }
  .topbar h1 { font-size: 22px; }
  .topbar-title p { display: none; }
  .user-chip { justify-items: end; font-size: 12px; }
  .user-chip small { display: none; }
  .mini-form { grid-template-columns: 1fr; }
  .pos-search-row, .checkout-actions, .cart-item { grid-template-columns: 1fr; }
  .cart-item { align-items: stretch; }
  .qty-stepper { width: 100%; grid-template-columns: 42px 1fr 42px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-card { padding: 8px; }
  .price-controls { grid-template-columns: 1fr; }
  .pagination { justify-content: center; }
  .language-switch label { font-size: 0; }
  .form-grid, .segmented-control, .info-grid { grid-template-columns: 1fr; }
  .form-grid .span-2, .span-2 { grid-column: auto; }
  .detail-action-bar { position: fixed; inset: auto 0 0 0; border-radius: 0; top: auto; justify-content: stretch; max-height: 46vh; overflow: auto; }
  .detail-action-bar .btn, .detail-action-bar form, .detail-action-bar button { width: 100%; }
  .sticky-actions { border-radius: 0; inset: auto 0 0 0; position: fixed; }
  .content { padding-bottom: 128px; }
  .responsive-table thead { display: none; }
  .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td { display: block; width: 100%; }
  .responsive-table tr { border: 1px solid var(--border); border-radius: 8px; margin: 10px 0; background: #fff; overflow: hidden; }
  .responsive-table td { display: grid; grid-template-columns: 120px 1fr; gap: 10px; border-bottom: 1px solid var(--border); }
  .responsive-table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 900; }
  .responsive-table td:first-child { min-width: 0; }
  .inline-editor, .inline-editor > form { min-width: 0; width: 100%; }
}

/* RS.ge product-picker popup (toggled: our products <-> RS catalog) */
.rsge-modal-overlay { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; background: rgba(15,23,42,.5); overflow-y: auto; }
.rsge-modal-overlay[hidden] { display: none; }
.rsge-modal { width: min(900px, 100%); background: var(--card); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.rsge-modal-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--primary); color: #fff; }
.rsge-modal-head strong { font-size: 14px; }
.rsge-modal-source { margin-left: auto; display: flex; gap: 6px; }
.rsge-modal-source button { border: 1px solid rgba(255,255,255,.5); background: transparent; color: #fff; padding: 5px 12px; border-radius: 999px; font: inherit; font-size: 12px; cursor: pointer; }
.rsge-modal-source button.active { background: #fff; color: var(--primary-dark); font-weight: 700; }
.rsge-modal-close { border: none; background: transparent; color: #fff; font-size: 18px; cursor: pointer; line-height: 1; }
.rsge-modal-body { max-height: 65vh; overflow-y: auto; }
.rsge-popup-table { width: 100%; }
.rsge-popup-table thead th { position: sticky; top: 0; background: #f1f5f9; z-index: 1; }
.rsge-popup-filters th { padding: 4px 6px; background: #f8fafc; }
.rsge-popup-filters input { width: 100%; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; font: inherit; }
.rsge-popup-row { cursor: pointer; }
.rsge-popup-row:hover { background: #ecfdf5; }
.rsge-popup-row td { padding: 7px 10px; }
.popup-msg { text-align: center; padding: 16px; }
.readonly-field { background: #f8fafc; color: var(--muted); }
.sticky-actions { gap: 10px; }
.rsge-actions { flex-wrap: wrap; }
.rsge-products-table .wood-col { display: none; }
.rsge-products-table.show-wood .wood-col { display: table-cell; }

/* ===== Mobile & Safari refinements ===== */
@media (max-width: 900px) {
  .sidebar { height: 100dvh; }                  /* Safari: avoid 100vh under the browser chrome */
}
@media (max-width: 640px) {
  input, select, textarea { font-size: 16px; }  /* iOS Safari: >=16px stops zoom-on-focus */
  .content { padding-bottom: 150px; }           /* room for fixed bottom action bars */
  /* Builder action buttons: 2 per row, comfortable tap targets */
  .rsge-actions { gap: 8px; }
  .rsge-actions .btn { flex: 1 1 calc(50% - 4px); min-height: 46px; justify-content: center; }
  /* Product picker popup: full-screen on mobile; wide table scrolls inside */
  .rsge-modal-overlay { padding: 10px 8px; align-items: stretch; }
  .rsge-modal { width: 100%; max-height: calc(100dvh - 20px); display: flex; flex-direction: column; }
  .rsge-modal-head { flex-wrap: wrap; }
  .rsge-modal-source { margin-left: 0; width: 100%; }
  .rsge-modal-body { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; }
  .rsge-popup-table { min-width: 540px; }
  .rsge-form .table-wrap input, .rsge-form .table-wrap select { min-width: 96px; }
}
