/* Temple Ivory — the design system from the approved canvas, as real CSS. */

@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,400&family=Manrope:wght@400;500;600;700;800&family=Noto+Sans+Devanagari:wght@400;500;600&display=swap');

:root {
  --green: #0F2E24;
  --green-2: #174537;
  --green-tint: #E7F0EA;
  --green-wash: #F2F7F4;
  --clay: #9C4F35;
  --clay-tint: #F9ECE6;
  --gold: #C9A227;
  --gold-tint: #F6EFD9;
  --amber: #E8A33D;
  --amber-ink: #8A5A12;
  --amber-tint: #FDF2E0;
  --ivory: #FBF9F4;
  --ink: #1E1B16;
  --muted: #6B675B;
  --ok: #2F7C52;
  --hair: rgba(36, 31, 22, 0.08);
  --lift: 0 1px 2px rgba(15, 46, 36, 0.05), 0 10px 26px -14px rgba(15, 46, 36, 0.2);
  --lift-lg: 0 1px 2px rgba(15, 46, 36, 0.05), 0 24px 60px -24px rgba(15, 46, 36, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  font-family: 'Manrope', 'Noto Sans Devanagari', system-ui, sans-serif;
  color: var(--ink);
  background: #EFEBE0;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

.serif { font-family: 'Newsreader', Georgia, serif; letter-spacing: -0.015em; }
.num { font-variant-numeric: tabular-nums; }
.micro {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--muted);
}
.muted { color: var(--muted); }
.hide { display: none !important; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; }
.center { text-align: center; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--clay); text-decoration: none; }
a:hover { color: var(--green); }
::-webkit-scrollbar { width: 0; height: 0; }

/* ------------------------------------------------------------ app shell */

.shell {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--ivory);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

@media (min-width: 560px) {
  body.framed { padding: 28px 0; background: #E7E2D5; }
  body.framed .shell {
    min-height: min(880px, calc(100dvh - 56px));
    height: min(880px, calc(100dvh - 56px));
    border-radius: 44px;
    box-shadow: var(--lift-lg), 0 0 0 1px var(--hair);
  }
}

.wide { max-width: none; }

/* --------------------------------------------------------------- topbar */

.topbar {
  flex: 0 0 auto;
  background: var(--green);
  color: #fff;
  padding: 20px 16px 15px;
  display: flex;
  align-items: center;
  gap: 11px;
}
.framed .topbar { border-radius: 44px 44px 0 0; }
.topbar .title { font-size: 17px; font-weight: 600; line-height: 1.15; }
.topbar .sub { font-size: 11px; color: rgba(255, 255, 255, 0.66); margin-top: 2px; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: none; background: rgba(255, 255, 255, 0.1); color: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.icon-btn.ghost { background: #fff; border: 1px solid var(--hair); color: var(--ink); box-shadow: var(--lift); }

.pill-btn {
  height: 32px; padding: 0 11px; border-radius: 100px;
  border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.08);
  color: #fff; font-size: 11.5px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0;
}
.pill-btn.on { border-color: rgba(95, 201, 142, 0.45); background: rgba(95, 201, 142, 0.16); color: #9FE5BE; }

/* -------------------------------------------------------------- avatars */

.avatar {
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-family: 'Newsreader', serif; font-weight: 600; flex-shrink: 0;
  width: 42px; height: 42px; font-size: 16px;
  background: var(--green-tint); color: var(--green);
}
.avatar.gold { background: var(--green-2); color: var(--gold); box-shadow: 0 0 0 1.5px rgba(201, 162, 39, 0.55); }
.avatar.clay { background: var(--clay-tint); color: var(--clay); }
.avatar.sm { width: 34px; height: 34px; font-size: 13px; }
.avatar.lg { width: 58px; height: 58px; font-size: 22px; box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px rgba(201, 162, 39, 0.5); }
.avatar-wrap { position: relative; flex-shrink: 0; }
.dot-online {
  position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px;
  border-radius: 50%; background: #3FA86A; box-shadow: 0 0 0 2px #fff;
}
.topbar .dot-online { box-shadow: 0 0 0 2.5px var(--green); background: #5FC98E; }

/* --------------------------------------------------------------- pieces */

.card {
  background: #fff; border: 1px solid var(--hair); border-radius: 18px;
  padding: 14px; box-shadow: var(--lift);
}
.card.flat { box-shadow: none; }
.card.tint { background: var(--green-wash); }
.card.gold { background: var(--gold-tint); border-color: transparent; }
.card.clay { background: var(--clay-tint); border-color: rgba(156, 79, 53, 0.16); }

.badge {
  font-size: 9.5px; font-weight: 700; color: var(--green);
  background: var(--green-tint); padding: 3px 8px; border-radius: 100px; white-space: nowrap;
}
.badge.gold { background: var(--gold-tint); }
.badge.clay { background: var(--clay-tint); color: var(--clay); }
.badge.amber { background: var(--amber-tint); color: var(--amber-ink); }
.badge.ok { background: var(--green-tint); color: var(--ok); }

.chip {
  height: 34px; padding: 0 13px; border-radius: 100px;
  border: 1px solid var(--hair); background: #fff; color: var(--ink);
  font-size: 12px; font-weight: 700; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.chip.on { border: 1.5px solid var(--green); background: var(--green-wash); color: var(--green); }

.btn {
  height: 48px; padding: 0 22px; border-radius: 100px; border: none;
  background: var(--green); color: #fff; font-size: 14px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 10px 24px -12px rgba(15, 46, 36, 0.9);
}
.btn:disabled { opacity: 0.45; box-shadow: none; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--hair); box-shadow: none; }
.btn.sm { height: 36px; padding: 0 15px; font-size: 12px; }
.btn.lg { height: 54px; font-size: 14.5px; }

label.field { display: block; }
.field > .micro { display: block; margin-bottom: 7px; }
.input, textarea.input, select.input {
  width: 100%; height: 50px; border: 1px solid var(--hair); background: #fff;
  border-radius: 14px; padding: 0 14px; font-size: 14px; font-weight: 600; outline: none;
}
textarea.input { height: auto; min-height: 92px; padding: 13px 15px; font-weight: 400; line-height: 1.55; resize: vertical; }
.input:focus, textarea.input:focus, select.input:focus { border-color: var(--green); }
.input::placeholder { font-weight: 500; color: #A8A396; }

.hairline { height: 1px; background: var(--hair); }

/* ---------------------------------------------------------------- chat */

.thread {
  flex: 1 1 auto; overflow-y: auto; padding: 16px 14px 8px;
  display: flex; flex-direction: column; gap: 10px;
}
.bubble {
  max-width: 85%; padding: 12px 15px; font-size: 13.5px; line-height: 1.6;
  border-radius: 20px 20px 20px 6px; align-self: flex-start;
  background: #fff; border: 1px solid var(--hair); box-shadow: var(--lift);
  white-space: pre-wrap; word-break: break-word;
}
.bubble.me {
  align-self: flex-end; background: var(--green); color: #fff;
  border: none; border-radius: 20px 20px 6px 20px; box-shadow: none;
}
.bubble .translation {
  margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--hair);
  font-size: 11px; color: var(--muted); line-height: 1.45;
}
.system-line {
  align-self: center; font-size: 10.5px; font-weight: 600; color: var(--muted);
  text-align: center; max-width: 80%; line-height: 1.45;
}
.typing { display: inline-flex; gap: 5px; align-items: center; }
.typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--muted); display: block;
  animation: jvdot 1.3s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.18s; }
.typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes jvdot {
  0%, 60%, 100% { opacity: 0.25; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

.composer {
  flex: 0 0 auto; background: #fff; border-top: 1px solid var(--hair);
  padding: 11px 14px calc(14px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px;
}
.composer input {
  flex: 1 1 auto; min-width: 0; height: 44px; border: 1px solid var(--hair);
  background: var(--ivory); border-radius: 100px; padding: 0 18px;
  font-size: 13.5px; outline: none;
}
.composer .send {
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: var(--green); color: #fff; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; box-shadow: 0 6px 16px -6px rgba(15, 46, 36, 0.6);
}

/* --------------------------------------------------------------- timer */

.timer {
  display: inline-flex; align-items: center; gap: 6px; height: 34px;
  padding: 0 12px 0 8px; border-radius: 100px; flex-shrink: 0;
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 13px; font-weight: 800; color: #fff;
}
.timer.warn { background: rgba(232, 163, 61, 0.2); border-color: rgba(232, 163, 61, 0.42); color: #F2C57C; }
.timer .ring { transform: rotate(-90deg); flex-shrink: 0; }
.timer .ring circle { fill: none; stroke-width: 3; stroke-linecap: round; }
.timer .ring .track { stroke: rgba(255, 255, 255, 0.22); }
.timer .ring .val { stroke: var(--gold); transition: stroke-dashoffset 0.4s linear; }
.timer.warn .ring .val { stroke: var(--amber); }

.rail { flex: 0 0 auto; height: 3px; background: rgba(36, 31, 22, 0.08); }
.rail > i { display: block; height: 100%; background: var(--gold); transition: width 0.4s linear; }
.rail.warn > i { background: var(--amber); }

.pulse { animation: jvpulse 1.4s ease-in-out infinite; }
@keyframes jvpulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ------------------------------------------------------------- top-up */

.topup {
  flex: 0 0 auto; margin: 0 14px 10px; background: #fff;
  border: 1px solid rgba(232, 163, 61, 0.45); border-radius: 20px; padding: 13px 14px;
  box-shadow: 0 -4px 24px -10px rgba(15, 46, 36, 0.28);
}
.amounts { display: flex; gap: 7px; }
.amounts button {
  flex: 1 1 0; min-width: 0; height: 50px; border-radius: 13px;
  border: 1px solid var(--hair); background: var(--ivory);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.amounts button.on { border: 1.5px solid var(--green); background: var(--green-wash); }
.amounts .amt { font-size: 14px; font-weight: 800; }
.amounts .mins { font-size: 9.5px; font-weight: 600; color: var(--muted); }

/* --------------------------------------------------------------- sheet */

.scrim {
  position: absolute; inset: 0; background: rgba(12, 32, 25, 0.5);
  z-index: 40; display: flex; align-items: flex-end;
}
.framed .scrim { border-radius: 44px; }
.sheet {
  width: 100%; background: #fff; border-radius: 30px 30px 0 0;
  padding: 12px 20px calc(24px + env(safe-area-inset-bottom));
  max-height: 92%; overflow-y: auto; box-shadow: 0 -20px 60px -20px rgba(12, 32, 25, 0.45);
}
.framed .sheet { border-radius: 30px 30px 44px 44px; }
.grabber { width: 38px; height: 5px; border-radius: 100px; background: rgba(36, 31, 22, 0.16); margin: 0 auto 18px; }
.sheet h2 { font-family: 'Newsreader', serif; font-size: 22px; font-weight: 600; color: var(--green); margin: 0; letter-spacing: -0.015em; }

/* --------------------------------------------------------------- lists */

.list { display: flex; flex-direction: column; gap: 8px; }
.list-row {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 12px 13px; border-radius: 16px; border: 1px solid transparent; background: #fff;
}
.list-row.bordered { border-color: var(--hair); }
.list-row.on { border-color: var(--hair); background: var(--green-wash); box-shadow: var(--lift); }
.list-row.warn { border-color: rgba(232, 163, 61, 0.45); box-shadow: var(--lift); }
.list-row .name { font-size: 13.5px; font-weight: 700; }
.list-row .snippet { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { border-radius: 13px; padding: 10px 11px; background: rgba(255, 255, 255, 0.09); }
.stat .v { font-family: 'Newsreader', serif; font-size: 20px; font-weight: 600; line-height: 1; color: #fff; }
.stat .k { font-size: 9.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: rgba(255, 255, 255, 0.55); margin-top: 5px; }
.stat.amber { background: rgba(232, 163, 61, 0.18); }
.stat.amber .v { color: #F2C57C; }

.tabbar {
  flex: 0 0 auto; background: #fff; border-top: 1px solid var(--hair);
  padding: 9px 10px calc(12px + env(safe-area-inset-bottom)); display: flex;
}
.tabbar button {
  flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: none; background: none; color: var(--muted); font-size: 10px; font-weight: 700;
}
.tabbar button.on { color: var(--green); font-weight: 800; }

/* -------------------------------------------------------------- stars */

.stars { display: flex; gap: 2px; }
.stars button {
  width: 46px; height: 46px; border: none; background: none;
  display: flex; align-items: center; justify-content: center; padding: 0;
}
.stars svg { width: 30px; height: 30px; }
.stars.sm button { width: 34px; height: 34px; }
.stars.sm svg { width: 22px; height: 22px; }

/* ------------------------------------------------------------ desktop */

.board { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.pane { background: #fff; border: 1px solid var(--hair); border-radius: 20px; box-shadow: var(--lift); }

@media (min-width: 1100px) {
  body.console { background: var(--ivory); padding: 0; }
  body.console .shell {
    max-width: none; width: 100%; height: 100dvh; min-height: 0;
    border-radius: 0; box-shadow: none; flex-direction: row;
  }
  .console-nav {
    flex: 0 0 76px; background: var(--green); display: flex; flex-direction: column;
    align-items: center; padding: 20px 0; gap: 14px;
  }
  .console-list { flex: 0 0 336px; border-right: 1px solid var(--hair); background: #fff; display: flex; flex-direction: column; }
  .console-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
  .console-aside { flex: 0 0 320px; border-left: 1px solid var(--hair); background: #fff; overflow-y: auto; padding: 22px 20px; }
  .only-mobile { display: none !important; }
  .framed .topbar { border-radius: 0; }
}
@media (max-width: 1099px) {
  .only-desktop { display: none !important; }
}

/* --------------------------------------------------------------- misc */

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--green); color: #fff; padding: 12px 20px; border-radius: 100px;
  font-size: 13px; font-weight: 600; z-index: 90; box-shadow: var(--lift-lg);
  max-width: min(90vw, 420px); text-align: center;
}
.toast.bad { background: var(--clay); }

.progress { display: flex; gap: 5px; }
.progress i { flex: 1 1 0; height: 4px; border-radius: 100px; background: rgba(36, 31, 22, 0.12); }
.progress i.on { background: var(--green); }

.empty { padding: 40px 24px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.6; }

.scroll-box {
  height: 260px; overflow-y: auto; border: 1px solid var(--hair);
  border-radius: 18px; padding: 16px; background: #fff; box-shadow: var(--lift);
  font-size: 11.5px; line-height: 1.6;
}
.scroll-box h4 { font-size: 11.5px; font-weight: 800; margin: 0 0 3px; }
.scroll-box p { margin: 0 0 13px; }

.upload {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 14px 13px; border-radius: 18px; background: #fff;
  border: 1.5px dashed var(--hair);
}
.upload.required { border-color: rgba(156, 79, 53, 0.45); }
.upload.done { border: 1px solid var(--hair); box-shadow: var(--lift); }
.upload .box {
  width: 44px; height: 44px; border-radius: 12px; background: var(--ivory);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

table.grid { width: 100%; border-collapse: collapse; }
table.grid th {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted); text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--hair);
}
table.grid td { padding: 11px 8px; border-bottom: 1px solid var(--hair); font-size: 12.5px; vertical-align: middle; }
table.grid tr:last-child td { border-bottom: none; }
table.grid input.mini {
  width: 76px; height: 32px; border: 1px solid var(--hair); border-radius: 9px;
  padding: 0 9px; text-align: right; font-weight: 700; background: var(--ivory);
  font-variant-numeric: tabular-nums;
}
