:root {
    color-scheme: light;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    --nav: #111e34;
    --canvas: #f2f5fa;
    --white: #fff;
    --ink: #14233a;
    --muted: #52637b;
    --line: #dfe7f2;
    --accent: #4456d8;
    --radius: 15px;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; background: var(--canvas); color: var(--ink); line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, p { margin: 0; }
h2 { font-size: 1.05rem; line-height: 1.28; letter-spacing: -.017em; }
input, select, button { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #777df1; outline-offset: 3px; }
.skip { position: absolute; z-index: 5; left: 8px; padding: .6rem; background: var(--white); transform: translateY(-110%); }
.skip:focus { transform: none; }

.sidebar {
    width: 225px; position: fixed; inset: 0 auto 0 0; z-index: 2; display: flex; flex-direction: column;
    padding: 1.6rem 1rem 1rem; background: var(--nav); color: var(--white);
}
.brand { display: flex; align-items: center; gap: .7rem; margin: 0 .35rem 1.9rem; color: var(--white); font-size: 1.1rem; font-weight: 750; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-flex; flex: 0 0 38px; height: 38px; justify-content: center; align-items: end; gap: 3px; padding-bottom: 9px; border-radius: 10px; background: linear-gradient(145deg,#8190ff,#4658dc); }
.brand-mark i { background: #fff; height: 9px; width: 4px; border-radius: 2px; }
.brand-mark i:nth-child(2) { height: 15px; }
.brand-mark i:nth-child(3) { height: 20px; }
.main-nav { display: grid; gap: 1rem; min-height: 0; overflow-y: auto; padding: .2rem .18rem .5rem; margin: -.2rem -.18rem .55rem; scrollbar-color: #586d8a transparent; scrollbar-width: thin; }
.main-nav[hidden], .nav-toggle[hidden] { display: none; }
.nav-group { display: grid; gap: .16rem; }
.nav-label { color: #adbcd6; font-size: .72rem; padding-inline: .75rem; font-weight: 700; letter-spacing: .035em; }
.main-nav a { color: #dbe4f4; display: block; padding: .42rem .75rem; border-radius: 8px; font-size: .85rem; font-weight: 620; }
.nav-toggle.button { color: #dbe4f4; background: transparent; border-color: #40506b; min-height: 35px; }
.main-nav a:hover { background: #253a57; text-decoration: none; }
.main-nav a[aria-current] { background: #344680; color: white; box-shadow: inset 3px 0 0 #a6b1ff; }
.logout { margin-top: auto; border-top: 1px solid #354761; padding-top: .8rem; }
.logout .button { color: #dbe4f4; width: 100%; background: transparent; border-color: #40506b; }
.logout .button:hover { background: #283b55; }

.workspace { margin-left: 225px; }
.topbar { min-height: 62px; border-bottom: 1px solid var(--line); background: var(--white); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .6rem; padding: .6rem 2rem; }
.layout-source { display: contents; }
.updated, .status { font-size: .875rem; color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: .45rem; color: var(--ink); font-weight: 650; }
.status::before { content: ""; width: .5rem; height: .5rem; background: #a45c11; border-radius: 100%; }
.status.ok::before { background: #14765b; }
main { max-width: 1510px; margin-inline: auto; padding: 1.6rem 2rem 2rem; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.page-heading h1 { font-size: clamp(1.65rem, 3.2vw, 2.36rem); letter-spacing: -.052em; line-height: 1.1; }
.eyebrow { color: var(--muted); font-size: .88rem; font-weight: 680; margin-bottom: .3rem; }
.switch { display: inline-flex; background: #e5eaf5; border-radius: 10px; padding: 3px; gap: 3px; max-width: 100%; }
.switch a { white-space: nowrap; color: #41536d; font-size: .875rem; font-weight: 650; border-radius: 8px; padding: .5rem .7rem; }
.switch a[aria-current] { background: var(--white); color: #313eae; box-shadow: 0 1px 3px #15315f20; }

.filters { display: flex; align-items: end; flex-wrap: wrap; gap: .65rem; }
.filters label, .login-form label { display: grid; gap: .3rem; color: var(--muted); font-size: .875rem; font-weight: 650; }
.filters select, .filters input, .button, .login-form input { min-height: 41px; border-radius: 8px; border: 1px solid #cfd9e8; background: var(--white); color: var(--ink); padding: .5rem .65rem; font-size: .9rem; }
.filters select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2353647d' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .65rem center; padding-right: 1.75rem; max-width: 100%; }
.button { display: inline-flex; align-items: center; justify-content: center; text-align: center; font-weight: 650; }
.button:hover { background: #f3f6fc; text-decoration: none; }
.button.primary { background: var(--accent); border-color: var(--accent); color: white; }
.button.primary:hover { background: #3546c4; }
.custom { font-size: .88rem; min-height: 41px; color: var(--muted); }
.custom summary { cursor: pointer; padding: .55rem .3rem; font-weight: 650; }
.custom div { display: flex; gap: .4rem; flex-wrap: wrap; }
.period-bar { display: flex; justify-content: space-between; align-items: end; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.period-copy { display: grid; gap: 1px; text-align: right; font-size: .875rem; color: var(--muted); }
.period-copy strong { color: var(--ink); }
.period-feedback { flex-basis: 100%; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px #14233a08, 0 8px 25px #20395d05; min-width: 0; }
.metrics, .monitor-summary { display: grid; gap: .8rem; margin-bottom: .8rem; }
.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.monitor-summary { grid-template-columns: repeat(3, minmax(0,1fr)); }
.metric-card { min-height: 147px; padding: .95rem; }
.metric-card h2 { color: var(--muted); font-size: .875rem; letter-spacing: 0; }
.metric-value { padding: .25rem 0; font-size: clamp(1.44rem, 2.7vw, 1.95rem); line-height: 1.2; font-weight: 790; letter-spacing: -.047em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-compare { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; color: var(--muted); font-size: .875rem; margin-top: .15rem; }
.change { border-radius: 5px; padding: .04rem .4rem; font-weight: 720; color: #40546e; background: #edf1f7; }
.change.up { color: #12664e; background: #e4f6ef; }
.change.down { color: #962946; background: #fcebf1; }
.metric-foot, .muted { margin-top: .35rem; font-size: .875rem; color: var(--muted); }
.metric-foot { line-height: 1.35; }
[data-kpi-card] { position: relative; cursor: pointer; }
[data-kpi-card] h2 { padding-right: 1.55rem; }
[data-kpi-card]:hover { border-color: #9faaf0; }
.metric-active { border-color: var(--accent); box-shadow: inset 0 2px 0 var(--accent), 0 1px 2px #14233a08; }
.metric-select { padding: 0; color: inherit; background: none; border: 0; text-align: left; font-weight: inherit; line-height: inherit; }
.metric-select[aria-pressed="true"] { color: var(--accent); }
.kpi-info {
    position: absolute; top: .58rem; right: .55rem; display: grid; place-items: center;
    width: 26px; height: 26px; padding: 0; border: 0; background: transparent; color: var(--muted);
    font-size: .72rem; line-height: 1; font-weight: 700;
}
.kpi-info::before { content: ""; position: absolute; inset: 5px; border: 1px solid #a1aec6; border-radius: 50%; }
.kpi-info:hover, .kpi-info:focus-visible { color: var(--accent); }
.metric-help {
    position: absolute; z-index: 1; top: 2.16rem; inset-inline: .48rem; display: grid; gap: .24rem;
    padding: .55rem .65rem; border: 1px solid #d5deee; border-radius: 8px; box-shadow: 0 6px 20px #14233a22;
    visibility: hidden; background: var(--white); color: var(--ink); font-size: .76rem; line-height: 1.45; cursor: auto;
}
[data-kpi-card]:has(.kpi-info:focus-visible), [data-kpi-card][data-help-open] { z-index: 3; }
.kpi-info:focus-visible + .metric-help, [data-help-open] .metric-help { visibility: visible; }
@media (hover: hover) {
    [data-kpi-card]:has(.kpi-info:hover, .metric-help:hover) { z-index: 3; }
    .kpi-info:hover + .metric-help, .metric-help:hover { visibility: visible; }
}
[data-kpi-card][data-help-dismissed] .metric-help { visibility: hidden; }
.metric-median { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .1rem .45rem; margin-top: .45rem; padding-top: .33rem; border-top: 1px solid var(--line); font-size: .75rem; color: var(--muted); }
.metric-median strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.trend-table summary { cursor: pointer; font-weight: 650; }

.activity, .pad { padding: 1rem; }
.activity { margin-top: .8rem; }
.card-head { display: flex; align-items: start; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-bottom: .75rem; }
.card-head p { margin-top: .25rem; color: var(--muted); font-size: .875rem; }
.publication-tabs { margin-bottom: .65rem; }
.publication-scroll-hint { display: none; color: var(--muted); font-size: .75rem; margin-bottom: .3rem; }
.publication-table-scroll { position: relative; }
.publication-table { min-width: 680px; table-layout: fixed; }
.publication-table thead th { background: #f4f6fb; font-size: .78rem; white-space: normal; }
.publication-table th, .publication-table td { padding: .27rem .55rem; }
.publication-table thead th:first-child { width: 38%; }
.publication-table thead th:nth-child(2) { width: 23%; }
.publication-table th[scope="row"] { color: var(--ink); font-weight: 400; }
.publication-table th:nth-child(n+3), .publication-table td:nth-child(n+3) { text-align: right; }
.publication-row { cursor: pointer; }
.publication-row > :is(th, td) { vertical-align: middle; line-height: 1.25; font-weight: 400; }
.publication-table tbody tr:hover > th { background: #f7f9fd; }
.column-sort { display: inline-flex; align-items: center; gap: .23rem; min-height: 32px; color: inherit; }
.column-sort span { color: var(--muted); font-weight: 750; }
[aria-sort] .column-sort { color: var(--accent); }
.publication-title { display: flex; align-items: center; gap: .55rem; min-width: 0; min-height: 28px; color: var(--ink); }
.publication-title span, .publication-date { display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.publication-title img { flex: 0 0 28px; object-fit: cover; border-radius: 6px; background: #edf1f7; }
.publication-times { display: flex; flex-wrap: wrap; gap: .25rem 1rem; color: var(--muted); overflow-wrap: anywhere; }
.publication-times small { font-size: .74rem; }
.right { text-align: right; }

.monitor-filters, .selected, .chart-card { margin-bottom: .8rem; }
.monitor-filters { padding: .75rem; }
.monitor-filters label { min-width: 0; }
.monitor-filters .publication-filter { flex: 1 1 14rem; max-width: 28rem; }
.monitor-kind { margin-bottom: .7rem; }
.selected { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; padding: .8rem 1rem; }
.empty { padding: 1.4rem 1rem; text-align: center; border-radius: 9px; background: #f4f6fc; color: var(--muted); }
.empty strong { color: var(--ink); }
.chart-wrap { height: 290px; width: 100%; }
.dashboard-trend .chart-wrap { height: 225px; }
.trend-table { color: var(--muted); font-size: .85rem; margin-top: .65rem; }
.trend-table .scroll-table { margin-top: .25rem; }
.chart-note { color: var(--muted); font-size: .875rem; margin-top: .7rem; }
.scroll-table { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .875rem; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: .6rem .7rem; border-top: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 650; }
tr:hover td { background: #f7f9fd; }

.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 1.25rem; background: radial-gradient(ellipse at 25% 0,#e8ecff,transparent 65%),var(--canvas); }
.login-box { width: min(100%, 425px); padding: clamp(1.2rem,4vw,2rem); border: 1px solid var(--line); border-radius: 18px; background: var(--white); box-shadow: 0 18px 80px #19355b15; }
.login-brand { display: flex; gap: .65rem; align-items: center; font-weight: 750; font-size: 1rem; margin-bottom: 1.2rem; }
.login-box h1 { font-size: 1.9rem; letter-spacing: -.055em; line-height: 1.12; margin-bottom: 1rem; }
.login-form { display: grid; gap: .8rem; }
.login-form input { width: 100%; }
.login-form .button { margin-top: .15rem; width: 100%; }
.alert { color: #892142; background: #fff0f4; padding: .6rem .75rem; margin-bottom: .9rem; border-radius: 8px; font-size: .9rem; }

@media (max-width: 1130px) {
    .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); }
    main, .topbar { padding-inline: 1.25rem; }
}
@media (max-width: 820px) {
    .sidebar { position: relative; inset: auto; width: auto; flex-direction: row; flex-wrap: wrap; gap: .6rem .9rem; padding: .75rem 1rem; align-items: center; }
    .brand { margin: 0 auto 0 0; }
    .main-nav { order: 2; flex: 1 0 100%; display: grid; grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); gap: .65rem; margin: 0; }
    .main-nav a { padding: .55rem .5rem; }
    .main-nav a[aria-current] { box-shadow: inset 0 -2px 0 #a6b1ff; }
    .logout { border: 0; padding: 0; margin: 0; }
    .logout .button { min-height: 35px; }
    .workspace { margin-left: 0; }
    main { padding: 1.2rem .9rem; }
    .topbar { padding-inline: .9rem; min-height: 45px; }
}
@media (max-width: 590px) {
    .page-heading { flex-direction: column; align-items: start; gap: .65rem; }
    .period-copy { text-align: left; }
    .zone { display: none; }
    .metrics, .monitor-summary { gap: .55rem; }
    .metric-card { padding: .7rem; min-height: 126px; }
    .metric-help { width: min(230px, calc(100vw - 2rem)); inset-inline: 0 auto; }
    [data-kpi-card]:nth-child(even) .metric-help { inset-inline: auto 0; }
    .monitor-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .monitor-summary > :nth-child(3) { grid-column: 1 / -1; min-height: 95px; }
    .monitor-filters label { flex: 1 1 40%; }
    .monitor-filters .publication-filter { flex-basis: 100%; }
    .monitor-filters label select { width: 100%; min-width: 0; }
    .publication-scroll-hint { display: block; }
    .publication-table { min-width: 560px; table-layout: fixed; }
    .publication-table th:first-child, .publication-table td:first-child {
        position: sticky; left: 0; z-index: 1; width: 135px; background: var(--white);
        box-shadow: 1px 0 var(--line);
    }
    .publication-table thead th:first-child { width: 135px; background: #f4f6fb; }
    .publication-table thead th:nth-child(2) { width: 125px; }
    .publication-table th, .publication-table td { padding: .25rem .42rem; font-size: .78rem; }
    .publication-title { gap: .34rem; }
    .chart-wrap { height: 235px; }
    .dashboard-trend .chart-wrap { height: 190px; }
    .metric-value { font-size: 1.45rem; }
}
