:root {
  --ink: #121718;
  --muted: #687273;
  --paper: #f2f0e9;
  --surface: #fbfaf6;
  --line: #d8d8d0;
  --acid: #c7f36b;
  --deep-green: #173e34;
  --amber: #f0a94d;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.site-shell { min-height: 100vh; background: linear-gradient(rgba(18,23,24,.032) 1px, transparent 1px), linear-gradient(90deg, rgba(18,23,24,.032) 1px, transparent 1px), var(--paper); background-size: 32px 32px; }
.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(22px, 5vw, 76px); border-bottom: 1px solid rgba(18,23,24,.18); background: rgba(242,240,233,.9); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: var(--acid); font: 700 13px/1 ui-monospace, monospace; letter-spacing: -.04em; }
.brand strong { display: block; font-size: 16px; letter-spacing: .04em; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font: 600 8px/1 ui-monospace, monospace; letter-spacing: .13em; }
.topbar-actions { display: flex; align-items: center; gap: 20px; }
.agent-state { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.agent-state i, .status-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(240,169,77,.15); }
.device-account { border-bottom: 1px solid var(--ink); padding: 6px 0; font-size: 12px; font-weight: 700; }

.hero { padding: clamp(58px, 8vw, 112px) clamp(22px, 7vw, 110px) 56px; max-width: 1600px; margin: 0 auto; }
.eyebrow, .section-index, .privacy-label { color: var(--deep-green); font: 700 10px/1.2 ui-monospace, monospace; letter-spacing: .15em; text-transform: uppercase; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .55fr); gap: clamp(36px, 8vw, 130px); align-items: end; margin-top: 23px; }
.hero h1 { margin: 0; max-width: 920px; font-size: clamp(44px, 6.3vw, 94px); line-height: .98; letter-spacing: -.065em; font-weight: 620; }
.hero-copy { max-width: 760px; margin: 32px 0 0; color: #4e5959; font-size: clamp(15px, 1.35vw, 19px); line-height: 1.8; }
.privacy-card { border-top: 2px solid var(--ink); padding-top: 18px; }
.privacy-card strong { display: block; margin-top: 27px; font-size: 26px; letter-spacing: -.04em; }
.privacy-card p { margin: 10px 0 24px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.boundary-line { display: flex; align-items: center; gap: 9px; font-size: 11px; font-weight: 650; }
.boundary-line span { width: 24px; height: 1px; background: var(--deep-green); }

.workspace { max-width: 1440px; margin: 0 auto; padding: 52px clamp(22px, 5vw, 76px) 90px; background: var(--surface); border-top: 1px solid var(--line); }
.workspace-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; }
.workspace h2 { margin: 10px 0 0; font-size: clamp(30px, 4vw, 54px); letter-spacing: -.055em; line-height: 1; }
.summary-strip { display: flex; gap: 26px; color: var(--muted); font-size: 11px; }
.summary-strip span { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.summary-strip b { color: var(--ink); font: 700 18px/1 ui-monospace, monospace; }

.add-contract { margin-top: 42px; padding: 24px; background: var(--deep-green); color: white; }
.add-contract label { display: block; margin-bottom: 10px; color: rgba(255,255,255,.68); font: 650 10px/1 ui-monospace, monospace; letter-spacing: .12em; text-transform: uppercase; }
.add-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px; }
.add-row input { min-width: 0; border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.08); color: white; padding: 15px 17px; outline: none; font-family: ui-monospace, monospace; }
.add-row input::placeholder { color: rgba(255,255,255,.42); }
.add-row input:focus { border-color: var(--acid); box-shadow: 0 0 0 3px rgba(199,243,107,.12); }
.add-row button { border: 0; padding: 0 22px; min-height: 52px; background: var(--acid); color: #152018; font-weight: 750; cursor: pointer; }
.add-row button:hover { background: #d4ff7d; }
.add-row button:disabled { cursor: wait; opacity: .7; }
.add-contract p { margin: 11px 0 0; color: rgba(255,255,255,.55); font-size: 11px; }
.add-contract .form-message { margin-top: 13px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.16); color: white; }
.add-contract .form-message.success { color: var(--acid); }
.add-contract .form-message.error { color: #ffc27d; }

.watchlist-table { margin-top: 28px; border-top: 1px solid var(--ink); }
.table-head, .contract-row { display: grid; grid-template-columns: 2fr .75fr 1.15fr 1fr; gap: 18px; align-items: center; }
.table-head { min-height: 43px; color: var(--muted); border-bottom: 1px solid var(--line); font: 650 9px/1 ui-monospace, monospace; letter-spacing: .12em; text-transform: uppercase; }
.contract-row { min-height: 94px; border-bottom: 1px solid var(--line); transition: background .18s ease; }
.contract-row:hover { background: #f4f6ed; }
.contract-name { display: flex; align-items: center; gap: 17px; }
.row-number { color: #98a09d; font: 600 10px/1 ui-monospace, monospace; }
.contract-name strong { display: block; font: 700 17px/1.2 ui-monospace, monospace; letter-spacing: -.02em; }
.contract-name small { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; }
.period-pill { border: 1px solid var(--line); border-radius: 99px; padding: 6px 10px; font-size: 11px; }
.status-pill { display: inline-flex; align-items: center; gap: 9px; font-size: 11px; font-weight: 620; }
.status-pill.ready i { background: #69a52e; box-shadow: 0 0 0 4px rgba(105,165,46,.14); }
.status-pill.syncing i { background: #4f8aef; box-shadow: 0 0 0 4px rgba(79,138,239,.14); }
.status-pill.error i { background: #d65345; box-shadow: 0 0 0 4px rgba(214,83,69,.14); }
.row-actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.row-actions button { border: 1px solid var(--line); background: transparent; padding: 9px 12px; font-size: 11px; cursor: pointer; }
.row-actions button:not(:disabled):hover { border-color: var(--ink); background: var(--ink); color: white; }
.row-actions button:disabled { color: #8c9492; cursor: not-allowed; }
.row-actions .remove-button:hover { border-color: #9d382e; background: #9d382e; }
.empty-watchlist { padding: 52px 0; border-bottom: 1px solid var(--line); text-align: center; }
.empty-watchlist strong { font-size: 18px; }
.empty-watchlist p { max-width: 520px; margin: 9px auto 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.preview-note { margin: 16px 0 0; color: var(--muted); font-size: 11px; text-align: right; }

@media (max-width: 820px) {
  .agent-state { display: none; }
  .hero-grid { grid-template-columns: 1fr; }
  .privacy-card { max-width: 520px; }
  .workspace-heading { align-items: start; flex-direction: column; }
  .summary-strip { width: 100%; overflow-x: auto; padding-bottom: 4px; }
  .table-head { display: none; }
  .contract-row { grid-template-columns: 1fr auto; gap: 16px; padding: 20px 0; }
  .contract-row > :nth-child(2) { display: none; }
  .contract-row > :nth-child(3) { grid-column: 1; }
  .row-actions { grid-column: 2; grid-row: 1 / span 2; }
}

@media (max-width: 560px) {
  .topbar { height: 70px; }
  .brand small { display: none; }
  .device-account { font-size: 11px; }
  .hero { padding-top: 54px; }
  .hero h1 { font-size: 44px; }
  .add-contract { padding: 18px; }
  .add-row { grid-template-columns: 1fr; }
  .add-row button { width: 100%; }
  .row-actions { align-items: end; flex-direction: column; }
  .row-actions button:first-child { display: none; }
  .preview-note { text-align: left; }
}

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