@font-face {
  font-family: Pretendard;
  src: url('/assets/pretendard.woff2') format('woff2');
  font-display: swap;
}

:root {
  --tg-bg: var(--tg-chrome);
  --tg-fg: var(--tg-ink);
  --tg-card: var(--tg-canvas);
}

@media (prefers-color-scheme: dark) {
  :root {
    --tg-chrome: #17191d;
    --tg-canvas: #22252b;
    --tg-ink: #edf0f4;
    --tg-muted: #a4abb5;
    --tg-line: #34383f;
  }
}

* { box-sizing: border-box; }
html, body { min-height: 100%; background: var(--tg-bg); }
body { margin: 0; font-family: Pretendard, system-ui, sans-serif; color: var(--tg-fg); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--tg-line); border-radius: 8px; background: var(--tg-card); padding: 8px 12px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button:hover { border-color: var(--tg-accent); }
a { color: var(--tg-accent); }
:focus-visible { outline: 3px solid #6685ff; outline-offset: 2px; }
.shell { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }
.sidebar { padding: 22px 14px; border-right: 1px solid var(--tg-line); background: var(--tg-card); }
.brand { display: flex; align-items: center; gap: 10px; margin: 0 8px 28px; font-size: 18px; font-weight: 700; }
.brand img { width: 28px; height: 28px; }
.nav { display: grid; gap: 4px; }
.nav a { padding: 10px 12px; border-radius: 8px; color: inherit; text-decoration: none; }
.nav a.active, .nav a:hover { background: color-mix(in srgb, var(--tg-accent) 12%, transparent); color: var(--tg-accent); }
.main { min-width: 0; }
.topbar { height: 68px; display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 0 28px; border-bottom: 1px solid var(--tg-line); background: var(--tg-card); }
.content { max-width: 1440px; margin: auto; padding: 28px; }
h1 { margin: 0 0 22px; font-size: 25px; }
h2 { margin: 26px 0 12px; font-size: 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.card, .panel { margin-bottom: 16px; padding: 18px; border: 1px solid var(--tg-line); border-radius: 12px; background: var(--tg-card); }
.metric { margin-top: 8px; font-size: 25px; font-weight: 700; }
.muted, small { color: var(--tg-muted); }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
input, select, textarea { max-width: 100%; padding: 9px; border: 1px solid var(--tg-line); border-radius: 7px; background: var(--tg-card); }
textarea { width: 100%; min-height: 90px; }
.field { display: grid; gap: 6px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.table-wrap { overflow: auto; border: 1px solid var(--tg-line); border-radius: 10px; background: var(--tg-card); }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 11px 13px; border-bottom: 1px solid var(--tg-line); text-align: left; }
th { color: var(--tg-muted); font-size: 12px; font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 99px; background: #eaf0ff; color: #3857c8; font-size: 12px; }
.danger { color: #b42318; }
.bar { min-width: 90px; height: 7px; border-radius: 9px; background: var(--tg-line); }
.bar i { display: block; height: 100%; border-radius: 9px; }
.usage { display: grid; gap: 5px; }
.chart { width: 100%; height: 170px; }
.notice { margin: 0 0 16px; padding: 12px; border-radius: 8px; background: #fff4d6; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 20; padding: 14px 18px; border-radius: 9px; background: #222; color: #fff; }
.drawer { position: fixed; inset: 0 0 0 auto; z-index: 10; width: min(680px, 100%); overflow: auto; padding: 24px; background: var(--tg-card); box-shadow: 0 0 0 100vw #0006; }
.drawer header { display: flex; justify-content: space-between; }
.empty, .loading { padding: 30px; color: var(--tg-muted); text-align: center; }
dialog { max-width: min(600px, 95vw); border: 1px solid var(--tg-line); border-radius: 12px; background: var(--tg-card); color: inherit; }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { padding: 10px; border-right: 0; border-bottom: 1px solid var(--tg-line); }
  .brand { margin: 6px 8px; }
  .nav { display: flex; overflow: auto; }
  .nav a { white-space: nowrap; }
  .topbar { height: auto; padding: 12px; }
  .content { padding: 18px; }
}
fieldset { min-width: 0; margin: 12px 0; padding: 14px; border: 1px solid var(--tg-line); border-radius: 9px; }
legend { padding: 0 6px; color: var(--tg-muted); }
.limit-row, .feature-row { display: grid; grid-template-columns: minmax(130px, 1fr) repeat(3, minmax(90px, 1fr)); gap: 8px; align-items: center; margin: 8px 0; }
.feature-row { grid-template-columns: minmax(160px, 1fr) minmax(100px, 1fr) auto; }
.limit-row > span { font-weight: 600; }
.limit-row select, .limit-row input, .feature-row input { width: 100%; }
.drawer:focus { outline: 0; }
@media (max-width: 760px) { .limit-row, .feature-row { grid-template-columns: 1fr 1fr; } }
.error { color: var(--tg-bad, #c8412d); font-weight: 600; }
.preview { grid-column: 1 / -1; padding: 14px; border: 1px dashed var(--tg-line); border-radius: 8px; background: var(--tg-card); }
.preview h3 { margin-top: 0; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0 0 16px; }
dt { color: var(--tg-muted); }
dd { margin: 0; }
.notice { color: #5c3d00; }
