:root {
  --bg: #eaf2fb;
  --surface: #ffffff;
  --surface-soft: #f3f8ff;
  --navy: #061a33;
  --ink: #0c2541;
  --muted: #647c95;
  --line: #d5e3f1;
  --blue: #1677e8;
  --blue-dark: #0755b2;
  --blue-soft: #e9f4ff;
  --cyan: #35c9e8;
  --green: #20b477;
  --amber: #f5a524;
  --red: #e85562;
  --shadow: 0 18px 44px rgba(10,42,80,.11);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { color: var(--ink); background: radial-gradient(circle at 10% 0%, rgba(45,145,255,.12), transparent 24%), linear-gradient(180deg, #f6faff, var(--bg)); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
a { color: inherit; }
.page-shell { width: min(1580px, calc(100% - 28px)); margin: 14px auto 36px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 12px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.92); box-shadow: var(--shadow); }
.eyebrow { display: block; color: var(--blue); font-size: 9px; font-weight: 900; letter-spacing: .13em; }
.page-header h1 { margin: 5px 0 0; font-size: clamp(20px,2vw,29px); }
.page-header p { margin: 6px 0 0; color: var(--muted); font-size: 11px; }
.header-actions, .toolbar, .button-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 11px; color: #37536e; background: white; text-decoration: none; font-size: 10px; font-weight: 800; cursor: pointer; }
.button:hover { color: var(--blue-dark); border-color: #a9d0f8; background: var(--blue-soft); }
.button.primary { color: white; border-color: var(--blue); background: linear-gradient(135deg,var(--blue-dark),var(--blue)); box-shadow: 0 10px 22px rgba(22,119,232,.2); }
.button.danger { color: white; border-color: var(--red); background: var(--red); }
.surface { border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); }
.filter-bar { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)) auto; gap: 10px; margin-bottom: 12px; padding: 14px; }
.field { min-width: 0; }
.field label { display: block; margin-bottom: 6px; color: #526c86; font-size: 9px; font-weight: 800; }
.field input, .field select, .field textarea { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; outline: none; color: var(--ink); background: white; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #79b7f5; box-shadow: 0 0 0 4px rgba(22,119,232,.09); }
.kpi-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 10px; margin-bottom: 12px; }
.kpi { min-width: 0; padding: 15px; }
.kpi span, .kpi small { display: block; color: var(--muted); font-size: 9px; }
.kpi strong { display: block; margin: 6px 0 4px; overflow: hidden; font-size: 22px; text-overflow: ellipsis; white-space: nowrap; }
.kpi .tone { width: 35px; height: 4px; margin-bottom: 10px; border-radius: 99px; background: var(--blue); }
.grid-2 { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.grid-main { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(320px,.75fr); gap: 12px; }
.card { min-width: 0; padding: 17px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card h2, .card h3 { margin: 0; }
.card h2 { font-size: 16px; }
.card h3 { font-size: 14px; }
.card p { color: var(--muted); font-size: 10px; line-height: 1.55; }
.chart-wrap { position: relative; height: 340px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 10px; }
th { position: sticky; top: 0; z-index: 2; padding: 10px; color: #49647f; background: #edf5fd; text-align: left; white-space: nowrap; }
td { padding: 10px; border-top: 1px solid #e3edf7; color: #304f6c; vertical-align: top; }
tbody tr:hover { background: #f5faff; }
.badge { display: inline-flex; align-items: center; gap: 5px; width: fit-content; padding: 5px 8px; border-radius: 999px; color: #526c86; background: #edf3f8; font-size: 8px; font-weight: 900; }
.badge.good { color: #0b8054; background: #e0f8ee; }
.badge.warn { color: #9b6508; background: #fff3dc; }
.badge.bad { color: #ad3040; background: #ffe9ec; }
.badge.blue { color: #0759b8; background: #e7f3ff; }
.empty { display: grid; min-height: 180px; place-items: center; padding: 24px; color: var(--muted); text-align: center; }
.empty i { display: block; margin-bottom: 10px; color: #8abcf0; font-size: 30px; }
.notice { display: flex; gap: 10px; padding: 12px; border: 1px solid #bfdbf8; border-radius: 12px; color: #31516f; background: #edf6ff; font-size: 10px; line-height: 1.5; }
.notice i { margin-top: 2px; color: var(--blue); }
.modal { width: min(620px,calc(100% - 30px)); padding: 0; border: 0; border-radius: 18px; color: var(--ink); box-shadow: 0 30px 80px rgba(4,18,38,.28); }
.modal::backdrop { background: rgba(4,18,38,.55); backdrop-filter: blur(4px); }
.modal-head { display: flex; justify-content: space-between; gap: 12px; padding: 17px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 17px; border-top: 1px solid var(--line); background: #f5f9fd; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; }
.form-grid .wide { grid-column: 1 / -1; }
.loading { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; }
.spinner { width: 18px; height: 18px; border: 2px solid #bedbf8; border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 20px; max-width: min(430px,calc(100vw - 32px)); padding: 10px 14px; border-radius: 11px; color: white; background: #0a315b; box-shadow: var(--shadow); transform: translate(-50%,18px); opacity: 0; visibility: hidden; transition: .2s; font-size: 10px; }
.toast.show { transform: translate(-50%,0); opacity: 1; visibility: visible; }
html.is-embedded .page-shell { width: calc(100% - 20px); margin: 10px auto 22px; }
html.is-embedded .page-header { display: none; }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } .filter-bar { grid-template-columns: repeat(2,minmax(0,1fr)); } .grid-main { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .page-shell { width: calc(100% - 16px); margin-top: 8px; } .page-header { align-items: flex-start; flex-direction: column; } .kpi-grid, .grid-2, .form-grid { grid-template-columns: 1fr; } .filter-bar { grid-template-columns: 1fr; } .form-grid .wide { grid-column: auto; } .chart-wrap { height: 280px; } }
