/* ============================================================
   Optica Ariel — design system
   Fonts: Newsreader (serif headings) + Hanken Grotesk (body)
   ============================================================ */
:root {
  --blue: #2c7fc0;
  --blue-dark: #1f6597;
  --ink: #101a30;
  --ink-2: #16203a;
  --ink-3: #33405c;
  --body: #5a6480;
  --muted: #646d84;
  --muted-2: #868ea3;
  --muted-3: #99a0b2;
  --line: #dceaf6;
  --line-2: #eaf3fa;
  --line-3: #c8e0f2;
  --bg: #f2f8fd;
  --bg-soft: #eef6fc;
  --bg-tint: #e6f2fc;
  --white: #fff;
  --rust: #b9543f;
  --radius: 16px;
  --radius-lg: 18px;
  --shadow: 0 10px 30px rgba(20,68,110,0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  font-family: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink-2);
  line-height: 1.5;
}
a { text-decoration: none; color: inherit; }
::placeholder { color: #9aa3b8; }
.serif { font-family: 'Newsreader', Georgia, serif; font-weight: 500; }

/* ---------- App shell header ---------- */
.appbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(245,250,254,0.9); backdrop-filter: blur(10px);
  border-bottom: 1px solid #d2e6f4;
}
.appbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 14px 28px;
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
}
.logo { display: flex; align-items: center; gap: 11px; }
.logo .glyph { display: flex; align-items: center; gap: 0; }
.logo .glyph i { display: block; }
.logo .g-end { width: 9px; height: 4px; border-radius: 2px; background: var(--blue); }
.logo .g-lens { width: 22px; height: 16px; border: 3.5px solid var(--blue); border-radius: 50%; }
.logo .g-bridge { width: 7px; height: 3px; background: var(--blue); }
.logo .name { font-family: 'Newsreader', serif; font-size: 21px; font-weight: 600; letter-spacing: -0.01em; color: var(--blue-dark); line-height: 1; }
.logo .sub { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted-2); margin-top: 3px; }
.appnav { display: flex; gap: 4px; margin-left: 10px; flex-wrap: wrap; }
.appnav a {
  border-radius: 999px; padding: 9px 16px; font-size: 14.5px; font-weight: 600;
  color: var(--ink-3); background: transparent;
}
.appnav a:hover { background: #e1eef9; }
.appnav a.active { background: var(--blue); color: #fff; }
.appbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.appbar-right .who { font-size: 13px; color: var(--muted); }

/* ---------- Layout ---------- */
.container { max-width: 1180px; margin: 0 auto; padding: 0 28px 90px; }
.footer { border-top: 1px solid #d2e6f4; background: #e8f2fb; }
.footer-inner {
  max-width: 1180px; margin: 0 auto; padding: 28px; display: flex;
  justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px;
}
.footer .f-brand { font-family: 'Newsreader', serif; font-size: 18px; color: var(--blue-dark); }
.footer .f-meta { font-size: 13.5px; color: #737c92; }
.footer .f-fine { font-size: 13px; color: var(--muted-3); }

/* ---------- Headings ---------- */
.page-head { padding: 38px 0 8px; }
h1.page-title { font-family: 'Newsreader', serif; font-size: 40px; font-weight: 500; margin: 0; color: var(--ink); letter-spacing: -0.01em; }
.page-sub { font-size: 16px; color: var(--muted); margin: 8px 0 0; }
.eyebrow { font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted-3); }
h2.section-title { font-family: 'Newsreader', serif; font-size: 32px; font-weight: 500; margin: 0; color: var(--ink); }

/* ---------- Cards ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 22px; }
.card + .card { margin-top: 24px; }
.card-title { font-size: 16px; font-weight: 700; color: var(--ink-2); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.grid-2-wide { display: grid; grid-template-columns: 1.25fr 1fr; gap: 24px; align-items: start; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-3); background: var(--white); color: var(--ink-3);
  border-radius: 999px; padding: 12px 22px; font: inherit; font-weight: 600; font-size: 15px; cursor: pointer;
}
.btn:hover { border-color: var(--blue); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #f4faff; }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-ghost { background: none; border: none; color: var(--blue); font-weight: 600; cursor: pointer; padding: 0; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.link-back { background: none; border: none; color: var(--muted); font-size: 14.5px; font-weight: 600; cursor: pointer; padding: 0; display: inline-block; margin: 28px 0 0; }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 12px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px;
  border: 1px solid var(--line-3); border-radius: 9px; font: inherit; font-size: 15px;
  background: #fff; color: var(--ink-2);
}
textarea { resize: vertical; }
.form-row { display: flex; gap: 12px; }
.form-row > label { flex: 1; }
.checkbox { display: flex; align-items: center; gap: 9px; font-weight: 600; color: var(--ink-3); }
.checkbox input { width: auto; margin: 0; }

/* ---------- Pills / chips ---------- */
.pill {
  border: 1px solid var(--line-3); background: #fff; color: var(--ink-3);
  border-radius: 999px; padding: 9px 18px; font-size: 14px; font-weight: 600; cursor: pointer; display: inline-block;
}
.pill.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.badge {
  display: inline-block; border-radius: 999px; padding: 5px 12px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}

/* ---------- Tables (data grid style) ---------- */
.dgrid { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.dgrid-head, .dgrid-row { display: grid; align-items: center; }
.dgrid-head { background: var(--bg-soft); font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted-2); font-weight: 700; }
.dgrid-head > div { padding: 13px 14px; }
.dgrid-row { border-top: 1px solid var(--line-2); }
.dgrid-row > div { padding: 13px 14px; }
.dgrid-row:first-child { border-top: none; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.stat .s-label { font-size: 13px; color: var(--muted-2); }
.stat .s-num { font-family: 'Newsreader', serif; font-size: 34px; color: var(--blue); margin-top: 4px; }
.stat .s-sub { font-size: 13px; margin-top: 2px; }
a.stat:hover { border-color: var(--blue); }

/* ---------- Frame swatch (CSS-drawn glasses) ---------- */
.swatch { display: flex; align-items: center; justify-content: center; position: relative; }
.frame { display: flex; align-items: center; gap: 0; }
.frame .lens { background: rgba(0,0,0,0.04); }
.frame .end, .frame .bridge { flex: none; }

/* ---------- Product cards ---------- */
.product-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 18px; }
.product-card { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 0; overflow: hidden; cursor: pointer; position: relative; display: block; }
.product-card:hover { border-color: #cdc4b3; }
.product-card .pc-img { height: 140px; display: flex; align-items: center; justify-content: center; }
.product-card .pc-body { padding: 14px 16px 16px; }
.pc-brand { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-3); }
.pc-name { font-family: 'Newsreader', serif; font-size: 19px; color: #1a2440; margin-top: 3px; }
.pc-price { font-size: 15px; font-weight: 600; color: var(--blue); }
.soldout-tag { position: absolute; top: 12px; left: 12px; z-index: 2; background: var(--rust); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; padding: 4px 9px; border-radius: 999px; text-transform: uppercase; }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: 12px; margin: 18px 0 0; font-size: 14.5px; }
.alert-error { background: #f6e3de; color: #99412f; }
.alert-success { background: var(--bg-tint); color: var(--blue-dark); }

/* ---------- Auth ---------- */
.auth-wrap { max-width: 440px; margin: 56px auto 0; }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 32px; }
.auth-card h1 { font-family: 'Newsreader', serif; font-weight: 500; font-size: 30px; margin: 0 0 4px; color: var(--ink); }
.auth-alt { font-size: 14px; color: var(--muted); margin-top: 16px; text-align: center; }

/* ---------- Misc ---------- */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; margin: 0; font-size: 14.5px; }
.kv dt { color: var(--muted-2); }
.kv dd { margin: 0; color: var(--ink-3); }
.muted { color: var(--muted); }
.rx-table { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.rx-table .rx-h, .rx-table .rx-r { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr 1fr; }
.rx-table .rx-h { background: var(--bg-soft); font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted-2); font-weight: 700; }
.rx-table .rx-h > div { padding: 11px 8px; text-align: center; }
.rx-table .rx-h > div:first-child { text-align: left; padding-left: 14px; }
.rx-table .rx-r { border-top: 1px solid var(--line-2); font-size: 15px; align-items: center; }
.rx-table .rx-r > div { padding: 13px 8px; text-align: center; color: var(--ink-2); }
.rx-table .rx-r > div:first-child { text-align: left; padding-left: 14px; font-weight: 600; color: var(--ink-3); }
.timeline-item { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.timeline-item .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; }
.searchbar { display: flex; gap: 8px; margin: 18px 0 0; }
.searchbar input { margin: 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.row-actions { display: flex; gap: 8px; align-items: center; }
.avatar { border-radius: 50%; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; font-family: 'Newsreader', serif; flex: none; }
.avatar-sm { width: 36px; height: 36px; font-size: 15px; background: var(--bg-tint); color: var(--blue); }

/* ---------- Language switcher ---------- */
.lang-switch { display: inline-flex; gap: 2px; border: 1px solid var(--line-3); border-radius: 999px; padding: 2px; background: #fff; }
.lang-switch a { font-size: 12px; font-weight: 700; color: var(--muted); padding: 5px 9px; border-radius: 999px; line-height: 1; }
.lang-switch a:hover { color: var(--blue); text-decoration: none; }
.lang-switch a.on { background: var(--blue); color: #fff; }

/* ---------- RTL ---------- */
[dir="rtl"] .kv { direction: rtl; }
[dir="rtl"] .link-back, [dir="rtl"] .auth-alt { text-align: right; }
[dir="rtl"] .rx-table .rx-h > div:first-child,
[dir="rtl"] .rx-table .rx-r > div:first-child { text-align: right; padding-left: 8px; padding-right: 14px; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2,1fr); }
  .product-grid { grid-template-columns: repeat(2,1fr); }
  .grid-2, .grid-2-wide { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .product-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  .appnav { order: 3; width: 100%; }
}
