:root {
  --paper: #f4efe3;
  --paper-light: #fffdf7;
  --ink: #1d211c;
  --muted: #6e7068;
  --line: #d6d0c2;
  --red: #b23b2a;
  --red-dark: #84291e;
  --olive: #68745a;
  --olive-light: #dfe3d5;
  --gold: #c79b53;
  --shadow: 0 18px 50px rgba(50, 44, 33, 0.11);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--paper); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 6%, rgba(199, 155, 83, .18), transparent 24rem),
    linear-gradient(135deg, rgba(255,255,255,.42), transparent 45%),
    var(--paper);
  font-family: "Noto Sans KR", sans-serif;
  line-height: 1.6;
}

button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

.paper-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .24;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
  z-index: 20;
}

.topbar {
  width: min(1240px, calc(100% - 48px));
  margin: 0 auto;
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 42px;
  height: 42px;
  border: 1px solid var(--red);
  color: var(--red);
  display: grid;
  place-items: center;
  font-family: "Gowun Batang", serif;
  font-size: 23px;
  transform: rotate(-3deg);
}
.brand strong, .brand small { display: block; }
.brand strong { font-family: "Gowun Batang", serif; font-size: 18px; }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: -.02em; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.top-actions form { margin: 0; }

.shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 68px 0 100px;
  position: relative;
  z-index: 25;
}

.button {
  min-height: 42px;
  padding: 9px 17px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  transition: transform .18s ease, background .18s ease, color .18s ease;
}
.button:hover { transform: translateY(-2px); }
.button-primary { background: var(--red); color: #fff; box-shadow: 4px 4px 0 var(--red-dark); }
.button-primary:hover { background: var(--red-dark); }
.button-dark { background: var(--ink); color: #fff; }
.button-quiet { border-color: var(--line); background: rgba(255,255,255,.35); }
.button-text { background: transparent; color: var(--muted); padding-inline: 8px; }
.button-wide { width: 100%; min-height: 50px; }

.eyebrow, .kicker {
  display: block;
  color: var(--red);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .19em;
  margin-bottom: 13px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 80px;
  align-items: end;
  margin-bottom: 58px;
}
.hero h1, .form-heading h1 {
  margin: 0;
  font-family: "Gowun Batang", serif;
  font-size: clamp(45px, 6vw, 76px);
  line-height: 1.06;
  letter-spacing: -.055em;
}
.hero h1 em, .form-heading h1 em { color: var(--red); font-style: normal; }
.hero > div > p {
  max-width: 600px;
  margin: 25px 0 0;
  color: var(--muted);
  font-size: 17px;
}
.hero-note {
  border-left: 3px solid var(--red);
  padding: 8px 0 8px 24px;
}
.hero-note span, .hero-note strong { display: block; }
.hero-note span { color: var(--red); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.hero-note strong { margin: 8px 0 5px; font-family: "Gowun Batang", serif; font-size: 24px; }
.hero-note p { margin: 0; color: var(--muted); font-size: 13px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  background: rgba(255,255,255,.25);
  box-shadow: var(--shadow);
}
.stat-card { padding: 24px 26px; border-right: 1px solid var(--line); }
.stat-card:last-child { border-right: 0; }
.stat-card span, .stat-card small { display: block; }
.stat-card span { color: var(--muted); font-size: 12px; font-weight: 700; }
.stat-card strong { display: block; margin: 4px 0; font-family: "Gowun Batang", serif; font-size: 37px; line-height: 1.1; }
.stat-card small { color: #929286; font-size: 11px; }
.stat-card.accent { background: var(--ink); color: var(--paper-light); }
.stat-card.accent span, .stat-card.accent small { color: #c7c7ba; }

.records-section { margin-top: 88px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 24px; }
.section-heading h2 { margin: 0; font-family: "Gowun Batang", serif; font-size: 36px; }
.mobile-new { display: none; }

.filter-bar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 150px 130px auto auto;
  gap: 9px;
  margin-bottom: 34px;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255,253,247,.72);
  color: var(--ink);
  outline: none;
}
input, select { min-height: 44px; padding: 9px 12px; }
textarea { padding: 13px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(178,59,42,.09); }

.timeline { border-top: 1px solid var(--ink); }
.record-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 30px;
  padding: 32px 0;
  border-bottom: 1px solid var(--line);
}
.record-date { text-align: center; padding-top: 3px; }
.record-date strong { display: block; font-family: "Gowun Batang", serif; color: var(--red); font-size: 38px; line-height: 1; }
.record-date span { color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.record-meta { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.record-meta span { font-size: 10px; font-weight: 800; letter-spacing: .06em; padding: 3px 8px; }
.category { background: var(--ink); color: #fff; }
.status { border: 1px solid var(--line); }
.status-완료 { background: var(--olive-light); color: #45513a; border-color: transparent; }
.status-보류 { background: #e8dfcc; color: #775f38; border-color: transparent; }
.evidence-mark { color: var(--red); border-bottom: 1px solid var(--red); padding-inline: 2px !important; }
.record-body h3 { margin: 10px 0 7px; font-family: "Gowun Batang", serif; font-size: 25px; }
.record-summary { margin: 0; color: #464941; white-space: pre-wrap; }
.record-details { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 18px; }
.record-details > div { padding: 13px 15px; background: rgba(255,255,255,.36); border-left: 2px solid var(--line); }
.record-details span { display: block; color: var(--red); font-size: 10px; font-weight: 800; margin-bottom: 4px; }
.record-details p { margin: 0; color: var(--muted); font-size: 12px; white-space: pre-wrap; }
.tags { color: var(--olive); font-size: 11px; font-weight: 700; word-spacing: 6px; }
.record-actions { display: flex; align-items: center; gap: 15px; margin-top: 17px; }
.record-actions a, .record-actions button {
  padding: 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}
.record-actions form { margin: 0; }

.empty-state { padding: 75px 20px; text-align: center; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.empty-state > span { color: var(--red); font-family: "Gowun Batang", serif; font-size: 36px; }
.empty-state h3 { margin: 8px 0 4px; font-family: "Gowun Batang", serif; font-size: 27px; }
.empty-state p { margin: 0 0 25px; color: var(--muted); }

.flash-stack { position: fixed; z-index: 100; top: 18px; left: 50%; transform: translateX(-50%); width: min(440px, calc(100% - 30px)); }
.flash { padding: 13px 17px; box-shadow: var(--shadow); background: var(--ink); color: white; font-size: 13px; }
.flash-error { background: var(--red-dark); }
.flash-success { background: #3f5339; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 45px;
  position: relative;
  z-index: 25;
}
.login-panel {
  width: min(1080px, 100%);
  min-height: 620px;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  background: var(--paper-light);
  box-shadow: 0 35px 90px rgba(44,37,28,.19);
}
.login-intro {
  position: relative;
  overflow: hidden;
  padding: 78px 70px;
  background:
    linear-gradient(rgba(29,33,28,.92), rgba(29,33,28,.96)),
    radial-gradient(circle at 70% 20%, var(--gold), transparent 42%);
  color: var(--paper-light);
}
.login-intro::after {
  content: "";
  position: absolute;
  width: 360px;
  height: 360px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  right: -130px;
  bottom: -140px;
  box-shadow: 0 0 0 45px rgba(255,255,255,.025), 0 0 0 90px rgba(255,255,255,.02);
}
.login-intro h1 { margin: 0; font-family: "Gowun Batang", serif; font-size: clamp(44px, 5vw, 65px); line-height: 1.12; letter-spacing: -.05em; }
.login-intro h1 em { color: #d7ae65; font-style: normal; }
.login-intro p { max-width: 440px; margin-top: 28px; color: #c8c9c1; font-size: 15px; }
.seal {
  position: absolute;
  left: 70px;
  bottom: 65px;
  width: 63px;
  height: 63px;
  display: grid;
  place-items: center;
  border: 2px solid #c25442;
  color: #d96a58;
  font-family: "Gowun Batang", serif;
  font-weight: 700;
  line-height: 1.05;
  transform: rotate(-5deg);
}
.login-card { padding: 78px 55px; display: flex; flex-direction: column; justify-content: center; }
.login-card h2 { margin: 5px 0 3px; font-family: "Gowun Batang", serif; font-size: 34px; }
.login-card > div > p { margin: 0; color: var(--muted); font-size: 13px; }
.stack-form { display: grid; gap: 17px; margin-top: 35px; }
.stack-form label > span, .record-form label > span { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 800; }
.privacy-note { display: block; margin-top: 22px; color: #959589; line-height: 1.5; }

.form-heading { max-width: 760px; margin-bottom: 52px; }
.form-heading > a { display: inline-block; margin-bottom: 35px; color: var(--muted); font-size: 12px; border-bottom: 1px solid; }
.form-heading h1 { font-size: clamp(44px, 6vw, 68px); }
.form-heading p { color: var(--muted); }
.record-form { display: grid; gap: 18px; }
.form-sheet {
  display: grid;
  grid-template-columns: 80px 1fr;
  background: rgba(255,253,247,.68);
  border: 1px solid var(--line);
  box-shadow: 0 8px 30px rgba(50,44,33,.05);
}
.sheet-number { padding: 28px 24px; border-right: 1px solid var(--line); color: var(--red); font-family: "Gowun Batang", serif; font-size: 22px; }
.sheet-content { padding: 31px 36px 37px; }
.sheet-content h2 { margin: 0 0 25px; font-family: "Gowun Batang", serif; font-size: 24px; }
.sheet-content > label { display: block; margin-top: 19px; }
.record-form label small { display: block; margin: -3px 0 7px; color: var(--muted); font-size: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.current-file { margin-top: 18px; padding: 12px 14px; background: var(--olive-light); display: flex; justify-content: space-between; gap: 20px; font-size: 11px; }
.current-file label { display: flex; align-items: center; gap: 6px; }
.current-file input { width: auto; min-height: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 11px; margin-top: 12px; }
.form-actions .button { min-width: 125px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

@media (max-width: 820px) {
  .topbar { width: calc(100% - 28px); min-height: 78px; }
  .brand small, .top-actions .button-quiet, .top-actions .button-primary { display: none; }
  .shell { width: calc(100% - 28px); padding-top: 42px; }
  .hero { grid-template-columns: 1fr; gap: 32px; }
  .hero h1 { font-size: 49px; }
  .hero-note { max-width: 420px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-card:nth-child(2) { border-right: 0; }
  .stat-card:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .records-section { margin-top: 62px; }
  .mobile-new { display: inline-flex; }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .record-details { grid-template-columns: 1fr; }
  .login-shell { padding: 20px; }
  .login-panel { grid-template-columns: 1fr; }
  .login-intro { min-height: 360px; padding: 48px 38px; }
  .login-intro p { max-width: 500px; }
  .seal { left: auto; right: 38px; bottom: 32px; }
  .login-card { padding: 45px 38px; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .top-actions { gap: 0; }
  .brand strong { font-size: 15px; }
  .hero h1 { font-size: 42px; }
  .hero > div > p { font-size: 14px; }
  .stat-card { padding: 18px; }
  .stat-card strong { font-size: 30px; }
  .section-heading h2 { font-size: 29px; }
  .filter-bar { grid-template-columns: 1fr; }
  .search-field { grid-column: auto; }
  .record-card { grid-template-columns: 52px 1fr; gap: 14px; padding: 25px 0; }
  .record-date strong { font-size: 30px; }
  .record-body h3 { font-size: 21px; }
  .record-actions { gap: 12px; flex-wrap: wrap; }
  .login-shell { padding: 0; place-items: stretch; }
  .login-panel { min-height: 100vh; }
  .login-intro { min-height: 315px; padding: 42px 27px; }
  .login-intro h1 { font-size: 39px; }
  .login-card { padding: 40px 27px 55px; }
  .form-sheet { grid-template-columns: 1fr; }
  .sheet-number { border-right: 0; border-bottom: 1px solid var(--line); padding: 11px 20px; font-size: 16px; }
  .sheet-content { padding: 24px 20px 29px; }
  .current-file { flex-direction: column; gap: 6px; }
}
