:root {
    color-scheme: light;
    --ink: #172840;
    --muted: #53647a;
    --line: #dce5ef;
    --surface: #fff;
    --canvas: #f4f7fb;
    --blue: #1756bc;
    --blue-dark: #11469e;
    font-family: Inter, "Hiragino Sans", "Yu Gothic", Meiryo, system-ui, sans-serif;
    color: var(--ink);
    background: var(--canvas);
    font-size: 15px;
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.55; }
a { color: var(--blue-dark); text-underline-offset: .18em; }
:focus-visible { outline: 3px solid #367ce2; outline-offset: 3px; }
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-inner, .navigation, main { width: min(100% - 64px, 1280px); margin-inline: auto; }
.top-inner { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-size: 18px; font-weight: 750; line-height: 1.2; }
.brand-mark { display: inline-flex; align-items: end; justify-content: center; gap: 3px; width: 33px; height: 33px; padding: 8px; border-radius: 9px; background: var(--blue); flex: none; }
.brand-mark i { width: 4px; height: 7px; border-radius: 1px; background: #fff; }
.brand-mark i:nth-child(2) { height: 12px; }
.brand-mark i:nth-child(3) { height: 16px; }
nav { background: var(--surface); border-bottom: 1px solid var(--line); }
.navigation { display: flex; gap: 8px 21px; flex-wrap: wrap; }
.navigation a { display: flex; align-items: center; min-height: 46px; color: var(--muted); font-weight: 650; text-decoration: none; white-space: nowrap; border-bottom: 3px solid transparent; padding: 5px 1px 2px; }
.navigation a[aria-current] { color: var(--blue-dark); border-color: var(--blue); }
main { padding: 32px 0 56px; }
.auth main { width: min(100% - 32px, 420px); padding-top: clamp(32px, 10vh, 110px); }
.login { padding: 32px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(22px, 3vw, 31px); line-height: 1.25; margin-bottom: 16px; letter-spacing: -.025em; overflow-wrap: anywhere; }
h2 { font-size: 17px; line-height: 1.4; margin-bottom: 12px; }
p + p { margin-top: 10px; }
small, .muted { color: var(--muted); }
small { display: block; font-size: 13px; font-weight: 400; }
.panel, .kpi { min-width: 0; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.panel { padding: 22px; }
.page-title, .dashboard-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 14px; margin-bottom: 16px; }
.page-title h1, .dashboard-heading h1 { margin-bottom: 0; }
.period-label { margin-top: 6px; font-size: 14px; }
.period { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.period label { font-size: 12px; }
.period input { margin-top: 3px; }
.shortcuts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.shortcuts a { display: inline-flex; min-height: 36px; align-items: center; padding: 4px 11px; border: 1px solid #d6e5fb; border-radius: 6px; background: #edf4ff; text-decoration: none; font-size: 13px; font-weight: 650; }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.kpi { padding: 15px 16px; }
.kpi span { display: block; color: var(--muted); font-size: 13px; font-weight: 650; }
.kpi strong { display: block; margin-top: 7px; font-size: clamp(17px, 2.25vw, 29px); line-height: 1.25; letter-spacing: -.03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; margin-top: 14px; align-items: start; }
.report-section { margin-top: 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 2px; background: #346ecc; }
.legend span + span i { background: #0e8a99; }
.monthly { margin-top: 10px; }
.month { display: grid; grid-template-columns: auto minmax(70px, 1fr) auto; gap: 3px 13px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; }
.bar-pair { display: grid; gap: 3px; }
.bar-pair meter { display: block; width: 100%; height: 8px; border: 0; background: #edf2fa; border-radius: 3px; }
meter::-webkit-meter-bar { background: #edf2fa; border: 0; border-radius: 3px; }
meter::-webkit-meter-optimum-value { background: #346ecc; }
meter.sales::-webkit-meter-optimum-value { background: #0e8a99; }
meter::-moz-meter-bar { background: #346ecc; }
meter.sales::-moz-meter-bar { background: #0e8a99; }
.month-values { display: grid; text-align: right; font-variant-numeric: tabular-nums; }
.counts { grid-column: 2 / -1; }
.ranking { margin: 10px 0 0; padding-left: 1.6em; }
.ranking li { padding: 9px 0; border-top: 1px solid var(--line); }
.ranking li div { display: inline-block; max-width: 77%; overflow-wrap: anywhere; }
.ranking li strong { float: right; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.empty { color: var(--muted); padding: 18px 0; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; white-space: nowrap; padding: 12px 10px; border-bottom: 1px solid var(--line); }
thead { background: #f2f6fc; }
thead th { color: var(--muted); }
.record-name { display: flex; align-items: center; gap: 9px; }
.record-name img { border-radius: 5px; object-fit: cover; }
details { margin-top: 16px; color: var(--muted); }
details p { margin-top: 8px; font-size: 13px; max-width: 70ch; }
summary { cursor: pointer; min-height: 30px; }
.details { display: flex; flex-wrap: wrap; gap: 14px 26px; margin: 12px 0 0; }
.details dt { color: var(--muted); font-size: 13px; }
.details dd { margin: 2px 0 0; font-weight: 650; overflow-wrap: anywhere; }
.form-panel { max-width: 790px; }
.form-panel > p { margin-bottom: 16px; }
.fields { display: grid; gap: 15px; }
.fields.columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wide { grid-column: 1 / -1; }
label { display: block; min-width: 0; font-size: 14px; font-weight: 650; }
label small { margin-top: 4px; }
.required { color: #963a33; }
input, select, textarea { display: block; min-width: 0; width: 100%; min-height: 42px; margin-top: 5px; padding: 8px 10px; border: 1px solid #aebed1; border-radius: 7px; font: inherit; font-size: 16px; font-weight: 400; color: var(--ink); background: var(--surface); }
textarea { resize: vertical; }
input[type="checkbox"] { width: 19px; height: 19px; min-height: 0; margin: 0; }
.check { display: flex; gap: 8px; align-items: center; margin-top: 7px; min-height: 44px; }
.image-edit img { display: block; max-width: 100%; max-height: 270px; object-fit: contain; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 42px; padding: 8px 14px; border: 1px solid #aebed1; border-radius: 7px; color: var(--ink); background: var(--surface); font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; }
button:hover, .button:hover { background: #f2f6fc; }
.primary { border-color: var(--blue); background: var(--blue); color: #fff; }
.primary:hover { background: var(--blue-dark); }
button:disabled { opacity: .6; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.form-actions { padding-top: 17px; margin-top: 17px; border-top: 1px solid var(--line); }
.danger { color: #a32e35; }
.delete-link { margin-left: auto; padding: 9px 0; }
.destructive { color: #fff; background: #a32e35; border-color: #a32e35; }
.destructive:hover { background: #8e2430; }
.settings { display: grid; gap: 14px; max-width: 720px; }
.settings .fields { max-width: 420px; margin-top: 13px; }
.message { background: #edf4ff; border: 1px solid #d6e5fb; border-radius: 8px; padding: 10px 13px; margin-bottom: 12px; }
.error { color: #882b35; background: #fff1f2; border-color: #edc0c4; }
.success { color: #205b46; background: #eaf7ef; border-color: #badfc9; }
@media (max-width: 960px) {
    .top-inner, .navigation, main { width: calc(100% - 36px); }
    .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
    .top-inner, .navigation, main { width: calc(100% - 28px); }
    .top-inner { min-height: 60px; }
    .brand { font-size: 15px; gap: 7px; }
    .quick { padding-inline: 9px; font-size: 13px; white-space: nowrap; }
    .navigation { gap: 0 13px; }
    .navigation a { min-height: 41px; font-size: 12px; }
    main { padding-top: 21px; }
    .panel { padding: 14px; }
    .auth .panel { padding: 23px; }
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .kpi { padding: 11px 12px; }
    .dashboard-grid, .fields.columns { grid-template-columns: minmax(0, 1fr); }
    .dashboard-grid { gap: 10px; margin-top: 10px; }
    .period { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
    .period input { padding-inline: 5px; font-size: 16px; }
    .period button { padding-inline: 8px; }
    .report-section { margin-top: 10px; }
}
.history-item { padding: 8px 0; border-bottom: 1px solid var(--line); }
.history-item pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 13px; }
.optional-fields { margin-top: 0; }
.optional-fields[open] > .fields { margin-top: 8px; }
@media (max-width: 360px) {
    .period { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .period button { grid-column: 1 / -1; justify-self: end; }
}
