/* Seyaa Solitaire Cost Data — matches the Seyaa Solitaire design system
   (Tailwind "stone" neutrals + brand orange, Geist typeface, light theme). */

:root {
  --stone-50: #fafaf9;
  --stone-100: #f5f5f4;
  --stone-200: #e7e5e4;
  --stone-300: #d6d3d1;
  --stone-400: #a8a29e;
  --stone-500: #78716c;
  --stone-600: #57534e;
  --stone-700: #44403c;
  --stone-800: #292524;
  --stone-900: #1c1917;

  --brand-50: #fdf5f0;
  --brand-100: #fcefe8;
  --brand-200: #f9e3d6;
  --brand-400: #e79060;
  --brand-500: #e17437;
  --brand-600: #dd611c;
  --brand-700: #ba5118;

  --teal-600: #0f766e;
  --teal-50: #f0fdfa;
  --red-600: #e40014;

  --ring: 0 0 0 3px rgba(225, 116, 55, 0.3);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 30px rgba(28, 25, 23, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--stone-50);
  color: var(--stone-900);
  font-family: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--brand-600); text-decoration: none; }
.mono { font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.login-inner { width: 100%; max-width: 384px; }
.login-logo { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 32px; }
.login-logo img { width: 192px; height: auto; }
.login-logo .subtitle { margin-top: 12px; font-size: 14px; color: var(--stone-600); }
.login-card {
  background: #fff; border: 1px solid var(--stone-200); border-radius: 16px;
  padding: 24px; box-shadow: var(--shadow-sm);
}
.login-card .field { margin-bottom: 16px; }
.login-card .field:last-of-type { margin-bottom: 0; }
.login-note { margin-top: 24px; text-align: center; font-size: 12px; color: var(--stone-500); }
.error-msg { color: var(--red-600); font-size: 13px; text-align: center; min-height: 18px; margin-top: 10px; }

/* ---------- Form controls ---------- */
label { display: block; font-size: 12px; font-weight: 500; color: var(--stone-600); margin-bottom: 4px; }
input, select {
  width: 100%; background: #fff; color: var(--stone-900);
  border: 1px solid var(--stone-300); border-radius: 8px;
  padding: 10px 12px; font-size: 14px; outline: none;
  font-family: inherit; transition: border-color .12s, box-shadow .12s;
}
input::placeholder { color: var(--stone-400); }
input:focus, select:focus { border-color: var(--brand-600); box-shadow: var(--ring); }
select { cursor: pointer; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 12px 16px; border-radius: 8px; border: 1px solid transparent;
  background: var(--brand-600); color: #fff; font-weight: 600; font-size: 14px;
  cursor: pointer; font-family: inherit; transition: background-color .12s, border-color .12s;
}
.btn:hover { background: var(--brand-500); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--stone-700); border-color: var(--stone-300); width: auto; padding: 8px 14px; }
.btn.secondary:hover { background: var(--stone-100); }
.btn.danger { background: #fff; color: var(--red-600); border-color: #f3c6c6; width: auto; padding: 6px 12px; font-size: 13px; }
.btn.danger:hover { background: #fef2f2; }
.btn.small { width: auto; padding: 8px 14px; font-size: 13px; }

/* ---------- App shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 20px; background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--stone-200);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 34px; width: auto; }
.brand .sep { width: 1px; height: 26px; background: var(--stone-200); }
.brand .title { font-weight: 600; font-size: 15px; color: var(--stone-900); line-height: 1.1; }
.brand .subtitle { font-size: 11px; color: var(--stone-500); letter-spacing: .3px; }
.topbar .right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-chip { font-size: 13px; color: var(--stone-500); }
.user-chip b { color: var(--stone-800); font-weight: 600; }

.badge { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.badge.admin { background: var(--brand-100); color: var(--brand-700); }
.badge.user { background: var(--stone-100); color: var(--stone-600); }

.container { max-width: 1500px; margin: 0 auto; padding: 22px 20px 64px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--stone-200); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow-sm); }
.stat .k { font-size: 11px; color: var(--stone-500); text-transform: uppercase; letter-spacing: .6px; font-weight: 500; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 4px; color: var(--stone-900); }
.stat .v.gold { color: var(--brand-600); }
.stat .v.em { color: var(--teal-600); }

.toolbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  background: #fff; border: 1px solid var(--stone-200); border-radius: 14px;
  padding: 12px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.toolbar .grow { flex: 1 1 240px; }
.toolbar input, .toolbar select { padding: 9px 11px; font-size: 13.5px; }
.seg { display: inline-flex; border: 1px solid var(--stone-300); border-radius: 8px; overflow: hidden; background: var(--stone-50); }
.seg button { background: transparent; color: var(--stone-600); border: none; padding: 8px 13px; font-size: 13px; cursor: pointer; font-weight: 500; font-family: inherit; }
.seg button:hover { background: var(--stone-100); }
.seg button.active { background: var(--brand-600); color: #fff; }
.toolbar .spacer { flex: 1 1 auto; }

.table-wrap { overflow-x: auto; border: 1px solid var(--stone-200); border-radius: 14px; background: #fff; box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 900px; }
thead th {
  position: sticky; top: 0; background: var(--stone-50); color: var(--stone-500);
  text-align: left; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
  padding: 10px 12px; border-bottom: 1px solid var(--stone-200); white-space: nowrap;
}
tbody td { padding: 11px 12px; border-bottom: 1px solid var(--stone-100); vertical-align: top; color: var(--stone-800); }
tbody tr { cursor: pointer; transition: background .1s; }
tbody tr:hover { background: var(--brand-50); }
tbody tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.total-cell { font-weight: 700; color: var(--brand-700); }
.total-cell.inr { color: var(--teal-600); }
.src-tag { font-size: 10px; padding: 2px 7px; border-radius: 999px; font-weight: 600; letter-spacing: .3px; }
.src-tag.New { background: var(--brand-100); color: var(--brand-700); }
.src-tag.Old { background: var(--stone-100); color: var(--stone-500); }
.design-name { font-weight: 600; color: var(--stone-900); }
.sub { color: var(--stone-500); font-size: 12px; margin-top: 2px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.pager .info { color: var(--stone-500); font-size: 13px; }
.pager .controls { display: flex; gap: 8px; align-items: center; }
.pager select { width: auto; }

.empty, .loading { text-align: center; color: var(--stone-500); padding: 50px 20px; font-size: 14px; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--stone-200); border-top-color: var(--brand-600); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(28, 25, 23, .45); backdrop-filter: blur(2px); z-index: 60; display: none; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.modal-back.open { display: flex; }
.modal { width: 100%; max-width: 760px; background: #fff; border: 1px solid var(--stone-200); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.modal .head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--stone-200); }
.modal .head h2 { margin: 0; font-size: 18px; color: var(--stone-900); }
.modal .head .close { background: none; border: none; color: var(--stone-400); font-size: 24px; cursor: pointer; line-height: 1; }
.modal .head .close:hover { color: var(--stone-700); }
.modal .body { padding: 20px 22px; }
.cost-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.cost-box { border: 1px solid var(--stone-200); border-radius: 12px; padding: 14px 16px; }
.cost-box.usd { background: var(--brand-50); border-color: var(--brand-200); }
.cost-box.inr { background: var(--teal-50); border-color: #cdeeea; }
.cost-box h4 { margin: 0 0 10px; font-size: 11px; color: var(--stone-500); text-transform: uppercase; letter-spacing: .6px; font-weight: 600; }
.cost-row { display: flex; justify-content: space-between; font-size: 13.5px; padding: 5px 0; color: var(--stone-700); }
.cost-row.total { border-top: 1px solid var(--stone-200); margin-top: 6px; padding-top: 9px; font-weight: 700; font-size: 15px; }
.cost-row .lbl { color: var(--stone-500); }
.cost-row .rate { font-size: 11px; font-weight: 600; color: var(--stone-600); background: rgba(255,255,255,.75); border: 1px solid var(--stone-200); padding: 1px 7px; border-radius: 999px; white-space: nowrap; margin-left: 2px; }
.usd .cost-row.total { color: var(--brand-700); }
.inr .cost-row.total { color: var(--teal-600); }

.spec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 18px; }
.spec .k { font-size: 11px; color: var(--stone-500); text-transform: uppercase; letter-spacing: .4px; }
.spec .v { font-size: 13.5px; margin-top: 2px; color: var(--stone-800); word-break: break-word; }
.section-title { font-size: 11px; color: var(--stone-500); text-transform: uppercase; letter-spacing: .6px; font-weight: 600; margin: 20px 0 10px; border-top: 1px solid var(--stone-200); padding-top: 16px; }
.comments { background: #fffbeb; border: 1px solid #fee685; border-radius: 10px; padding: 10px 12px; font-size: 13px; color: #92600a; }
.breakup-table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 0; }
.breakup-table th { background: var(--stone-50); }
.breakup-table td, .breakup-table th { padding: 8px 10px; border-bottom: 1px solid var(--stone-100); }

/* ---------- Admin ---------- */
.panel { background: #fff; border: 1px solid var(--stone-200); border-radius: 14px; padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.panel h3 { margin: 0 0 4px; font-size: 16px; color: var(--stone-900); }
.panel .desc { color: var(--stone-500); font-size: 13px; margin: 0 0 16px; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { margin-bottom: 0; flex: 1 1 180px; }
.note { background: var(--brand-50); border: 1px solid var(--brand-200); border-radius: 10px; padding: 12px 14px; font-size: 13px; color: var(--brand-700); margin-top: 14px; }
.tag-local { font-size: 10px; padding: 2px 8px; border-radius: 999px; background: var(--stone-100); color: var(--stone-600); }
.tag-fixed { font-size: 10px; padding: 2px 8px; border-radius: 999px; background: var(--brand-100); color: var(--brand-700); }

.flash { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--stone-900); color: #fff; padding: 11px 18px; border-radius: 10px; font-weight: 500; font-size: 13.5px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.flash.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
.flash.err { background: var(--red-600); }

/* ---------- Stock search ---------- */
.search-area { max-width: 900px; margin: 0 auto; padding-top: 34px; }
.search-row { display: flex; gap: 12px; align-items: stretch; }
.search-row input { flex: 1 1 auto; font-size: 16px; padding: 14px 18px; border-radius: 12px; box-shadow: var(--shadow-sm); }
.search-btn { flex: 0 0 auto; width: auto; padding: 0 30px; border-radius: 12px; font-size: 15px; box-shadow: var(--shadow-sm); }
.currency-row { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.cur-label { color: var(--stone-500); font-size: 14px; }
.currency-row .seg button { padding: 8px 15px; }
.search-meta { text-align: right; color: var(--stone-500); font-size: 12.5px; margin-top: 10px; min-height: 16px; }
.search-meta .spinner { width: 13px; height: 13px; }

.result-list { max-width: 720px; margin: 22px auto 0; display: flex; flex-direction: column; gap: 8px; }
.result-list .rl-title { font-size: 12px; color: var(--stone-500); text-transform: uppercase; letter-spacing: .6px; font-weight: 600; margin-bottom: 2px; }
.result-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; background: #fff; border: 1px solid var(--stone-200); border-radius: 12px; padding: 12px 16px; cursor: pointer; box-shadow: var(--shadow-sm); transition: border-color .1s, background .1s; }
.result-row:hover { border-color: var(--brand-400); background: var(--brand-50); }
.result-row .rl-code { font-weight: 700; color: var(--stone-900); font-family: "Geist Mono", monospace; }
.result-row .rl-design { color: var(--stone-600); font-size: 13px; margin-top: 2px; }
.result-row .rl-right { text-align: right; white-space: nowrap; }
.result-row .rl-total { font-weight: 700; color: var(--brand-700); }
.result-row .rl-total.inr { color: var(--teal-600); font-size: 12.5px; font-weight: 600; }

.detail-card { max-width: 820px; margin: 22px auto 0; background: #fff; border: 1px solid var(--stone-200); border-radius: 16px; box-shadow: var(--shadow-lg); overflow: hidden; }
.detail-card .head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--stone-200); }
.detail-card .head h2 { margin: 0; font-size: 19px; color: var(--stone-900); }
.detail-card .head .sub { margin-top: 3px; }
.detail-card .body { padding: 20px 22px; }
.back-btn { background: none; border: none; color: var(--brand-600); font-size: 13.5px; font-weight: 600; cursor: pointer; padding: 0; font-family: inherit; display: inline-flex; align-items: center; gap: 5px; }
.back-btn:hover { color: var(--brand-700); }
.detail-back { max-width: 820px; margin: 18px auto 0; }

.empty-hint { max-width: 560px; margin: 26px auto 0; text-align: center; color: var(--stone-500); font-size: 13.5px; }

@media (max-width: 640px) {
  .cost-grid { grid-template-columns: 1fr; }
  .container { padding: 16px 12px 50px; }
  .topbar { padding: 8px 12px; }
  .brand .subtitle { display: none; }
  .search-hero h1 { font-size: 21px; }
}
