:root {
  --ink: #16211d;
  --muted: #64706a;
  --line: #d7dfd9;
  --canvas: #f5f7f3;
  --surface: #ffffff;
  --green: #146c50;
  --green-deep: #0d4938;
  --mint: #dff1e9;
  --yellow: #f4bd4c;
  --blue: #2e6ea8;
  --red: #b23a3a;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: "Noto Sans KR", "Malgun Gothic", sans-serif; line-height: 1.5; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.topbar { min-height: 68px; padding: 0 5vw; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-actions form { margin: 0; }
.current-user { color: var(--muted); font-size: 13px; font-weight: 700; }
.brand { color: var(--ink); display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-size: 16px; font-weight: 600; white-space: nowrap; }
.brand b { color: var(--green); }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 6px; color: #fff; background: var(--green); font-size: 12px; font-weight: 800; }
.role-switch, .status-filter { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: #f2f5f1; }
.admin-link { color: var(--green-deep); font-size: 14px; font-weight: 700; text-decoration: none; }
.role-button, .filter-button { border: 0; border-radius: 4px; padding: 7px 13px; color: var(--muted); background: transparent; font-size: 14px; }
.role-button.active, .filter-button.active { color: var(--ink); background: #fff; box-shadow: 0 1px 3px #112b2019; font-weight: 700; }
main { max-width: 1120px; margin: 0 auto; padding: 0 28px 52px; }
.masthead { display: flex; justify-content: space-between; align-items: end; gap: 32px; padding: 44px 0 28px; border-bottom: 2px solid var(--ink); }
.eyebrow { margin: 0 0 8px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: 1.2px; }
h1 { margin: 0; font-size: 30px; letter-spacing: 0; }
.masthead p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); }
.identity-field { display: grid; gap: 5px; width: min(280px, 100%); color: var(--muted); font-size: 13px; font-weight: 700; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 5px; padding: 10px 11px; color: var(--ink); background: #fff; outline-color: var(--green); }
textarea { min-height: 120px; resize: vertical; }
.workspace { display: grid; gap: 36px; padding-top: 32px; }
.journal-form { padding: 24px; border-left: 4px solid var(--green); background: var(--surface); box-shadow: 0 8px 20px #173c2d0d; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
h2 { margin: 0; font-size: 20px; letter-spacing: 0; }
h3 { margin: 0; font-size: 15px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid label { display: grid; gap: 7px; font-size: 14px; font-weight: 700; }
.wide { grid-column: 1 / -1; }
.primary-action, .secondary-action { border-radius: 5px; padding: 9px 14px; font-weight: 700; font-size: 14px; }
.primary-action { border: 1px solid var(--green); background: var(--green); color: #fff; }
.primary-action:hover { background: var(--green-deep); }
.secondary-action { border: 1px solid var(--green); background: #fff; color: var(--green-deep); }
.list-section { min-width: 0; }
.count { color: var(--muted); font-size: 14px; }
.journal-list { display: grid; gap: 10px; }
.journal-row { width: 100%; display: grid; grid-template-columns: 108px 1fr auto; align-items: center; gap: 20px; padding: 17px 18px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); text-align: left; color: var(--ink); }
.journal-row:hover { border-color: var(--green); box-shadow: 0 4px 12px #173c2d0d; }
.journal-date { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.journal-main { min-width: 0; }
.journal-main strong { display: block; font-size: 16px; }
.journal-main span { display: block; overflow: hidden; margin-top: 2px; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.status-chip { display: inline-flex; justify-content: center; min-width: 66px; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.status-draft { color: #795611; background: #fff0c8; }
.status-submitted { color: #1b5790; background: #dceeff; }
.status-reviewed { color: #146147; background: var(--mint); }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.hidden { display: none !important; }
.empty-state { padding: 32px 10px; color: var(--muted); text-align: center; border: 1px dashed var(--line); }
.detail-dialog { width: min(620px, calc(100% - 28px)); border: 0; border-radius: 8px; padding: 24px; box-shadow: 0 18px 60px #10251d55; }
.detail-dialog::backdrop { background: #10251d77; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.icon-action { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); background: #fff; font-weight: 700; }
.muted { color: var(--muted); }
.detail-summary { padding: 16px; background: #f4f8f5; border-left: 3px solid var(--mint); white-space: pre-wrap; }
.dialog-actions { display: flex; gap: 8px; margin: 18px 0; }
.attachment-area { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.attachment-list { min-height: 24px; margin: 10px 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.file-field { display: inline-block; margin-right: 8px; color: var(--green-deep); font-size: 14px; font-weight: 700; }
.file-field input { display: block; max-width: 240px; margin-top: 5px; padding: 6px 0; border: 0; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 10; max-width: min(380px, calc(100% - 40px)); padding: 12px 15px; border-radius: 5px; color: #fff; background: var(--ink); opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-shell { width: min(420px, 100%); display: grid; gap: 26px; }
.login-form { display: grid; gap: 16px; padding: 28px; border-top: 4px solid var(--green); background: var(--surface); box-shadow: 0 12px 34px #173c2d16; }
.login-form h1 { font-size: 24px; }
.login-form p:not(.eyebrow) { margin: -8px 0 6px; color: var(--muted); font-size: 14px; }
.login-form label { display: grid; gap: 7px; font-size: 14px; font-weight: 700; }
.text-link { color: var(--green-deep); font-size: 14px; font-weight: 700; }
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.admin-sidebar { display: flex; flex-direction: column; gap: 28px; padding: 28px 20px; background: var(--surface); border-right: 1px solid var(--line); }
.admin-sidebar form { margin-top: auto; }
.admin-sidebar form .secondary-action { width: 100%; }
.admin-navigation { display: grid; gap: 5px; }
.admin-nav-link { border: 0; border-left: 3px solid transparent; padding: 11px 12px; color: var(--muted); background: transparent; text-align: left; font-size: 14px; font-weight: 700; }
.admin-nav-link:hover { color: var(--green-deep); background: #f2f7f4; }
.admin-nav-link.active { border-left-color: var(--green); color: var(--green-deep); background: var(--mint); }
.admin-main { width: min(1120px, 100%); margin: 0 auto; padding: 0 36px 52px; }
.admin-heading { padding: 44px 0 28px; border-bottom: 2px solid var(--ink); }
.admin-heading p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); }
.customer-list { display: grid; gap: 10px; }
.customer-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 18px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.customer-row span { color: var(--muted); font-size: 13px; }

@media (max-width: 700px) {
  .topbar { padding: 0 18px; }
  .brand { font-size: 14px; }
  main { padding: 0 18px 38px; }
  .masthead { display: grid; gap: 20px; padding: 30px 0 22px; }
  h1 { font-size: 25px; }
  .topbar-actions { gap: 8px; }
  .current-user { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .journal-form { padding: 18px; }
  .journal-row { grid-template-columns: 1fr auto; gap: 6px 12px; }
  .journal-date { grid-column: 1 / -1; }
  .admin-toolbar { align-items: stretch; flex-direction: column; }
  .status-filter { overflow-x: auto; }
  .filter-button { white-space: nowrap; }
  .admin-shell { display: block; }
  .admin-sidebar { position: sticky; top: 0; z-index: 2; display: grid; grid-template-columns: 1fr auto; gap: 14px; padding: 14px 18px; border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-navigation { grid-column: 1 / -1; display: flex; overflow-x: auto; }
  .admin-nav-link { flex: 0 0 auto; border-left: 0; border-bottom: 3px solid transparent; }
  .admin-nav-link.active { border-left-color: transparent; border-bottom-color: var(--green); }
  .admin-sidebar form { margin-top: 0; }
  .admin-sidebar form .secondary-action { width: auto; }
  .admin-main { padding: 0 18px 38px; }
  .admin-heading { padding: 30px 0 22px; }
  .customer-row { align-items: start; flex-direction: column; gap: 3px; }
}