/* Vyapari client panel. Ocean Mist palette (same as the app). */
:root {
  --bg: #d5e4eb;
  --card: #e9f2f6;
  --card-2: #f4f9fb;
  --line: #c3d7e1;
  --ink: #15303b;
  --muted: #4e6a77;
  --brand: #255a72;
  --brand-ink: #ffffff;
  --accent: #6fcfdb;
  --accent-ink: #0b3943;
  --up: #0f6a4c;
  --down: #a8321f;
  --pill: #d2f0e5;
  --night: #24425a;
  --radius: 16px;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--sans);
  padding-bottom: 96px;
}
[hidden] { display: none !important; }
h1, h2 { font-family: var(--serif); color: var(--brand); font-weight: 600; margin: 0 0 6px; }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--down); font-weight: 600; font-size: 13.5px; margin: 8px 0 0; min-height: 0; }
.error:empty { display: none; }

/* header */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px max(16px, calc((100vw - 880px) / 2));
  background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.brand-name { font-family: var(--serif); font-size: 20px; font-weight: 600; color: var(--brand); line-height: 1.15; }
.brand-sub { font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); min-width: 0; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }

main { max-width: 880px; margin: 0 auto; padding: 16px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px;
}
.center-card {
  max-width: 420px; margin: 10vh auto 0; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 22px;
}
.google-btn { display: flex; justify-content: center; margin: 22px 0 6px; min-height: 44px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* tabs */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; scrollbar-width: none; }
.tab {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  font: 700 13.5px var(--sans); padding: 8px 14px; border-radius: 999px; white-space: nowrap; cursor: pointer;
}
.tab.active { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.tab:disabled { opacity: .55; cursor: default; }

/* live */
.live-head { display: flex; justify-content: space-between; align-items: center; }
.live-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 8px; }
.live-grid div { background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.live-grid .lbl { display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
.live-grid b { font-size: 19px; font-variant-numeric: tabular-nums; }
.badge { font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: var(--pill); color: var(--up); }
.badge.night { background: var(--night); color: #fff; }

/* fields */
label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); }
input, select {
  display: block; width: 100%; margin-top: 5px;
  font: 600 16px var(--sans); color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--brand); }
input.bad { border-color: var(--down); background: #fff4f2; }
.fields { display: grid; gap: 12px; margin-top: 12px; }
.fields.three { grid-template-columns: repeat(3, 1fr); }
.fields.two { grid-template-columns: repeat(2, 1fr); }
.fields.off { opacity: .45; }

/* switch */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--ink); }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 46px; height: 26px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* buttons */
.btn {
  font: 700 14px var(--sans); border-radius: 10px; padding: 9px 14px; cursor: pointer;
  border: 1px solid var(--brand); background: var(--card-2); color: var(--brand);
}
.btn.primary { background: var(--brand); color: var(--brand-ink); }
.btn.ghost { border-color: var(--line); background: transparent; color: var(--muted); }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.danger { border-color: var(--down); color: var(--down); background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn {
  border: 1px solid var(--line); background: var(--card-2); color: var(--muted); border-radius: 8px;
  width: 32px; height: 32px; cursor: pointer; font-size: 12px;
}
.icon-btn:disabled { opacity: .35; cursor: default; }

/* symbol list */
.symbols { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.sym {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center;
  background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.sym.dragging { opacity: .5; }
.sym.drop-target { border-color: var(--brand); box-shadow: 0 0 0 2px var(--accent); }
.sym.is-hidden { opacity: .6; }
.sym.has-problem { border-color: var(--down); }
.handle { cursor: grab; color: var(--muted); font-weight: 800; user-select: none; padding: 4px; letter-spacing: -2px; }
.sym-name { font-weight: 800; font-size: 15.5px; }
.sym-name .tag { font-size: 11px; font-weight: 800; color: var(--muted); background: var(--line); border-radius: 6px; padding: 1px 6px; margin-left: 6px; }
.sym-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.sym-sides b { color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; display: block; }
.sym-problem { color: var(--down); font-size: 12.5px; font-weight: 700; margin-top: 4px; }
.sym-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.sym-move { display: flex; flex-direction: column; gap: 4px; }
.empty { text-align: center; padding: 16px 0 4px; }

/* save bar */
.savebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px max(16px, calc((100vw - 880px) / 2));
  background: var(--ink); color: #fff; font-weight: 700;
}
.savebar .btn.ghost { color: #d7e6ee; border-color: #4e6a77; }
.savebar .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.savebar div { display: flex; gap: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 20;
  background: var(--up); color: #fff; font-weight: 700; padding: 10px 16px; border-radius: 999px;
  box-shadow: 0 4px 16px rgba(21,48,59,.25); max-width: calc(100vw - 32px);
}
.toast.bad { background: var(--down); }

/* editor */
dialog {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0; width: min(640px, calc(100vw - 24px));
  background: var(--card); color: var(--ink); max-height: calc(100vh - 24px);
}
dialog::backdrop { background: rgba(21, 48, 59, .45); }
dialog form { padding: 20px; display: grid; gap: 12px; }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.side { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 12px; margin: 0; background: var(--card-2); min-width: 0; }
.side legend { padding: 0 4px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; color: var(--ink); font-weight: 800; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; }
.side-body { display: grid; gap: 10px; }
.side.off .side-body { opacity: .4; pointer-events: none; }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { font: 700 13.5px var(--sans); padding: 8px 4px; border: 0; background: #fff; color: var(--muted); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--brand); color: #fff; }
.result { font-size: 13px; color: var(--muted); }
.result b { font-size: 17px; color: var(--ink); font-variant-numeric: tabular-nums; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 640px) {
  .live-grid { grid-template-columns: repeat(2, 1fr); }
  .fields.three { grid-template-columns: 1fr 1fr; }
  .sides { grid-template-columns: 1fr; }
  .sym { grid-template-columns: auto 1fr; }
  .sym-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .handle { display: none; }
  .brand-sub { display: none; }
}
