/* Hallmark | 운영 화면 | 하늘 책상 토큰, 조회 표와 명확한 작업 상태 */
/* 첫 화면은 조회 기간과 운영 지표에 공간을 우선 배정합니다. */
:root {
  color-scheme: light;
  --paper: #e2f1fd;
  --panel: #fff;
  --ink: #1d2f48;
  --muted: #4d6179;
  --line: #c6d8e9;
  --soft: #edf4ff;
  --heading-bg: #f2f7fc;
  --blue: #234eaa;
  --blue-hover: #183c88;
  --red: #9e302a;
  --red-soft: #fff1ee;
  --backdrop: #1d2f4877;
  --shadow: 0 12px 38px #1d2f4813;
  --radius: 16px;
  --font: system-ui, "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  --mono: "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { overflow-x: clip; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.55 var(--font);
  word-break: keep-all;
}

h1, h2, h3, p { margin: 0; }
h1, h2, h3 { overflow-wrap: break-word; min-width: 0; }
h1 { font-size: clamp(1.6rem, 1.35rem + 1.3vw, 2.4rem); letter-spacing: -.04em; }
h2 { font-size: 1.2rem; letter-spacing: -.025em; }
h3 { font-size: 1rem; }

button, input, select { font: inherit; }
button, input:not([type="checkbox"]), select { min-height: 44px; }
button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .45rem .8rem;
  background: var(--panel);
  color: var(--ink);
  font-weight: 650;
  cursor: pointer;
}
button:hover { background: var(--soft); }
button:disabled { cursor: not-allowed; opacity: .65; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: var(--panel);
}
.primary:hover { background: var(--blue-hover); }
.danger { color: var(--red); }
.danger:hover { background: var(--red-soft); }
input:not([type="checkbox"]), select {
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .4rem .6rem;
  background: var(--panel);
  color: var(--ink);
}
input[type="checkbox"] {
  width: 1.2rem;
  height: 1.2rem;
  margin: 0;
  accent-color: var(--blue);
}
label { display: grid; gap: .25rem; font-weight: 600; }

.mast {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.mast-inner {
  max-width: 88rem;
  min-height: 4.25rem;
  margin: auto;
  padding: .5rem clamp(.85rem, 3vw, 2rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand { padding-inline-start: .65rem; border-inline-start: 4px solid var(--blue); font-size: 1.15rem; }
.auth {
  width: min(26rem, calc(100% - 1.7rem));
  margin: clamp(2rem, 9vh, 6rem) auto;
  padding: clamp(1rem, 4vw, 2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}
.auth form, dialog form {
  display: grid;
  gap: .85rem;
}
.auth .notice { margin: .65rem 0 1rem; }
.notice { color: var(--muted); }
.notice:empty { margin: 0; }
.error { color: var(--red); }

.layout {
  max-width: 88rem;
  margin: auto;
  padding: 1.25rem clamp(.85rem, 3vw, 2rem) 3rem;
  display: grid;
  grid-template-columns: 10.5rem minmax(0, 1fr);
  align-items: start;
  gap: clamp(1rem, 3vw, 2rem);
}
.navigation {
  position: sticky;
  top: 1.25rem;
  display: grid;
  gap: .45rem;
}
.navigation button {
  min-width: 0;
  text-align: left;
  background: var(--panel);
}
.navigation button:hover, .navigation [aria-current="page"] { background: var(--soft); }
.navigation [aria-current="page"] { border-color: var(--blue); color: var(--blue); }
.workspace { min-width: 0; display: grid; gap: .9rem; }
.view-bar, .panel-heading, .actions, .filters, .pagination, .register-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem .75rem;
}
.view-bar, .panel-heading { justify-content: space-between; }
.filters {
  align-items: end;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.filters label { flex: 0 1 11rem; }
.period-note { align-self: center; color: var(--muted); font-size: .9rem; }
.view-content { display: grid; min-width: 0; gap: 1rem; }
.view-content[aria-busy="true"] { min-height: 7rem; }
.panel {
  min-width: 0;
  display: grid;
  gap: .8rem;
  padding: clamp(.8rem, 2vw, 1.25rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
  gap: .65rem;
  margin: 0;
}
.metrics > div {
  min-width: 0;
  padding: .65rem .75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--heading-bg);
}
.metrics dt { color: var(--muted); font-size: .88rem; }
.metrics dd {
  margin: .15rem 0 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.overview-metrics dd { font-size: clamp(1.25rem, 1rem + 1vw, 1.8rem); }
.dashboard-details > summary { cursor: pointer; font-weight: 700; }
.table-wrap { min-width: 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-variant-numeric: tabular-nums;
  font-size: .9rem;
}
th, td { border-bottom: 1px solid var(--line); padding: .5rem .65rem; vertical-align: top; }
th { background: var(--heading-bg); white-space: nowrap; }
td { min-width: 5rem; max-width: 20rem; overflow-wrap: anywhere; }
tbody tr:last-child > td { border-bottom: 0; }
tbody tr:hover > td { background: var(--soft); }
td button { font-size: .88rem; white-space: nowrap; }
.identifier { font-family: var(--mono); }
.trend-cell { white-space: nowrap; }
.trend-cell meter { margin-inline-end: .45rem; width: 4rem; accent-color: var(--blue); }
.pagination { justify-content: end; color: var(--muted); }
.actions { align-items: center; }
.register-form { align-items: end; }
.settings-form, .setting-fields { display: grid; gap: .8rem; }
.setting-fields { grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); }
.setting-toggle {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: .55rem;
}
.filter-label { display: flex; align-items: center; gap: .45rem; }
dialog {
  width: min(27rem, calc(100% - 1.7rem));
  max-height: calc(100% - 1.7rem);
  overflow: auto;
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: var(--backdrop); }
dialog .actions { justify-content: end; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 49rem) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .navigation { position: static; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .navigation button { text-align: center; padding-inline: .3rem; font-size: .9rem; }
}
@media (max-width: 29rem) {
  .filters label { flex: 1 1 7.5rem; }
  .period-note { width: 100%; }
}
