﻿:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.08);
  --blue: #0071e3;
  --green: #2f8f6b;
  --amber: #b7791f;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }
html { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
body { margin: 0; min-height: 100vh; }
button, input { font: inherit; }
a { color: inherit; text-decoration: none; }

.app-shell { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding: 24px 0 96px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: #111; color: #fff; font-weight: 700; }
.eyebrow { margin: 0 0 4px; font-size: 12px; color: var(--muted); }
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
.ghost-link, .primary-link, .primary-btn { border: 0; border-radius: 999px; padding: 10px 16px; background: var(--blue); color: #fff; cursor: pointer; white-space: nowrap; }
.ghost-link { background: #fff; color: var(--blue); border: 1px solid var(--line); }

.workspace { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 18px; align-items: stretch; }
.upload-panel, .summary-panel, .report-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.upload-panel, .summary-panel { padding: 22px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.panel-head.compact { align-items: center; }
.status-pill { display: inline-flex; align-items: center; min-height: 30px; padding: 0 12px; border-radius: 999px; background: #eef4ff; color: var(--blue); font-size: 13px; }

.dropzone { min-height: 190px; display: grid; place-items: center; text-align: center; gap: 8px; padding: 24px; border: 1.5px dashed rgba(0, 113, 227, 0.28); border-radius: 8px; background: linear-gradient(180deg, #fff, #f7fbff); cursor: pointer; }
.dropzone input { position: absolute; opacity: 0; pointer-events: none; }
.upload-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--blue); font-size: 24px; }
.dropzone small, .file-card small, .kpi-grid em { color: var(--muted); font-style: normal; }
.file-card { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px; border-radius: 8px; background: #fff; border: 1px solid var(--line); }
.file-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); }
.rule-list { display: grid; gap: 8px; margin-top: 16px; color: #333; }
.rule-list div { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.rule-list span { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #f0f0f0; color: var(--muted); font-size: 12px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.kpi-grid article { min-height: 108px; padding: 14px; border-radius: 8px; background: var(--surface-strong); border: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; }
.kpi-grid span { color: var(--muted); font-size: 13px; }
.kpi-grid strong { font-size: 24px; }
.chart-wrap { margin-top: 16px; display: grid; gap: 12px; padding: 16px; border-radius: 8px; background: #fff; border: 1px solid var(--line); }
.chart-row { display: grid; grid-template-columns: 64px 1fr 54px; align-items: center; gap: 10px; font-size: 13px; }
.chart-row div { height: 9px; border-radius: 999px; background: #ececec; overflow: hidden; }
.chart-row i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--green)); }
.chart-row b { text-align: right; }

.report-panel { margin-top: 18px; padding: 18px; }
.tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; }
.tabs button { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 999px; padding: 9px 14px; cursor: pointer; white-space: nowrap; }
.tabs button.active { color: #fff; background: #111; }
.table-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0 16px; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 740px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; background: #fbfbfd; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }

.mobile-actions { display: none; }

@media (max-width: 820px) {
  .app-shell { width: 100%; padding: 14px 14px 86px; }
  .topbar { position: sticky; top: 0; z-index: 4; margin: -14px -14px 14px; padding: calc(12px + env(safe-area-inset-top)) 14px 12px; background: rgba(245,245,247,.86); backdrop-filter: blur(20px); border-bottom: 1px solid var(--line); }
  .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
  h1 { font-size: 22px; }
  h2 { font-size: 18px; }
  .ghost-link { display: none; }
  .workspace { grid-template-columns: 1fr; gap: 12px; }
  .upload-panel, .summary-panel, .report-panel { border-radius: 8px; box-shadow: none; }
  .upload-panel, .summary-panel { padding: 16px; }
  .dropzone { min-height: 154px; }
  .panel-head { align-items: center; }
  .primary-btn { padding: 9px 13px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi-grid article { min-height: 96px; }
  .kpi-grid strong { font-size: 21px; }
  .chart-row { grid-template-columns: 56px 1fr 48px; }
  .report-panel { margin-top: 12px; padding: 14px; }
  .table-toolbar { align-items: flex-start; }
  .primary-link { display: none; }
  table { min-width: 640px; }
  th, td { padding: 12px; font-size: 13px; }
  .mobile-actions { position: fixed; left: 14px; right: 14px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 5; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .mobile-actions button, .mobile-actions a { min-height: 48px; border: 0; border-radius: 999px; display: grid; place-items: center; background: #111; color: #fff; font-weight: 600; }
  .mobile-actions a { background: var(--blue); }
}
