@font-face {
  font-family: "D-DIN";
  src: url("/static/fonts/D-DIN.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "D-DIN";
  src: url("/static/fonts/D-DIN-Bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("/static/fonts/Lora-Latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}
:root {
  color-scheme: var(--tg-color-scheme, light);
  --bg: var(--tg-theme-bg-color, #f3f7f8);
  --surface: var(--tg-theme-secondary-bg-color, #ffffff);
  --surface-raised: color-mix(in srgb, var(--surface) 92%, #d9e8e9);
  --text: var(--tg-theme-text-color, #17313e);
  --muted: var(--tg-theme-hint-color, #6d828c);
  --line: color-mix(in srgb, var(--text) 11%, transparent);
  --accent: var(--tg-theme-button-color, #087a7d);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
  --accent-deep: color-mix(in srgb, var(--accent) 78%, #15394b);
  --soft: color-mix(in srgb, var(--accent) 9%, var(--surface));
  --good: #13815b;
  --warn: #aa6a13;
  --bad: #bd3f4b;
  --font-ui: "D-DIN", "DIN", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-claude: "Anthropic Serif", "Lora", Georgia, serif;
  --shadow-soft: 0 8px 24px rgb(23 49 62 / 5%);
  --shadow-card: 0 12px 30px rgb(23 49 62 / 7%);
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 95% 0%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 34rem),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent); outline-offset: 2px; }
.shell { min-height: 100dvh; max-width: 820px; margin: 0 auto; padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 13px 18px 12px;
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(18px);
}
.brand-mark {
  width: 42px; height: 42px; display: grid; place-items: center; position: relative;
  border-radius: 14px; color: #fff; background: linear-gradient(145deg, #169494, #124c64);
  box-shadow: 0 7px 16px rgb(8 122 125 / 22%); font-weight: 850; font-size: 20px; letter-spacing: -.04em;
}
.brand-mark::after { content: ""; position: absolute; width: 7px; height: 7px; border: 2px solid var(--bg); border-radius: 50%; background: #9dd65d; right: -1px; bottom: -1px; }
.brand-copy { display: grid; gap: 3px; flex: 1; min-width: 0; }
.brand-copy strong { font-size: 15px; letter-spacing: -.2px; }
.brand-copy span { color: var(--muted); font-size: 11px; }
.date-chip { border-radius: 999px; padding: 7px 10px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); font-size: 10px; white-space: nowrap; box-shadow: var(--shadow-soft); }
main { padding: 20px 16px 28px; }
.page-heading { position: relative; isolation: isolate; overflow: hidden; padding: 17px 17px 15px; margin: 0 -2px 13px; border: 1px solid var(--line); border-radius: 19px; background: linear-gradient(120deg, var(--surface), color-mix(in srgb, var(--surface) 87%, var(--accent))); box-shadow: var(--shadow-soft); }
.page-heading::after { content: ""; position: absolute; z-index: -1; width: 150px; height: 150px; right: -53px; top: -84px; border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent); border-radius: 50%; box-shadow: 0 0 0 15px color-mix(in srgb, var(--accent) 4%, transparent), 0 0 0 32px color-mix(in srgb, var(--accent) 3%, transparent); }
.eyebrow { margin: 0 0 7px; color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-size: 9px; font-weight: 850; }
h1 { margin: 0; font-size: clamp(23px, 6vw, 29px); line-height: 1.14; letter-spacing: -.75px; }
.page-heading h1, .detail-title, .doc-title, .search-empty strong { font-family: var(--font-claude); font-weight: 600; letter-spacing: -.025em; }
.lead { max-width: 520px; margin: 8px 0 0; color: var(--muted); font-family: var(--font-claude); font-size: 12px; line-height: 1.55; }
.searchbox { display: flex; align-items: center; gap: 8px; min-height: 54px; padding: 5px 6px 5px 14px; border: 1px solid var(--line); background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-soft); transition: border-color .18s ease, box-shadow .18s ease; }
.searchbox:focus-within { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 9%, transparent), var(--shadow-soft); }
.search-symbol { display: grid; place-items: center; color: var(--muted); }
.search-symbol svg { width: 18px; height: 18px; }
.searchbox input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; padding: 10px 3px; color: var(--text); font-size: 13px; }
.searchbox input::placeholder { color: color-mix(in srgb, var(--muted) 78%, transparent); }
.searchbox button, .primary { border: 0; border-radius: 12px; background: linear-gradient(135deg, var(--accent), var(--accent-deep)); color: var(--accent-text); font-weight: 750; padding: 11px 16px; box-shadow: 0 5px 12px color-mix(in srgb, var(--accent) 20%, transparent); transition: transform .16s ease, filter .16s ease, box-shadow .16s ease; }
.searchbox button:hover, .primary:hover { filter: brightness(1.05); box-shadow: 0 8px 17px color-mix(in srgb, var(--accent) 24%, transparent); }
.searchbox button:active, .primary:active { transform: translateY(1px) scale(.99); }
.search-empty { display: grid; justify-items: center; gap: 8px; margin-top: 16px; padding: 25px 18px; text-align: center; border: 1px dashed color-mix(in srgb, var(--accent) 25%, var(--line)); border-radius: 18px; color: var(--muted); background: color-mix(in srgb, var(--surface) 68%, transparent); }
.search-empty strong { color: var(--text); font-size: 14px; }
.search-empty > span:last-child { max-width: 280px; font-size: 11px; line-height: 1.5; }
.search-empty-icon { display: grid; width: 42px; height: 42px; place-items: center; margin-bottom: 2px; border-radius: 14px; color: var(--accent); background: var(--soft); font-size: 22px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 1px 10px; }
.toolbar h2 { margin: 0; font-size: 14px; letter-spacing: -.15px; }
.toolbar .count { color: var(--muted); font-size: 10px; white-space: nowrap; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); padding: 5px 8px; }
.ghost { border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--text); padding: 9px 11px; font-size: 11px; font-weight: 700; transition: background .16s ease, border-color .16s ease, transform .16s ease; }
.ghost:hover { border-color: color-mix(in srgb, var(--accent) 32%, var(--line)); background: var(--soft); }
.ghost:active { transform: translateY(1px); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 17px; padding: 15px; margin: 9px 0; box-shadow: var(--shadow-soft); }
.doc-card { display: block; position: relative; width: 100%; text-align: left; color: var(--text); overflow: hidden; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.doc-card::after { content: "›"; position: absolute; top: 15px; right: 14px; color: color-mix(in srgb, var(--muted) 55%, transparent); font-size: 21px; line-height: 1; }
.doc-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 28%, var(--line)); box-shadow: var(--shadow-card); }
.doc-card:active { transform: scale(.995); }
.doc-head { display: flex; align-items: flex-start; gap: 8px; padding-right: 10px; }
.doc-main { flex: 1; min-width: 0; }
.doc-no { font: 750 10px "D-DIN", "DIN", sans-serif; color: var(--accent); overflow-wrap: anywhere; letter-spacing: .025em; }
.doc-title { display: block; margin-top: 6px; padding-right: 4px; font-size: 13px; font-weight: 600; line-height: 1.48; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 12px; color: var(--muted); font-size: 10px; }
.pill { padding: 4px 8px; border-radius: 999px; background: var(--soft); color: var(--accent); font-size: 9px; font-weight: 750; }
.status { margin-left: auto; padding: 5px 8px; border-radius: 999px; font-size: 9px; font-weight: 750; background: var(--soft); color: var(--accent); white-space: nowrap; }
.status.approved { color: var(--good); background: color-mix(in srgb, var(--good) 11%, var(--surface)); }
.status.rejected { color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--surface)); }
.status.revise { color: var(--warn); background: color-mix(in srgb, var(--warn) 11%, var(--surface)); }
.empty, .loading-card { text-align: center; color: var(--muted); padding: 32px 18px; }
.loading-card { margin-top: 18vh; }
.spinner { display: inline-block; width: 24px; height: 24px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tabs { display: flex; gap: 7px; margin: 13px 0; overflow-x: auto; padding-bottom: 3px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 1px solid var(--line); background: var(--surface); color: var(--muted); padding: 8px 11px; border-radius: 999px; font-size: 10px; font-weight: 650; white-space: nowrap; }
.tabs button.selected { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: var(--soft); color: var(--accent); font-weight: 800; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 8%, transparent); }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 13px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow-soft); }
.field { display: grid; gap: 6px; color: var(--muted); font-size: 10px; font-weight: 750; }
.field select, .field input { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 11px; padding: 10px; background: var(--bg); color: var(--text); font-size: 11px; }
.field .option-search { padding: 8px 10px; }
.custom-ranges { display: grid; gap: 9px; margin-top: 10px; }
.date-range { border: 1px solid var(--line); border-radius: 14px; padding: 11px; background: var(--surface); }
.field-title { display: block; color: var(--muted); font-size: 10px; font-weight: 800; margin-bottom: 8px; }
.range-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.range-inputs label { display: grid; gap: 5px; color: var(--muted); font-size: 9px; font-weight: 650; }
.range-inputs input { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 9px; background: var(--bg); color: var(--text); font-size: 10px; }
.hint { color: var(--muted); font-size: 10px; line-height: 1.5; margin: 8px 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions > * { flex: 1 1 110px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 12px 0 5px; }
.pager span { color: var(--muted); font-size: 10px; white-space: nowrap; }
.pager button:disabled { opacity: .45; cursor: default; }
.detail-top { display: flex; gap: 10px; align-items: center; margin-bottom: 13px; }
.detail-top .eyebrow { margin: 0; }
.detail-title { font-size: 20px; margin-top: 7px; }
.detail-status { margin-top: 10px; }
.detail-section { border-top: 1px solid var(--line); padding-top: 13px; margin-top: 13px; }
.detail-section > b { font-size: 12px; }
.detail-row { display: flex; justify-content: space-between; gap: 18px; padding: 7px 0; font-size: 11px; }
.detail-row span:first-child { color: var(--muted); }
.detail-row span:last-child { text-align: right; font-weight: 650; overflow-wrap: anywhere; }
.history { margin: 10px 0 0; padding-left: 5px; color: var(--muted); font-size: 10px; line-height: 1.7; list-style: none; }
.history li { display: flex; justify-content: space-between; gap: 10px; position: relative; border-left: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line)); padding: 0 0 12px 14px; }
.history li::before { content: ""; width: 8px; height: 8px; border: 2px solid var(--surface); border-radius: 50%; position: absolute; left: -5px; top: 4px; background: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 17%, transparent); }
.history small { color: var(--muted); white-space: nowrap; }
.age-pill { color: var(--warn); font-weight: 750; }
.watch-card .toolbar { align-items: flex-start; }
.watch-card .toolbar h2 { margin-bottom: 4px; }
.watch-actions { display: flex; gap: 5px; }
.watch-state { font-size: 9px; color: var(--muted); }
.watch-state.enabled { color: var(--good); }
.watch-state.paused { color: var(--warn); }
.notify-settings .field { margin: 9px 0; }
.notify-kinds { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 12px 0; }
.notify-kinds label { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 10px; }
.notify-kinds input { accent-color: var(--accent); }
.notify-settings > .primary { width: 100%; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: calc(93px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100vw - 28px); border-radius: 13px; padding: 11px 15px; background: var(--text); color: var(--bg); font-size: 11px; box-shadow: 0 8px 24px #0003; }
.notice-card { max-width: 540px; margin: clamp(45px, 13vh, 120px) auto 0; padding: 19px; }
.notice-card .page-heading { padding: 0; margin: 0; border: 0; box-shadow: none; background: none; }
.notice-card .page-heading::after { display: none; }
.notice-card h1 { font-size: 21px; }
.notice { border: 1px solid color-mix(in srgb, var(--accent) 12%, var(--line)); border-radius: 14px; padding: 13px 14px; margin: 14px 0 0; background: var(--soft); color: var(--text); font-size: 11px; line-height: 1.6; }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 9px; }
.stat { padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-soft); }
.stat strong { display: block; font-size: 22px; letter-spacing: -.5px; }
.stat span { display: block; color: var(--muted); font-size: 9px; line-height: 1.4; margin-top: 4px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; margin: 14px 0; font-size: 10px; }
.bar { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 50%, #b7d554)); }
.change-kind { display: block; margin-bottom: 6px; font-size: 9px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 850; }
.change-date { float: right; color: var(--muted); font-size: 9px; }
.change-doc-no { display: block; padding-right: 25px; }
.notice { font-weight: 500; }
.danger { color: var(--bad); }
.bottom-nav {
  position: fixed; z-index: 10; bottom: calc(10px + env(safe-area-inset-bottom));
  left: max(12px, calc((100vw - 820px) / 2 + 16px)); right: max(12px, calc((100vw - 820px) / 2 + 16px));
  display: flex; justify-content: center; gap: 4px; max-width: 788px; margin: 0 auto;
  padding: 7px; border: 1px solid color-mix(in srgb, var(--text) 8%, transparent); border-radius: 21px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); box-shadow: 0 10px 30px rgb(15 40 52 / 15%); backdrop-filter: blur(20px);
}
.bottom-nav[hidden] { display: none; }
.bottom-nav button { display: grid; justify-items: center; align-content: center; gap: 3px; flex: 1; min-height: 49px; border: 0; border-radius: 15px; background: transparent; color: var(--muted); font-size: 9px; font-weight: 650; padding: 4px 3px; transition: background .18s ease, color .18s ease, transform .18s ease; }
.bottom-nav button .nav-icon { display: grid; width: 22px; height: 22px; place-items: center; }
.bottom-nav button svg { display: block; width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bottom-nav button.active { color: var(--accent); background: var(--soft); font-weight: 800; }
.bottom-nav button:active { transform: scale(.96); }
@media (min-width: 600px) {
  main { padding: 26px 24px; }
  .page-heading { padding: 20px 21px 18px; }
  .lead { font-size: 13px; }
  .doc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
  .custom-ranges { grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.bottom-nav button[hidden] { display: none; }
.admin-tabs { flex-wrap: nowrap; overflow-x: auto; }
.admin-form { display: grid; gap: 12px; }
.admin-form .primary { justify-self: start; }
.admin-form textarea { width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 11px; padding: 10px; background: var(--bg); color: var(--text); font: inherit; font-size: 12px; }
.admin-user .toolbar { margin: 0; align-items: flex-start; }
.admin-user .toolbar h2 { font-size: 13px; }
.admin-user .hint { display: block; margin: 5px 0; }
.admin-shortcuts { margin-top: 14px; }
.danger-button { border: 1px solid color-mix(in srgb, var(--bad) 38%, var(--line)); border-radius: 11px; background: color-mix(in srgb, var(--bad) 8%, var(--surface)); color: var(--bad); padding: 9px 11px; font: inherit; font-size: 11px; font-weight: 700; }
