:root {
  --cyan: #00D2FF;
  --magenta: #9D50BB;
  --ink: #222222;
  --muted: #6B7280;
  --bg: #F7F8FA;
  --surface: #FFFFFF;
  --border: #E4E7EC;
}
* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: Manrope, "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(0, 210, 255, 0.12), transparent 60%),
    radial-gradient(900px 360px at 90% 0%, rgba(157, 80, 187, 0.10), transparent 55%),
    var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 28px;
  background: rgba(255,255,255,0.96);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { display: flex; gap: 12px; align-items: center; min-width: 0; }
.logo { height: 42px; flex-shrink: 0; }
.title { font-weight: 700; font-size: 18px; }
.sub { font-size: 11px; letter-spacing: 1px; color: var(--muted); }
.client-name {
  font-weight: 600;
  text-align: right;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wrap { max-width: 1100px; margin: 0 auto; padding: 22px 20px 60px; }

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.stat-n { font-size: 22px; font-weight: 700; }
.stat-l { color: var(--muted); font-size: 12px; }

.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.filters input,
.filters select,
.filters button {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: var(--surface);
  max-width: 100%;
}
.filters input[type="search"] { flex: 1; min-width: 160px; }
.filters select { min-width: 120px; }
.filters input[type="date"] { min-width: 130px; flex: 0; }
.period-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.hint {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.btn.primary {
  border: none;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--cyan), var(--magenta));
  font-weight: 600;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 10px;
}

.tabs {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  position: sticky;
  top: 72px;
  background: rgba(247,248,250,0.96);
  padding: 8px 0;
  z-index: 4;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  color: var(--ink);
  text-decoration: none;
  padding-bottom: 6px;
  border-bottom: 2px solid transparent;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.tabs a:hover { border-bottom-color: var(--magenta); }
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 22px;
  overflow: hidden;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
h1, h2 { margin: 0 0 8px; word-break: break-word; }
.badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #EEF2F6;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  vertical-align: middle;
}
.muted { color: var(--muted); }
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px;
}
table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
.btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(135deg, var(--cyan), var(--magenta));
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}
code {
  background: #EEF2F6;
  padding: 2px 6px;
  border-radius: 6px;
  word-break: break-all;
}
.trunc-note {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #EEF2F6;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

@media (max-width: 720px) {
  .top { padding: 10px 12px; }
  .logo { height: 34px; }
  .title { font-size: 15px; }
  .client-name { font-size: 13px; max-width: 42%; }
  .wrap { padding: 14px 12px 48px; }
  .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat { padding: 10px 12px; }
  .stat-n { font-size: 18px; }
  .tabs { top: 56px; gap: 12px; }
  .panel { padding: 12px; border-radius: 12px; }
  .filters { gap: 8px; }
  .filters input[type="search"],
  .filters select,
  .filters input[type="date"],
  .filters button {
    width: 100%;
    min-width: 0;
  }
  .period-label { width: calc(50% - 4px); flex: 1 1 calc(50% - 4px); }
  .period-label input { width: 100%; }
  table { font-size: 12px; min-width: 480px; }
  th, td { padding: 8px 6px; }
}
