@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================================
   GPOSTING — tokens
   Pine ledger + gold. Display: Space Grotesk. Data: JetBrains Mono.
   ============================================================ */
:root {
  --ink:        #0B2320;
  --ink-soft:   #143C35;
  --ink-line:   #1E4F46;

  --canvas:     #ECEFEE;
  --surface:    #FFFFFF;
  --line:       #DBE3E0;
  --line-soft:  #EAEFED;

  --text:       #10201D;
  --muted:      #64756F;
  --dim:        #8A9791;

  --gold:       #C68B12;
  --gold-soft:  #FBF0D6;

  --paid:       #0D7A56;
  --paid-soft:  #DCF2E9;
  --prog:       #1B62A8;
  --prog-soft:  #DCEAF8;
  --wait:       #6B7A75;
  --wait-soft:  #E7EDEB;
  --warn:       #A8620B;
  --warn-soft:  #FBEBD8;
  --bad:        #A32218;
  --bad-soft:   #F9E3E1;

  --r:          10px;
  --r-sm:       7px;
  --shadow:     0 1px 2px rgba(11,35,32,.05), 0 8px 24px -16px rgba(11,35,32,.28);

  --display: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
  --body:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

h1, h2, h3 { font-family: var(--display); letter-spacing: -.018em; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 600; }
h2 { font-size: 1.05rem; font-weight: 600; }

.mono { font-family: var(--mono); font-size: .86em; }
.dim  { color: var(--dim); }
.wrap { word-break: break-all; }
.num  { text-align: right; }

/* ============================================================
   Auth screens
   ============================================================ */
.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -10%, #1B4F46 0%, transparent 70%),
    var(--ink);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border-radius: 14px;
  padding: 30px 28px 32px;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,.55);
}

.auth-intro { color: var(--muted); font-size: .9rem; margin: 0 0 20px; }

/* ============================================================
   Brand
   ============================================================ */
.brand { display: flex; align-items: center; gap: 11px; margin-bottom: 24px; }

.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--ink);
  color: var(--gold);
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  flex: none;
}

.brand-name {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: .1em;
  font-size: .95rem;
}
.brand-sub { font-size: .74rem; color: var(--muted); letter-spacing: .02em; }

/* ============================================================
   Shell
   ============================================================ */
.shell { display: flex; min-height: 100vh; }

.rail {
  width: 244px; flex: none;
  background: var(--ink);
  color: #D6E3DF;
  padding: 24px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rail-brand { margin-bottom: 26px; padding-left: 4px; }
.rail-brand .brand-name { color: #fff; }
.rail-brand .brand-sub  { color: #7FA098; }
.rail-brand .brand-mark { background: var(--ink-line); }

.rail-nav { display: flex; flex-direction: column; gap: 2px; }

.rail-link {
  display: block;
  padding: 9px 12px 10px;
  border-radius: var(--r-sm);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: background .14s ease;
}
.rail-link:hover { background: rgba(255,255,255,.05); }

.rail-link.is-active {
  background: rgba(255,255,255,.07);
  border-left-color: var(--gold);
}

.rail-link-title {
  display: block;
  font-family: var(--display);
  font-weight: 500;
  font-size: .92rem;
  color: #EAF2F0;
}
.rail-link-sub { display: block; font-size: .72rem; color: #7B9A93; }
.rail-link.is-active .rail-link-sub { color: #A9C4BD; }

.rail-foot { margin-top: auto; padding-top: 18px; display: grid; gap: 10px; }

.rail-alert {
  display: block;
  font-size: .76rem;
  line-height: 1.4;
  color: #FFE0A8;
  background: rgba(198,139,18,.16);
  border: 1px solid rgba(230,180,80,.3);
  border-radius: var(--r-sm);
  padding: 9px 11px;
  text-decoration: none;
}

.rail-user {
  display: flex; align-items: center; justify-content: space-between;
  font-size: .78rem; color: #8FAAA3;
  border-top: 1px solid rgba(255,255,255,.09);
  padding-top: 12px;
}
.rail-user a { color: #CFE0DC; text-decoration: none; }
.rail-user a:hover { text-decoration: underline; }

.main {
  flex: 1;
  min-width: 0;
  padding: 30px 34px 60px;
  max-width: 1180px;
}

/* ============================================================
   Page head
   ============================================================ */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 3px;
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--gold);
}

.page-sub { margin: 5px 0 0; color: var(--muted); font-size: .88rem; max-width: 62ch; }

/* ============================================================
   Stats
   ============================================================ */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 18px 15px;
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: '';
  position: absolute; inset: 0 auto 0 0;
  width: 3px; background: var(--gold);
}

.stat-label {
  display: block;
  font-size: .72rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat-value {
  display: block;
  font-family: var(--mono);
  font-size: 1.65rem;
  font-weight: 500;
  letter-spacing: -.02em;
  margin-top: 4px;
}
.stat-unit { font-size: .76rem; color: var(--dim); }

/* ============================================================
   Panels
   ============================================================ */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px 22px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 14px;
}
.panel-title { font-size: 1rem; }
.panel + .panel { margin-top: 0; }

.split { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; align-items: start; }

.empty { color: var(--muted); font-size: .9rem; margin: 6px 0; }

/* ============================================================
   Forms
   ============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 15px;
}

.field { display: block; margin-bottom: 15px; }
.form-grid .field { margin-bottom: 0; }
.field-wide { grid-column: 1 / -1; }

.field > span {
  display: block;
  font-size: .8rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}
.field .req { color: var(--bad); font-weight: 400; }

.field small { display: block; margin-top: 5px; font-size: .75rem; color: var(--muted); line-height: 1.45; }

input[type=text], input[type=email], input[type=password],
input[type=number], input[type=url], input[type=search], select {
  width: 100%;
  font: inherit;
  font-size: .92rem;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #FCFDFD;
  color: var(--text);
  transition: border-color .14s ease, box-shadow .14s ease;
}
input.mono { font-family: var(--mono); font-size: .84rem; }

input:focus, select:focus {
  outline: none;
  border-color: var(--ink-soft);
  box-shadow: 0 0 0 3px rgba(20,60,53,.12);
}

select { appearance: none; background-image: none; cursor: pointer; }

.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 20px; }

.row-actions {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.filter-bar {
  display: flex; flex-wrap: wrap; gap: 9px; align-items: center;
  margin-bottom: 16px;
}
.filter-bar input[type=search] { flex: 1 1 240px; }
.filter-bar select { flex: 0 1 190px; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 7px;
  font-family: var(--display);
  font-size: .88rem;
  font-weight: 500;
  padding: 9px 17px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}

.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-soft); }
.btn-primary:disabled { background: #A9B6B2; cursor: not-allowed; }

.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--ink-soft); background: #F4F7F6; }

.btn-danger { background: transparent; border-color: #E3C4C1; color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }

.btn-sm { padding: 6px 13px; font-size: .82rem; }
.btn-block { width: 100%; margin-top: 6px; }
.btn.is-copied { background: var(--paid); border-color: var(--paid); color: #fff; }

.link-plain { color: var(--ink-soft); font-size: .86rem; font-weight: 500; text-decoration: none; border-bottom: 1px solid rgba(20,60,53,.25); }
.link-plain:hover { border-bottom-color: var(--ink-soft); }

/* ============================================================
   Notes
   ============================================================ */
.note {
  border-radius: var(--r-sm);
  padding: 11px 14px;
  font-size: .87rem;
  margin-bottom: 16px;
  border: 1px solid;
  line-height: 1.5;
}
.note p { margin: 6px 0 0; }
.note code { font-family: var(--mono); font-size: .85em; background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; }

.note-ok   { background: var(--paid-soft); border-color: #B4DFCE; color: #0A4F38; }
.note-bad  { background: var(--bad-soft);  border-color: #EBC3BF; color: #7E1A12; }
.note-warn { background: var(--warn-soft); border-color: #EAC996; color: #7A470A; }

/* ============================================================
   Status pills
   ============================================================ */
.pill {
  display: inline-block;
  font-family: var(--display);
  font-size: .74rem;
  font-weight: 500;
  letter-spacing: .01em;
  padding: 4px 10px;
  border-radius: 100px;
  white-space: nowrap;
}
.pill-paid     { background: var(--paid-soft); color: var(--paid); }
.pill-progress { background: var(--prog-soft); color: var(--prog); }
.pill-wait     { background: var(--wait-soft); color: var(--wait); }
.pill-warn     { background: var(--warn-soft); color: var(--warn); }
.pill-dead     { background: #E9EBEA; color: #6C7874; }

/* ============================================================
   Signature: amount block
   ============================================================ */
.amount-block {
  border-top: 2px solid var(--gold);
  background: linear-gradient(180deg, var(--gold-soft) 0%, rgba(251,240,214,0) 100%);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  padding: 16px 18px 20px;
  margin-bottom: 20px;
}

.amount-label {
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #8A6614;
}

.amount-figure { display: flex; align-items: baseline; gap: 9px; margin-top: 3px; }
.amount-num {
  font-family: var(--mono);
  font-size: 2.5rem;
  font-weight: 500;
  letter-spacing: -.035em;
  line-height: 1.05;
}
.amount-cur { font-family: var(--display); font-size: 1rem; font-weight: 600; color: var(--muted); }
.amount-crypto { margin-top: 6px; font-family: var(--mono); font-size: .84rem; color: #6D5312; }
.amount-recv { color: var(--paid); }

/* ============================================================
   Payment link box
   ============================================================ */
.link-box {
  border: 1px dashed var(--line);
  border-radius: var(--r-sm);
  padding: 14px 15px;
  background: #FAFCFB;
  margin-bottom: 20px;
}
.link-box-label {
  display: block;
  font-size: .74rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.link-box-row { display: flex; gap: 8px; align-items: center; }
.link-input {
  flex: 1;
  font-family: var(--mono);
  font-size: .8rem;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
}
.link-box-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 11px; }

/* ============================================================
   Detail list
   ============================================================ */
.detail-list { margin: 0; display: grid; gap: 0; }
.detail-list > div {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}
.detail-list > div:last-child { border-bottom: none; }
.detail-list dt { font-size: .82rem; color: var(--muted); }
.detail-list dd { margin: 0; font-size: .88rem; }

/* ============================================================
   Ledger table
   ============================================================ */
.table-wrap { overflow-x: auto; margin: 0 -4px; }

.ledger { width: 100%; border-collapse: collapse; font-size: .87rem; }

.ledger th {
  text-align: left;
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.ledger th.num { text-align: right; }

.ledger td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.ledger tbody tr:last-child td { border-bottom: none; }
.ledger tbody tr:hover { background: #F7FAF9; }

.cell-client span { display: block; }
.cell-client small { display: block; color: var(--dim); font-size: .78rem; }

/* ============================================================
   Timeline
   ============================================================ */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline-item {
  display: flex; gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
  width: 9px; height: 9px; border-radius: 50%;
  margin-top: 7px; flex: none;
  background: currentColor;
}
.timeline-head { display: flex; align-items: center; gap: 8px; font-size: .89rem; }
.timeline-meta { font-size: .77rem; color: var(--dim); }

.tag { font-size: .68rem; padding: 2px 7px; border-radius: 4px; }
.tag-bad { background: var(--bad-soft); color: var(--bad); }

/* ============================================================
   Pager
   ============================================================ */
.pager { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.pager-info { font-size: .82rem; color: var(--muted); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .rail {
    width: 100%;
    padding: 16px 16px 12px;
  }
  .rail-brand { margin-bottom: 14px; }
  .rail-nav { flex-direction: row; overflow-x: auto; gap: 4px; }
  .rail-link { border-left: none; border-bottom: 2px solid transparent; padding: 7px 11px; }
  .rail-link.is-active { border-left-color: transparent; border-bottom-color: var(--gold); }
  .rail-link-sub { display: none; }
  .rail-foot { margin-top: 12px; }
  .main { padding: 20px 16px 48px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .amount-num { font-size: 2rem; }
  .detail-list > div { grid-template-columns: 1fr; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
