:root {
  --bg: #f6f7f8;
  --panel: #ffffff;
  --text: #18202a;
  --muted: #667085;
  --line: #d9dee6;
  --nav: #16202f;
  --nav-soft: #223149;
  --accent: #0f766e;
  --accent-dark: #0b5f58;
  --warning: #a15c08;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
code { display: inline-block; max-width: 100%; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; background: #f9fafb; overflow-wrap: anywhere; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 14px; }
th { color: #475467; font-size: 12px; text-transform: uppercase; letter-spacing: 0; background: #fbfcfd; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 10px 11px; font: inherit; background: #fff; }
label { display: grid; gap: 6px; color: #344054; font-size: 13px; font-weight: 650; }
pre { white-space: pre-wrap; background: #f6f7f8; border: 1px solid var(--line); padding: 10px; border-radius: 6px; font-size: 13px; }

.app-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--nav); color: #fff; padding: 20px 16px; display: flex; flex-direction: column; gap: 24px; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; background: var(--accent); color: #fff; border-radius: 8px; font-weight: 800; }
.brand span, .sidebar-user small { display: block; color: #b8c0ce; font-size: 12px; margin-top: 2px; }
.nav { display: grid; gap: 4px; }
.nav a { color: #dbe3ef; padding: 10px 12px; border-radius: 6px; }
.nav a.active, .nav a:hover { background: var(--nav-soft); color: #fff; }
.sidebar-user { margin-top: auto; border-top: 1px solid rgba(255,255,255,.14); padding-top: 16px; }
.link-button { border: 0; padding: 0; margin-top: 8px; background: transparent; color: #b8c0ce; cursor: pointer; }

.content { min-width: 0; padding: 28px; }
.page-header { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin-bottom: 22px; }
.page-header h1 { margin: 2px 0 0; font-size: 28px; letter-spacing: 0; }
.header-actions { display: flex; align-items: end; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.eyebrow { margin: 0; color: var(--muted); font-size: 12px; text-transform: uppercase; font-weight: 800; letter-spacing: 0; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text); cursor: pointer; font-weight: 700; white-space: nowrap; }
.button.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
.button.primary:hover { background: var(--accent-dark); }

.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric-card, .panel, .asset-card, .login-panel, .empty-state { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.metric-card { padding: 16px; }
.metric-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 750; text-transform: uppercase; }
.metric-card strong { display: block; margin: 8px 0 4px; font-size: 26px; }
.metric-card small, small, .muted { color: var(--muted); }
.panel { padding: 16px; overflow-x: auto; }
.panel-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.panel-title h2, .panel h2 { margin: 0; font-size: 18px; }
.status { display: inline-flex; padding: 3px 8px; border-radius: 999px; background: #eef8f6; color: #0f766e; font-size: 12px; font-weight: 800; }
.split { display: grid; grid-template-columns: 340px 1fr; gap: 16px; align-items: start; }
.wide-panel { min-width: 0; }
.stack { display: grid; gap: 12px; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { width: auto; min-width: 160px; }
.settlement-run + .settlement-run { margin-top: 24px; }
.copy-row { padding: 9px 0; border-bottom: 1px solid var(--line); }
.store-filter { min-width: 240px; }
.store-row { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text); }
.store-row.active, .store-row:hover { border-color: var(--accent); background: #eef8f6; }
.setup-grid { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 12px; }
.field-box { border: 1px solid var(--line); border-radius: 6px; padding: 10px; display: grid; gap: 8px; }
.field-box legend { color: #344054; font-weight: 750; padding: 0 4px; }
.check-row { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 8px; font-weight: 500; }
.check-row input { width: auto; }
.check-list { margin: 0; padding-left: 20px; color: #344054; }
.check-list li + li { margin-top: 8px; }

.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.asset-card { overflow: hidden; display: grid; grid-template-rows: 160px 1fr; }
.asset-thumb { display: grid; place-items: center; background: #e9eef3; color: #475467; font-weight: 800; }
.asset-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.asset-card > div:not(.asset-thumb), .asset-body { padding: 14px; display: grid; gap: 10px; align-content: start; }
.asset-card h3 { margin: 0; font-size: 17px; }
.asset-card p { margin: 0; color: #475467; }
.asset-meta { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; }

.login-shell, .center-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-panel { width: min(430px, 100%); padding: 28px; }
.login-brand { margin-bottom: 18px; }
.login-panel h1, .empty-state h1 { margin: 0 0 18px; }
.alert { border: 1px solid #f2c94c; background: #fff8e1; color: var(--warning); padding: 10px 12px; border-radius: 6px; margin-bottom: 14px; }
.empty-state { width: min(560px, 100%); padding: 28px; text-align: center; }

@media (max-width: 920px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .two-column { grid-template-columns: 1fr; }
  .page-header { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 560px) {
  .content { padding: 18px; }
  .metric-grid { grid-template-columns: 1fr; }
  th, td { font-size: 13px; padding: 10px 8px; }
}
