:root {
  --bg: #f6f9fb;
  --surface: #edf4f4;
  --card: #ffffff;
  --soft: #dbe7e8;
  --soft-2: #e7f1f1;
  --primary: #0e746c;
  --primary-2: #16887f;
  --primary-soft: #d9ebea;
  --ink: #101828;
  --muted: #667085;
  --line: #dbe3e6;
  --danger: #b42318;
  --warning: #b54708;
  --success: #067647;
  --shadow: 0 18px 50px rgba(16, 24, 40, .08), 0 2px 6px rgba(16, 24, 40, .06);
  --radius: 28px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 0 0, #ffffff 0, var(--bg) 36%, #eef6f6 100%);
  color: var(--ink);
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.app-shell { display: grid; grid-template-columns: 292px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 26px 18px;
  background: rgba(237, 244, 244, .86); backdrop-filter: blur(18px);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 24px;
}
.brand { display: flex; gap: 14px; align-items: center; padding: 10px; border-radius: 20px; }
.brand-mark {
  width: 48px; height: 48px; border-radius: 17px; display: grid; place-items: center;
  color: white; background: linear-gradient(135deg, var(--primary), #0a554f);
  font-weight: 900; box-shadow: 0 14px 30px rgba(14, 116, 108, .26);
}
.brand strong { display: block; font-size: 18px; letter-spacing: -.03em; }
.brand small { color: var(--muted); font-weight: 700; }
.nav-menu { display: grid; gap: 8px; }
.nav-menu a {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 17px;
  color: #344054; font-weight: 800; transition: .18s ease;
}
.nav-menu a span { width: 26px; text-align: center; color: var(--primary); font-size: 20px; }
.nav-menu a:hover, .nav-menu a.active { background: white; color: var(--ink); box-shadow: 0 10px 25px rgba(16, 24, 40, .06); }
.nav-menu a.active { border: 1px solid rgba(14, 116, 108, .16); }
.sidebar-card {
  margin-top: auto; padding: 18px; border-radius: 22px; background: white; border: 1px solid var(--line);
  box-shadow: 0 12px 24px rgba(16, 24, 40, .05);
}
.sidebar-card small, .eyebrow { display: block; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: 11px; }
.sidebar-card strong { display: block; margin: 7px 0 4px; }
.sidebar-card span { color: var(--muted); font-size: 13px; }

.main-area { padding: 26px 32px 100px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.topbar h1 { margin: 4px 0 0; font-size: clamp(28px, 4vw, 44px); line-height: 1; letter-spacing: -.05em; }
.mobile-menu { display: none; border: 0; background: white; border-radius: 14px; padding: 11px 14px; box-shadow: var(--shadow); }
.top-actions { display: flex; align-items: center; gap: 12px; }
.quick-link, .btn-primary, .btn-secondary, .btn-light, .logout {
  border: 0; border-radius: 999px; padding: 12px 18px; font-weight: 900; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
}
.quick-link, .btn-primary { background: var(--primary); color: white; box-shadow: 0 14px 32px rgba(14, 116, 108, .22); }
.btn-primary:hover, .quick-link:hover { background: #0a625c; }
.btn-secondary { background: var(--primary-soft); color: var(--primary); }
.btn-light, .logout { background: white; color: #344054; border: 1px solid var(--line); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 11px; border-radius: 999px; background: white; border: 1px solid var(--line); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--surface); color: var(--primary); display: grid; place-items: center; font-weight: 900; }
.user-meta strong, .user-meta small { display: block; line-height: 1.1; }
.user-meta small { color: var(--muted); font-size: 12px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dashboard-grid { grid-template-columns: minmax(0, 1.6fr) minmax(360px, .9fr); align-items: start; }
.card, .hero-card, .metric-card, .panel, .table-card {
  background: rgba(255, 255, 255, .74); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.hero-card { padding: 32px; background: linear-gradient(145deg, #ffffff, var(--surface)); overflow: hidden; position: relative; }
.hero-card:after { content: ''; position: absolute; width: 260px; height: 260px; border-radius: 50%; right: -90px; top: -90px; background: rgba(14, 116, 108, .09); }
.hero-card h2 { margin: 0; font-size: clamp(30px, 4vw, 52px); letter-spacing: -.06em; }
.hero-card p { color: var(--muted); margin: 10px 0 24px; font-size: 18px; }
.sync-pill { position: relative; display: flex; gap: 14px; align-items: center; padding: 18px; border-radius: 24px; background: var(--primary-soft); max-width: 620px; }
.sync-icon { width: 54px; height: 54px; border-radius: 18px; display: grid; place-items: center; background: rgba(14,116,108,.13); color: var(--primary); font-size: 26px; }
.sync-pill strong { color: var(--primary); display: block; font-size: 17px; }
.sync-pill span { color: #53616c; }

.metric-card { padding: 22px; min-height: 166px; background: linear-gradient(145deg, #ffffff, var(--surface)); display: flex; flex-direction: column; justify-content: space-between; }
.metric-head { display: flex; align-items: center; gap: 12px; color: var(--primary); font-weight: 900; font-size: 17px; }
.metric-icon { font-size: 26px; }
.metric-value { font-size: clamp(28px, 3.5vw, 44px); line-height: 1; font-weight: 950; letter-spacing: -.05em; margin-top: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-note { color: var(--muted); margin-top: 10px; font-weight: 650; }

.panel { padding: 24px; }
.panel-header { display: flex; justify-content: space-between; align-items: start; gap: 18px; margin-bottom: 18px; }
.panel-header h2, .panel h2 { margin: 0; font-size: 24px; letter-spacing: -.04em; }
.panel-header p, .panel p { color: var(--muted); margin: 5px 0 0; }
.status-badge { display: inline-flex; align-items: center; gap: 8px; padding: 9px 13px; border-radius: 999px; font-weight: 900; background: var(--primary-soft); color: var(--primary); }
.status-badge.warning { background: #fff3e6; color: var(--warning); }
.status-badge.danger { background: #fee4e2; color: var(--danger); }

.actions-row { display: flex; gap: 14px; flex-wrap: wrap; }
.action-card { min-height: 142px; padding: 22px; border-radius: 24px; border: 1px solid var(--line); background: rgba(255,255,255,.72); display: flex; gap: 16px; align-items: center; transition: .18s ease; }
.action-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.action-card span { color: var(--primary); font-size: 32px; }
.action-card strong { display: block; font-size: 20px; letter-spacing: -.03em; }
.action-card small { display: block; color: var(--muted); margin-top: 4px; font-size: 15px; }

.table-card { overflow: hidden; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.table-toolbar h2 { margin: 0; letter-spacing: -.04em; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 18px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
td { color: #263241; font-weight: 650; }
tr:last-child td { border-bottom: 0; }
.t-right { text-align: right; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted) !important; }
.strong { font-weight: 950; }
.badge { display: inline-flex; padding: 6px 10px; border-radius: 999px; background: var(--surface); color: var(--primary); font-weight: 900; font-size: 12px; }
.badge.paid, .badge.synced { background: #dcfae6; color: var(--success); }
.badge.unpaid, .badge.failed { background: #fee4e2; color: var(--danger); }
.badge.partial, .badge.pending { background: #fff3e6; color: var(--warning); }

.form-card { max-width: 1180px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field label { display: block; font-weight: 900; margin-bottom: 8px; color: #344054; }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 16px; padding: 13px 14px; background: white; color: var(--ink); outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(14,116,108,.5); box-shadow: 0 0 0 4px rgba(14,116,108,.08); }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.line-items { border: 1px solid var(--line); border-radius: 22px; overflow: hidden; background: white; margin-top: 20px; }
.line-row { display: grid; grid-template-columns: 2fr .75fr .9fr .9fr 44px; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); align-items: end; }
.line-row:last-child { border-bottom: 0; }
.line-row .remove-line { border: 0; background: #fee4e2; color: var(--danger); border-radius: 14px; height: 46px; cursor: pointer; font-weight: 900; }
.total-strip { display: flex; justify-content: flex-end; gap: 22px; padding: 18px; border-radius: 22px; background: var(--surface); margin-top: 18px; flex-wrap: wrap; }
.total-strip div { min-width: 130px; }
.total-strip small { color: var(--muted); display: block; font-weight: 800; }
.total-strip strong { font-size: 24px; letter-spacing: -.04em; }

.filter-bar { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.filter-bar .field { min-width: 180px; }
.chart-bars { display: grid; grid-template-columns: repeat(7, 1fr); align-items: end; gap: 12px; min-height: 180px; padding-top: 20px; }
.bar-item { display: grid; gap: 9px; justify-items: center; color: var(--muted); font-size: 12px; font-weight: 800; }
.bar { width: 100%; min-height: 8px; border-radius: 999px 999px 8px 8px; background: linear-gradient(180deg, var(--primary-2), var(--primary)); box-shadow: 0 10px 18px rgba(14,116,108,.18); }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top left, #dbeceb 0, #f6f9fb 38%, #ffffff 100%); }
.login-card { width: min(100%, 1060px); display: grid; grid-template-columns: 1.1fr .9fr; overflow: hidden; border-radius: 34px; background: white; border: 1px solid var(--line); box-shadow: var(--shadow); }
.login-visual { padding: 44px; background: linear-gradient(145deg, var(--surface), #ffffff); display: flex; flex-direction: column; justify-content: space-between; min-height: 620px; }
.login-visual h1 { font-size: clamp(38px, 6vw, 68px); line-height: .95; letter-spacing: -.07em; margin: 0; }
.login-visual p { color: var(--muted); font-size: 18px; max-width: 520px; }
.login-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.login-stat { border-radius: 22px; padding: 18px; background: rgba(255,255,255,.75); border: 1px solid var(--line); }
.login-stat strong { display: block; font-size: 26px; }
.login-form { padding: 44px; align-self: center; }
.login-form h2 { margin: 0 0 8px; font-size: 34px; letter-spacing: -.05em; }
.login-form p { color: var(--muted); margin-top: 0; }
.alert { padding: 14px 16px; border-radius: 16px; margin-bottom: 18px; font-weight: 750; }
.alert-success { background: #dcfae6; color: #05603a; }
.alert-error { background: #fee4e2; color: var(--danger); }
.alert-warning { background: #fff3e6; color: var(--warning); }

.empty-state { padding: 44px; text-align: center; color: var(--muted); }
.print-only { display: none; }

@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; inset: 0 auto 0 0; width: 292px; transform: translateX(-104%); transition: .22s ease; box-shadow: var(--shadow); }
  body.menu-open .sidebar { transform: translateX(0); }
  .mobile-menu { display: inline-flex; }
  .dashboard-grid, .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .main-area { padding: 18px 16px 110px; }
  .topbar { align-items: flex-start; }
  .top-actions .quick-link, .top-actions .logout, .user-meta { display: none; }
  .grid-2, .grid-3, .grid-4, .dashboard-grid, .form-grid { grid-template-columns: 1fr; }
  .hero-card, .panel { padding: 22px; border-radius: 26px; }
  .line-row { grid-template-columns: 1fr; }
  .bottom-nav { display: grid; }
  .login-card { grid-template-columns: 1fr; }
  .login-visual { min-height: auto; padding: 28px; }
  .login-form { padding: 28px; }
  .login-stats { grid-template-columns: 1fr; }
}

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 45; display: none; grid-template-columns: repeat(5, 1fr);
  background: rgba(237, 244, 244, .94); backdrop-filter: blur(18px); border-top: 1px solid var(--line); padding: 10px 10px 12px;
}
.bottom-nav a { display: grid; gap: 4px; justify-items: center; color: #4d5562; font-size: 12px; font-weight: 850; padding: 8px 4px; border-radius: 18px; }
.bottom-nav a span { font-size: 22px; }
.bottom-nav a.active { background: #eadcff; color: var(--ink); }

@media print {
  .sidebar, .topbar, .bottom-nav, .filter-bar, .form-actions, .no-print { display: none !important; }
  .app-shell { display: block; }
  .main-area { padding: 0; }
  body { background: white; }
  .card, .panel, .table-card, .metric-card, .hero-card { box-shadow: none; border-color: #ddd; }
  .print-only { display: block; }
}
@media (max-width: 760px) {
  .bottom-nav { display: grid; }
}

/* RoyalPOS v5 professional admin polish */
:root {
  --bg: #f3f6f8;
  --surface: #eef6f5;
  --card: #ffffff;
  --primary: #087564;
  --primary-2: #0d8b78;
  --primary-dark: #06483f;
  --primary-soft: #e4f3f1;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #d8e2e7;
  --shadow: 0 18px 55px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .05);
  --radius: 22px;
}
body {
  background:
    radial-gradient(circle at 82% -8%, rgba(8,117,100,.12), transparent 32%),
    linear-gradient(180deg, #f8fbfc 0%, #eef5f5 100%);
  font-size: 15px;
}
.app-shell { grid-template-columns: 274px minmax(0, 1fr); }
.sidebar {
  background: rgba(242, 248, 248, .92);
  padding: 24px 16px;
}
.brand { padding: 12px 10px 22px; }
.brand-mark { width: 54px; height: 54px; border-radius: 18px; }
.nav-menu a {
  border: 1px solid transparent;
  color: #334155;
  font-weight: 850;
}
.nav-menu a span { font-size: 18px; }
.nav-menu a:hover,
.nav-menu a.active {
  background: #fff;
  border-color: #dbe7ea;
  box-shadow: 0 14px 35px rgba(15, 23, 42, .06);
}
.main-area { padding: 28px 34px 100px; }
.topbar {
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(216,226,231,.9);
  border-radius: 26px;
  padding: 14px 16px 14px 20px;
  box-shadow: 0 16px 45px rgba(15, 23, 42, .05);
  backdrop-filter: blur(14px);
}
.topbar h1 { font-size: clamp(30px, 3vw, 46px); }
.top-actions { flex-wrap: wrap; justify-content: flex-end; }
.store-select select {
  min-width: 160px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 16px;
  background: #fff;
  font-weight: 850;
  color: var(--ink);
}
.quick-link, .btn-primary {
  background: linear-gradient(135deg, var(--primary-2), var(--primary-dark));
  box-shadow: 0 16px 34px rgba(8,117,100,.20);
}
.card, .hero-card, .metric-card, .panel, .table-card {
  background: rgba(255, 255, 255, .88);
  border-color: #dbe5ea;
}
.pro-dashboard.dashboard-grid { grid-template-columns: minmax(0, 1.45fr) minmax(360px, .85fr); }
.hero-pro {
  min-height: 270px;
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: flex-end;
  color: #fff;
  background:
    radial-gradient(circle at 92% 8%, rgba(255,255,255,.19), transparent 26%),
    linear-gradient(135deg, #043f37, #087564 58%, #0d8b78);
  border: none;
}
.hero-pro:after { display: none; }
.hero-pro h2 {
  max-width: 760px;
  font-size: clamp(36px, 5vw, 64px);
  color: #fff;
}
.hero-pro p { color: rgba(255,255,255,.78); max-width: 620px; }
.hero-pro .eyebrow { color: rgba(255,255,255,.72); }
.hero-metrics {
  min-width: 280px;
  display: grid;
  gap: 10px;
}
.hero-metrics div,
.credential-grid div {
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 18px;
  padding: 14px 16px;
  backdrop-filter: blur(10px);
}
.hero-metrics small,
.credential-grid small {
  display: block;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 11px;
  font-weight: 900;
  color: rgba(255,255,255,.72);
}
.hero-metrics strong,
.credential-grid strong { display: block; margin-top: 4px; font-size: 16px; }
.kpi-grid.grid-4 { grid-template-columns: repeat(4, minmax(190px, 1fr)); }
.metric-card {
  min-height: 150px;
  padding: 22px;
  border-radius: 24px;
}
.premium-metric {
  background: linear-gradient(180deg, #ffffff 0%, #f6fbfb 100%);
}
.metric-head {
  font-size: 15px;
  line-height: 1.2;
  align-items: flex-start;
}
.metric-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 17px;
  flex: 0 0 auto;
}
.metric-value {
  font-size: clamp(24px, 2.5vw, 38px);
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  letter-spacing: -.055em;
}
.mini-metric .metric-value { font-size: 40px; }
.metric-card.is-danger .metric-value { color: var(--danger); }
.action-pro {
  background: #fff;
  min-height: 120px;
}
.action-card span {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 22px;
}
.chart-panel { padding-bottom: 28px; }
.table-toolbar { background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(248,251,252,.95)); }
th { font-size: 11px; color: #667085; }
td { font-weight: 700; }
.login-card { box-shadow: 0 28px 90px rgba(15, 23, 42, .14); }
.login-visual {
  color: #fff;
  background:
    radial-gradient(circle at 90% 14%, rgba(255,255,255,.24), transparent 28%),
    linear-gradient(135deg, #043f37, #087564 66%, #0e9f89);
}
.login-visual .brand small,
.login-visual p,
.login-visual .muted { color: rgba(255,255,255,.78) !important; }
.login-visual .brand-mark { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.22); }
.login-stat { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.2); }
.credential-panel {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  border: none;
  margin-bottom: 20px;
}
.credential-panel h2 { color: #fff; }
.credential-panel p { color: rgba(255,255,255,.75); }
.credential-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.credential-grid strong { word-break: break-word; }
.credential-grid small { color: rgba(255,255,255,.68); }

@media (max-width: 1280px) {
  .pro-dashboard.dashboard-grid { grid-template-columns: 1fr; }
  .kpi-grid.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-pro { align-items: stretch; flex-direction: column; }
  .hero-metrics { grid-template-columns: repeat(3, 1fr); }
  .credential-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .topbar { border-radius: 22px; }
  .store-select { display: none; }
  .kpi-grid.grid-4 { grid-template-columns: 1fr; }
  .hero-metrics { grid-template-columns: 1fr; }
  .hero-pro { min-height: auto; }
  .credential-grid { grid-template-columns: 1fr; }
}

/* V6 UI polish and layout safety fixes
   Fixes: dashboard hero overlap, cheap-looking oversized cards, clipped money values,
   and wide-screen/right-panel collisions. */
html, body { max-width: 100%; overflow-x: hidden; }
:root {
  --primary-dark: #06493f;
  --page-max: 1720px;
}
.main-area {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
}
.topbar {
  min-height: 92px;
  align-items: center;
}
.topbar h1 {
  letter-spacing: -.06em;
}
.pro-dashboard.dashboard-grid {
  grid-template-columns: minmax(0, 1fr) minmax(380px, 430px);
  gap: 24px;
  width: 100%;
  align-items: start;
}
.pro-dashboard > .grid,
.dashboard-grid > .grid {
  min-width: 0;
}
.hero-pro {
  min-height: 230px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 24px;
  align-items: end;
  overflow: hidden;
  padding: 34px;
}
.hero-pro h2 {
  max-width: 680px;
  font-size: clamp(34px, 3.5vw, 50px);
  line-height: .98;
}
.hero-pro p {
  font-size: 17px;
  line-height: 1.35;
}
.hero-metrics {
  min-width: 0;
  width: 100%;
}
.hero-metrics div { min-width: 0; }
.hero-metrics strong {
  font-size: 15px;
  overflow-wrap: anywhere;
}
.kpi-grid.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}
.metric-card {
  min-width: 0;
  overflow: hidden;
}
.premium-metric {
  min-height: 156px;
}
.metric-value {
  font-size: clamp(25px, 2vw, 34px);
  line-height: 1.02;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  letter-spacing: -.045em;
}
.metric-note {
  font-size: 14px;
  line-height: 1.35;
}
.compact-stats.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.mini-metric {
  min-height: 142px;
}
.mini-metric .metric-value {
  font-size: 36px;
}
.sync-panel .panel-header {
  align-items: center;
}
.chart-panel {
  min-width: 0;
}
.chart-bars {
  min-width: 0;
}
.table-card,
.panel,
.hero-card,
.metric-card,
.action-card {
  box-shadow: 0 18px 45px rgba(15, 23, 42, .07), 0 1px 2px rgba(15, 23, 42, .04);
}
.sync-pill {
  max-width: 100%;
  overflow: hidden;
}
.sync-pill span:not(.sync-icon) {
  display: block;
  word-break: break-word;
}
@media (max-width: 1540px) {
  .pro-dashboard.dashboard-grid {
    grid-template-columns: 1fr;
  }
  .pro-dashboard > .grid:last-child {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pro-dashboard > .grid:last-child > .table-card {
    grid-column: span 1;
  }
}
@media (max-width: 1180px) {
  .hero-pro {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .hero-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .kpi-grid.grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pro-dashboard > .grid:last-child {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  .main-area { padding-left: 16px; padding-right: 16px; }
  .topbar { min-height: auto; padding: 14px; }
  .hero-pro { padding: 24px; border-radius: 24px; }
  .hero-pro h2 { font-size: 34px; }
  .hero-metrics { grid-template-columns: 1fr; }
  .metric-value { font-size: 30px; white-space: normal; }
}

/* v7 stores page hardening */
.stores-kpi { margin-bottom: 20px; }
.stores-kpi .metric-card { min-width: 0; }
.stores-kpi .money-value { font-size: clamp(24px, 2vw, 34px); letter-spacing: -.04em; }
.stores-layout.dashboard-grid { grid-template-columns: minmax(0, 1.35fr) minmax(340px, .75fr); }
.stores-table-card { max-width: 100%; }
.stores-table th,
.stores-table td { white-space: nowrap; }
.stores-table td:first-child,
.stores-table td:nth-child(3) { white-space: normal; min-width: 220px; }
@media (max-width: 1180px) {
  .stores-layout.dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .stores-kpi.grid-4 { grid-template-columns: 1fr; }
  .stores-table th,
  .stores-table td { padding: 13px 14px; }
}

/* Foundation stability: prevent wide content and forms from breaking mobile layouts. */
img, svg { max-width: 100%; height: auto; }
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 760px; }
.top-actions, .actions-row, .table-toolbar, .filter-bar, .form-actions { min-width: 0; }
.field, .field input, .field select, .field textarea { min-width: 0; }
.btn-primary, .btn-secondary, .btn-light, .quick-link, .logout { white-space: nowrap; }

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; }
  .top-actions { width: 100%; justify-content: space-between; }
  .table-toolbar { align-items: stretch; flex-direction: column; }
  .filter-bar { display: grid; grid-template-columns: 1fr; }
  .filter-bar .field { min-width: 0; }
  .actions-row { display: grid; grid-template-columns: 1fr; }
  .action-card { min-height: auto; }
  .sync-pill { align-items: flex-start; }
  .metric-card { min-height: 132px; }
  .form-actions > * { flex: 1 1 auto; }
  .login-page { padding: 14px; }
  th, td { padding: 13px 14px; }
}

/* v8 Super Admin store management */
.row-actions-details { position: relative; display: inline-block; text-align: left; }
.row-actions-details > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.row-actions-details > summary::-webkit-details-marker { display: none; }
.inline-edit-form {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 14px 35px rgba(15, 23, 42, .12);
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
  min-width: 420px;
  max-width: min(560px, calc(100vw - 60px));
}
.inline-edit-form label { font-size: 12px; font-weight: 800; color: var(--muted, #64748b); }
.inline-edit-form input {
  margin-top: 5px;
  width: 100%;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
}
.inline-edit-form .wide { grid-column: 1 / -1; }
.toggle-store-form { margin-top: 8px; text-align: right; }
@media (max-width: 760px) {
  .inline-edit-form { min-width: 300px; grid-template-columns: 1fr; }
  .inline-edit-form .wide { grid-column: auto; }
}

/* v9 Products and Inventory MVP */
.product-edit-form { min-width: 620px; max-width: min(760px, calc(100vw - 60px)); }
.inline-edit-form select {
  margin-top: 5px;
  width: 100%;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  font: inherit;
}
.table-toolbar .actions-row { justify-content: flex-end; align-items: end; }
@media (max-width: 760px) {
  .product-edit-form { min-width: 300px; max-width: calc(100vw - 42px); }
}
