@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Spline+Sans+Mono:wght@400;500&family=Noto+Sans+Gujarati:wght@400;500;600;700&display=swap');

* { box-sizing: border-box; }
/* The `hidden` attribute must win over component display rules (e.g. a
   .dialog-backdrop is display:grid; without this its hidden state would still
   paint). Toggle visibility with el.hidden, not inline display. */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 14.5px;
  color: var(--ink);
  background: var(--ground);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--emerald); text-decoration: none; }
a:hover { text-decoration: underline; }
:lang(gu), .gu { font-family: var(--font-gu); }
.mono { font-family: var(--font-mono); }

/* ------------------------------------------------------------------ shell */
.app-shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.main-col { min-width: 0; display: flex; flex-direction: column; }

/* sidebar */
.sidebar {
  background: var(--sidebar-field);
  color: rgba(255, 255, 255, .92);
  position: sticky; top: 0; align-self: start;
  height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
  padding: 18px 14px 14px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 6px 16px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--brand-squircle);
  display: grid; place-items: center; flex: none;
}
.brand-coin {
  width: 30px; height: 30px; border-radius: 50%;
  background: #fff center/cover;
  box-shadow: 0 0 0 2.5px rgba(232, 184, 90, .95);
}
.brand-mark.small { width: 32px; height: 32px; border-radius: 9px; }
.brand-mark.small .brand-coin { width: 23px; height: 23px; }
.brand-name { font-weight: 800; font-size: 19px; letter-spacing: -.02em; line-height: 1; }
.brand-name span { color: var(--gold-soft); }
.brand-sub { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: rgba(255, 255, 255, .55); margin-top: 3px; }

.nav-group { margin-top: 14px; }
.nav-group-title { font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: rgba(255, 255, 255, .5); padding: 0 8px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-nav);
  color: rgba(255, 255, 255, .82); font-size: 13.5px; font-weight: 500;
  border: 1px solid transparent; margin-bottom: 2px;
  transition: background .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .09); text-decoration: none; color: #fff; }
.nav-item.active { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .3); color: #fff; }
.nav-item.disabled { opacity: .4; pointer-events: none; }
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-badge {
  margin-left: auto; font-size: 10px; font-weight: 700;
  background: var(--gold); color: var(--gold-ink);
  border-radius: 20px; padding: 1px 7px; line-height: 1.5;
}
.nav-badge.soft { background: rgba(255, 255, 255, .16); color: #fff; }
.sidebar-footer { margin-top: auto; padding: 14px 8px 4px; font-size: 10.5px; line-height: 1.5; color: rgba(255, 255, 255, .45); }

/* header */
.app-header {
  height: 58px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
}
.page-title { font-family: var(--font-sans); font-weight: 700; font-size: 20px; letter-spacing: -.01em; }
.header-spacer { flex: 1; }
.search-input {
  flex: 0 1 280px; min-width: 160px; height: 36px; border: 1px solid var(--line);
  border-radius: var(--r-input); padding: 0 12px; font-size: 13.5px; font-family: var(--font-sans);
  background: var(--ground);
}
.search-input:focus { outline: none; box-shadow: var(--focus-ring); border-color: var(--accent-400); }

.seg-lang { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg-lang a { padding: 5px 11px; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--card); }
.seg-lang a.active { background: var(--accent-100); color: var(--forest); }
.seg-lang a:hover { text-decoration: none; }

.icon-btn { position: relative; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.icon-btn .dot { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-500); }
.role-select { height: 34px; border: 1px solid var(--line); border-radius: 9px; padding: 0 9px; font-size: 13px; font-family: var(--font-sans); background: var(--card); color: var(--ink); }
.user-chip { display: flex; align-items: center; gap: 9px; }
.avatar { width: 32px; height: 32px; border-radius: 8px; background: var(--accent-200); color: var(--forest); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.user-chip .u-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-chip .u-role { font-size: 11px; color: var(--ink-2); }

/* page body */
.page { padding: 22px; animation: enter .28s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.page-head .sub { color: var(--ink-2); font-size: 13.5px; margin-top: 3px; }
.head-actions { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-card); padding: 18px; }
.card.tight { padding: 14px; }
.card-title { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-2); font-weight: 700; margin: 0 0 12px; }
.grid { display: grid; gap: 16px; }
.blueprint { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow-card); }

/* steel / dark field cards */
.field-card { background: var(--field); color: rgba(255, 255, 255, .95); border-radius: var(--r-card); padding: 18px; box-shadow: var(--shadow-card); }
.field-card .card-title { color: rgba(255, 255, 255, .6); }
.kicker { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--gold-soft); font-weight: 700; }

/* KPI */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi .label { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.kpi .value { font-size: 44px; font-weight: 800; letter-spacing: -.03em; line-height: 1.05; margin-top: 6px; }
.kpi .meta { font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.kpi.steel { background: var(--field); color: #fff; border: none; }
.kpi.steel .label, .kpi.steel .meta { color: rgba(255, 255, 255, .7); }

/* ------------------------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 42px; padding: 0 16px; border-radius: var(--r-btn); font-family: var(--font-sans); font-size: 14px; font-weight: 700; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; white-space: nowrap; transition: background .15s; }
.btn:hover { text-decoration: none; background: var(--accent-100); }
.btn svg { width: 17px; height: 17px; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn-gold { background: var(--gold); color: var(--gold-ink); border: none; box-shadow: var(--gold-shadow); position: relative; }
.btn-gold::after { content: ''; position: absolute; inset: 0 0 auto 0; height: 50%; border-radius: var(--r-btn) var(--r-btn) 0 0; background: linear-gradient(rgba(255,255,255,.45), transparent); pointer-events: none; }
.btn-gold:hover { background: var(--gold); filter: brightness(1.03); }
.btn-primary { background: var(--emerald); color: #fff; border: none; }
.btn-primary:hover { background: var(--deep); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--emerald); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--card); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data thead th { background: var(--thead); text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); font-weight: 700; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover { background: color-mix(in srgb, var(--emerald) 6%, white); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.asset-id { font-family: var(--font-mono); font-weight: 600; white-space: nowrap; }

/* ------------------------------------------------------------------ tags */
.tag { display: inline-flex; align-items: center; font-size: 11px; font-weight: 700; border-radius: var(--r-tag); padding: 3px 8px; line-height: 1.4; }
.tag.accent { background: var(--accent-100); color: var(--forest); }
.tag.neutral { background: var(--line); color: var(--ink-2); }
.tag.outline { background: transparent; border: 1px solid var(--emerald); color: var(--emerald); }
.tag.solid { background: var(--forest); color: #fff; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.amber { background: var(--amber-bg); color: var(--amber); }
.tag.slate { background: var(--slate-bg); color: var(--slate); }

/* ------------------------------------------------------------------ forms */
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field label .req { color: var(--amber); }
.field .span2 { grid-column: span 2; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; height: 42px; border: 1px solid var(--line); border-radius: var(--r-input);
  padding: 0 12px; font-size: 14px; font-family: var(--font-sans); background: var(--card); color: var(--ink);
}
textarea { height: auto; padding: 10px 12px; min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: var(--focus-ring); border-color: var(--accent-400); }
.field.error input, .field.error select, .field.error textarea { border-color: var(--amber); }
.field .msg { font-size: 11.5px; color: var(--accent-800); margin-top: 4px; }
.field .msg.err { color: var(--amber); }
.error-banner { background: var(--accent-100); border: 1px solid var(--accent-300); color: var(--accent-800); border-radius: var(--r-input); padding: 12px 14px; font-size: 13px; margin-bottom: 14px; }
.dropzone { border: 1.5px dashed var(--accent-300); border-radius: var(--r-input); padding: 22px; text-align: center; color: var(--ink-2); font-size: 13px; cursor: pointer; }

/* segmented filter */
.segmented { display: inline-flex; background: var(--ground); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented a { padding: 6px 12px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); border-radius: 8px; }
.segmented a.active { background: var(--card); color: var(--forest); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.segmented a:hover { text-decoration: none; }

/* progress bars / meters */
.meter { height: 8px; border-radius: 20px; background: var(--accent-100); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--emerald); border-radius: 20px; }
.meter.full > i { background: var(--accent-900); }
.steps { display: flex; gap: 3px; }
.steps > i { flex: 1; height: 3px; border-radius: 3px; background: var(--line); }
.steps > i.on { background: var(--emerald); }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding-bottom: 14px; position: relative; }
.timeline .tl-date { font-size: 12px; color: var(--ink-2); }
.timeline .tl-body { border-left: 2px solid var(--line); padding-left: 14px; position: relative; }
.timeline .tl-body::before { content: ''; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; background: var(--emerald); }

/* AI panel */
.ai-panel { background: var(--field); color: #fff; border-radius: var(--r-card); padding: 20px; box-shadow: var(--shadow-card); }
.ai-panel h2 { margin: 0 0 4px; font-size: 18px; font-weight: 800; }
.ai-input { display: flex; gap: 10px; margin: 14px 0; }
.ai-input input { flex: 1; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); color: #fff; }
.ai-input input::placeholder { color: rgba(255,255,255,.6); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font-size: 12px; font-weight: 600; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); color: #fff; border-radius: 20px; padding: 6px 12px; cursor: pointer; }
.chip:hover { background: rgba(255,255,255,.2); }
.ai-answer { background: rgba(255,255,255,.08); border-radius: 12px; padding: 16px; margin-top: 14px; }
.ai-facts { display: flex; gap: 22px; margin: 12px 0; }
.ai-facts .f-label { font-size: 11px; color: rgba(255,255,255,.6); text-transform: uppercase; letter-spacing: .06em; }
.ai-facts .f-value { font-size: 22px; font-weight: 800; font-family: var(--font-mono); }
.ai-sources { font-size: 11.5px; color: rgba(255,255,255,.6); }

/* toasts */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 60; }
.toast { background: var(--field); color: #fff; border-radius: 12px; padding: 12px 16px; font-size: 13px; box-shadow: var(--shadow-elevated); display: flex; align-items: center; gap: 9px; animation: slidein .24s ease-out; }
@keyframes slidein { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

/* dialog */
.dialog-backdrop { position: fixed; inset: 0; background: rgba(8, 62, 48, .32); display: grid; place-items: center; z-index: 70; }
.dialog { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow-elevated); width: 460px; max-width: calc(100vw - 32px); padding: 22px; }
.dialog h3 { margin: 0 0 12px; font-size: 18px; font-weight: 800; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }

/* utility */
.row { display: flex; gap: 16px; align-items: flex-start; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.muted { color: var(--ink-2); }
.stack > * + * { margin-top: 14px; }
.count-pill { font-size: 12px; color: var(--ink-2); background: var(--ground); border-radius: 20px; padding: 4px 11px; font-weight: 600; }
hr.sep { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
