/* Modern presentation layer. The original component rules remain as a safe fallback. */
:root {
  --blue: #0284c7;
  --cyan: #06b6d4;
  --navy: #0f2942;
  --yellow: #f59e0b;
  --bg: #eef4f8;
  --card: rgba(255, 255, 255, 0.94);
  --muted: #64748b;
  --line: #dce7ef;
  --good: #16a34a;
  --danger: #dc2626;
  --shadow: 0 12px 32px rgba(15, 41, 66, 0.08);
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 0%, rgba(14, 165, 233, 0.13), transparent 30rem),
    radial-gradient(circle at 95% 14%, rgba(6, 182, 212, 0.10), transparent 24rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-rendering: optimizeLegibility;
}

.container { max-width: 1760px; padding: 14px 18px; }

.header {
  min-height: 96px;
  padding: 17px 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  background: linear-gradient(125deg, #082f49 0%, #075985 52%, #0891b2 100%);
  box-shadow: 0 20px 45px rgba(8, 47, 73, 0.2);
}

.header::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 26px 26px;
  pointer-events: none;
}

.brand, .header-right { position: relative; z-index: 2; }
.logo {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  color: #0369a1;
  box-shadow: 0 10px 25px rgba(2, 18, 32, 0.25);
}

h1 { max-width: 850px; font-size: clamp(1rem, 1.6vw, 1.3rem); }
.subtitle { max-width: 850px; margin-top: 4px; font-size: 11px; }
.header-right { top: 16px; right: 22px; line-height: 1.35; }
.header-right .period { font-size: 13px; }
.source-status { margin-top: 5px; padding: 3px 7px; }

.dashboard-menu {
  display: flex;
  gap: 4px;
  margin: 10px 0 0;
  padding: 4px;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255,255,255,.86);
  box-shadow: 0 5px 15px rgba(15,41,66,.06);
}

.dashboard-menu-btn {
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: background .18s, color .18s, box-shadow .18s;
}

.dashboard-menu-btn:hover { color: var(--blue); background: #f0f7fc; }
.dashboard-menu-btn.active {
  color: #fff;
  background: linear-gradient(135deg, #0369a1, #0891b2);
  box-shadow: 0 5px 12px rgba(3,105,161,.2);
}
.menu-icon { margin-right: 5px; font-size: 13px; }
.menu-hidden { display: none !important; }

.contract-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px 10px;
}
.field label {
  display: block;
  margin: 0 0 4px 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}
.field.required label::after { content: " *"; color: var(--danger); }
.field input, .field select {
  width: 100%;
  height: 35px;
  padding: 0 10px;
  border: 1px solid #d7e1ea;
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  font: inherit;
  font-size: 11px;
  outline: none;
}
.field input:focus, .field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(2,132,199,.12); }
.linked-parameter { display: flex; align-items: center; height: 35px; padding: 0 10px; border: 1px solid #b8d7e8; border-radius: 8px; background: #edf7fc; color: #075985; font-size: 11px; font-weight: 800; }
.linked-parameter.invalid { border-color: #f0c0c0; background: #fff2f2; color: var(--danger); }
.span-2 { grid-column: span 2; }
.contract-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 4px; }
#contractFormStatus { margin-right: auto; font-size: 11px; color: var(--muted); }
#contractFormStatus.success { color: var(--good); }
#contractFormStatus.error { color: var(--danger); }
.contract-table { min-width: 1250px; }
.contract-table th, .contract-table td { text-align: left !important; }
.contract-table-wrap { max-height: 52vh; }
.contract-edit-btn { border: 1px solid #b9d8ea; border-radius: 6px; background: #edf7fc; color: #0369a1; padding: 4px 8px; font-size: 9px; font-weight: 800; cursor: pointer; }

.toolbar {
  position: sticky;
  top: 10px;
  z-index: 10;
  margin: 8px 0;
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
}
.filter select, .search { height: 34px; font-size: 11px; }
.filter label { margin-bottom: 3px; font-size: 9px; }
.btn { height: 34px; font-size: 10px; }
.filter-note { font-size: 9px; }

.filter select, .search, .metric-select, .pager select {
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

.filter select:focus, .search:focus, .metric-select:focus, .pager select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, .14);
}

.btn { transition: transform .18s, box-shadow .18s, filter .18s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 7px 16px rgba(15, 41, 66, .12); }
.btn:focus-visible, .pager button:focus-visible {
  outline: 3px solid rgba(2, 132, 199, .24);
  outline-offset: 2px;
}

.section-title { margin: 14px 0 6px; }
.section-title h2 { font-size: 12px; letter-spacing: .07em; }
.section-title p { font-size: 9px; }

.card, .kpi {
  border-color: rgba(203, 216, 227, .82);
  border-radius: 12px;
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
}

.card:hover, .kpi:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(15, 41, 66, .11);
}

.kpis, .grid2, .grid3, .yoy { gap: 8px; }
.card { padding: 11px; }
.card h3 { margin-bottom: 8px; font-size: 10px; }
.kpi { min-height: 84px; padding: 11px 13px; }
.kpi::before { width: 5px; }
.kpi-label, .kpi-meta { font-size: 9px; }
.kpi-value { margin-top: 5px; font-size: clamp(1.05rem, 1.5vw, 1.3rem); }
.progress-card { grid-template-columns: 1fr 80px; }
.progress { height: 9px; }
.chartbox { height: 225px; }
.chartbox.large { height: 260px; }
.donut-wrap { height: 220px; }
.donut-center { font-size: 18px; }
.yoy-item { padding: 10px; }
.mini-grid { gap: 6px; }
.mini { padding: 8px 9px; }
.mini strong { font-size: 12px; }
.insights { gap: 6px; }
.insight { padding: 8px; line-height: 1.4; }

.table-wrap { max-height: 68vh; border-radius: 13px; }
.table th { top: 0; box-shadow: inset 0 -1px var(--line); }
.table td { padding: 6px; font-variant-numeric: tabular-nums; }
.table th { padding: 7px 6px; }
.table tr:nth-child(even) td { background: rgba(248, 251, 254, .58); }

.source-status { border: 1px solid rgba(255,255,255,.15); }
.errorbox { font-size: 12px; box-shadow: 0 8px 22px rgba(153, 27, 27, .08); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation-duration: .01ms !important; }
}

@media (max-width: 700px) {
  .container { padding: 10px; }
  .header { min-height: auto; padding: 20px; border-radius: 18px; }
  .toolbar { position: static; }
  .dashboard-menu { width: 100%; }
  .dashboard-menu-btn { flex: 1; padding: 0 8px; }
  .dashboard-menu { overflow-x: auto; }
  .dashboard-menu-btn { flex: 0 0 auto; }
  .contract-form { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .chartbox, .chartbox.large, .donut-wrap { height: 220px; }
  .card:hover, .kpi:hover { transform: none; }
}

@media print {
  body { background: #fff; }
  .toolbar, .footer, #detailSection { display: none !important; }
  .container { max-width: none; padding: 0; }
  .card, .kpi, .header { break-inside: avoid; box-shadow: none; }
}
.monitoring-recap-controls{display:flex;gap:8px;margin-bottom:12px;padding:5px;background:#edf4f9;border:1px solid var(--line);border-radius:10px;width:max-content;max-width:100%}
.monitoring-type{border:0;border-radius:8px;background:transparent;color:var(--muted);padding:8px 14px;font:inherit;font-size:11px;font-weight:800;text-align:left;cursor:pointer}
.monitoring-type small{display:block;margin-top:2px;font-size:9px;font-weight:600;opacity:.8}
.monitoring-type.active{background:var(--blue);color:#fff;box-shadow:0 3px 9px rgba(0,114,206,.22)}
.monitoring-view-hidden{display:none!important}
@media(max-width:700px){.monitoring-recap-controls{width:100%;flex-direction:column}.monitoring-type{width:100%}}
.trend-card-head{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}
.trend-actions{display:flex;align-items:center;gap:6px}
.trend-compare-btn{display:none;height:29px;border:1px solid #0072ce;border-radius:7px;background:#fff;color:#0072ce;padding:0 9px;font-size:9px;font-weight:800;cursor:pointer}
.trend-compare-btn.visible{display:inline-flex;align-items:center}
.trend-compare-btn.active{background:#0072ce;color:#fff}
.trend-up3-only{display:none}.trend-up3-only.visible{display:block}
.trend-compare-status{display:none;color:var(--muted);font-size:9px;margin:-5px 0 7px}.trend-compare-status.visible{display:block}
