:root {
  color-scheme: light;
  --radius: 14px;
  font: 14px/1.55 "Pretendard Variable", Pretendard, "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
[hidden] { display: none !important; }
button, input, select { font: inherit; }
a { color: var(--accent); }
button { cursor: pointer; }
button:disabled { opacity: .48; cursor: default; }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(25px, 3vw, 35px); line-height: 1.28; letter-spacing: -.055em; }
h2 { font-size: 18px; line-height: 1.35; letter-spacing: -.038em; }
label { font-size: 13px; font-weight: 700; }
input:not([type="checkbox"]), select {
  min-height: 42px;
  border: 1px solid var(--control-border);
  border-radius: 9px;
  padding: 8px 10px;
  color: var(--ink);
  background-color: var(--surface);
}
input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  vertical-align: middle;
  cursor: pointer;
}
input::placeholder { color: var(--muted); }
fieldset { min-width: 0; padding: 0; margin: 0; border: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 7px 13px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--ink);
  background: var(--surface);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.38;
  white-space: nowrap;
}
.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.primary:hover:not(:disabled) { background: var(--accent-hover); }
.secondary { border-color: var(--control-border); }
.secondary:hover:not(:disabled), .subtle:hover:not(:disabled) { background: var(--accent-soft); }
.subtle { color: var(--muted); background: transparent; }
.refresh-icon { color: var(--accent); font: 21px/1 sans-serif; }
.feedback { padding: 10px 12px; border-radius: 9px; color: #962830; background: #fff0f1; overflow-wrap: anywhere; }
.feedback[data-kind="success"] { background: #ecf7f4; color: #06654f; }
.global-feedback { margin-bottom: 16px; }
.startup { padding: 40px; text-align: center; color: var(--muted); }

.receipt-icon::before {
  content: "";
  width: 17px;
  height: 21px;
  border: 1.5px solid currentColor;
  border-radius: 3px;
  background:
    linear-gradient(currentColor, currentColor) center 6px / 7px 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) center 10px / 7px 1.5px no-repeat,
    linear-gradient(currentColor, currentColor) center 14px / 7px 1.5px no-repeat;
}
.nav-icon { display: inline-grid; width: 20px; height: 24px; place-items: center; }
.nav-icon.receipt-icon::before { width: 15px; height: 19px; }
.team-icon::before {
  content: "";
  width: 9px;
  height: 9px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}
.team-icon::after {
  content: "";
  width: 17px;
  height: 8px;
  border: 1.5px solid currentColor;
  border-radius: 7px 7px 3px 3px;
}

.login-view {
  display: grid;
  min-height: 100dvh;
  padding: 24px;
  place-items: center;
  background: radial-gradient(ellipse at 50% 22%, #e3efe5, var(--canvas) 66%);
}
.login-card {
  width: min(100%, 420px);
  padding: clamp(24px, 5vw, 38px);
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 16px 56px rgb(27 55 38 / .1);
}
.login-card > .brand-logo { width: min(230px, 100%); }
.login-card h1 { margin-top: 30px; }
.login-card > p { margin-top: 7px; color: var(--muted); }
.login-card form, .detail-side form { display: grid; gap: 7px; margin-top: 23px; }
.login-card input + label, .detail-side input + label { margin-top: 7px; }
.login-card form button { min-height: 46px; margin-top: 11px; }
.login-link { display: inline-block; margin-top: 17px; font-weight: 700; text-decoration: none; }

.workspace { display: grid; min-height: 100dvh; grid-template-columns: 218px minmax(0, 1fr); }
.workspace-main { min-width: 0; }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100dvh;
  flex-direction: column;
  gap: 27px;
  padding: 21px 16px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}
.sidebar > .brand-logo { width: min(100%, 176px); margin-inline: auto; }
.sidebar nav { display: grid; gap: 6px; }
.nav-button {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  font-weight: 700;
}
.nav-button:hover { color: var(--forest); background: var(--accent-soft); }
.nav-button[aria-current="page"] { color: #fff; background: var(--forest); }
.side-link { margin: auto 9px 2px; color: var(--muted); text-decoration: none; }
.side-link:hover, .side-link span { color: var(--accent); }
.side-link span { margin-left: 5px; }
.topbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  padding: 10px clamp(16px, 3vw, 40px);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.breadcrumb { display: flex; flex-wrap: wrap; gap: 9px; color: var(--muted); font-size: 13px; }
.breadcrumb strong { color: var(--ink); }
.account { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.account div { display: grid; line-height: 1.4; }
.account div span { color: var(--muted); font-size: 12px; }
.avatar { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); width: 36px; height: 36px; border-radius: 50%; font-weight: 700; }
.main-content { width: min(100%, 1540px); margin-inline: auto; padding: 29px clamp(16px, 3vw, 40px) 48px; }
.page-heading { display: flex; gap: 18px; align-items: end; justify-content: space-between; margin-bottom: 22px; }
.page-heading p { margin-top: 7px; color: var(--muted); overflow-wrap: anywhere; }
.panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--card-shadow); }

.filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(125px, 1fr));
  gap: 11px;
  align-items: end;
  padding: 17px;
  margin-bottom: 17px;
}
.filter-field { display: grid; gap: 5px; min-width: 0; }
.filter-field > :is(input, select) { min-width: 0; width: 100%; }
.filter-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.table-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 13px; padding: 16px 17px; }
.table-title, .table-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.count { background: var(--accent-soft); color: var(--accent-hover); border-radius: 20px; padding: 1px 9px; font-size: 12px; font-weight: 700; }
.table-meta { margin-top: 4px; color: var(--muted); font-size: 13px; }
.table-actions select { font-size: 13px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 730px; border-collapse: collapse; text-align: left; }
th, td { padding: 10px 12px; border-block-start: 1px solid var(--border); vertical-align: middle; }
th { background: var(--canvas); color: var(--muted); font-size: 12px; white-space: nowrap; font-weight: 700; }
td { font-size: 13px; }
tbody tr:hover { background: #f8faf7; }
tbody tr[data-selected="true"] { background: var(--accent-soft); }
.check-cell { width: 44px; padding-inline: 13px 4px; }
.date-cell { font-variant-numeric: tabular-nums; white-space: nowrap; }
.file-cell { max-width: 240px; overflow-wrap: anywhere; }
.file-link { border: 0; padding: 7px 0; color: var(--ink); background: transparent; text-align: left; font-weight: 700; }
.file-link:hover { color: var(--accent); text-decoration: underline; }
.file-description { display: block; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 20px; background: #f5f0df; color: #785707; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge.processed { background: #e9f7f1; color: #076650; }
.badge.new { margin-inline-start: 6px; background: var(--accent-soft); color: var(--accent-hover); }
.row-download { min-height: 35px; }
.empty-state { display: grid; justify-items: center; gap: 7px; padding: 44px 16px 47px; text-align: center; }
.empty-state p { color: var(--muted); font-size: 13px; }
.empty-icon { display: grid; place-items: center; width: 43px; height: 43px; margin-bottom: 4px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.pagination { display: flex; justify-content: end; align-items: center; gap: 10px; padding: 11px 16px; border-top: 1px solid var(--border); color: var(--muted); }
.access-form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; padding: 17px; margin-bottom: 17px; }
.access-form .filter-field { flex: 1 1 160px; }
.institution-meta { display: block; font-size: 0.82em; color: var(--muted, #4d6258); }
.institution-identity { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; }
.institution-identity .institution-meta { white-space: nowrap; }
.institution-assignment { display: grid; gap: 6px; max-height: 240px; overflow: auto; margin-top: 8px; }
.institution-assignment label { display: flex; align-items: baseline; gap: 8px; }
.issued-code { display: grid; gap: 8px; margin-bottom: 17px; padding: 17px; }
.issue-actions, .access-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.issue-actions input { flex: 1 1 200px; min-width: 0; font-family: monospace; }
.issued-code p { color: var(--muted); }
.access-list table { min-width: 620px; }
.access-list .table-toolbar input { max-width: 100%; }
.access-empty { text-align: center; color: var(--muted); }
.account-form { display: grid; gap: 14px; padding: 18px; margin-bottom: 17px; }
.account-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px; }
.account-form .filter-actions { justify-content: flex-start; }
.status-toggle { display: flex; align-items: center; align-self: end; gap: 8px; min-height: 42px; }
.password-form { max-width: 420px; }

.receipt-dialog {
  width: min(100% - 32px, 980px);
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 24px 90px #10291c45;
}
.receipt-dialog::backdrop { background: #122b2290; }
.compact-dialog { width: min(100% - 32px, 440px); }
.compact-dialog .account-form { margin: 0; }
.detail-header { display: flex; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.detail-header p { margin-top: 4px; color: var(--muted); }
.close-button { width: 42px; font-weight: 400; font-size: 25px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 280px); }
.image-panel { min-width: 0; padding: 12px; background: var(--canvas); }
.image-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-bottom: 8px; }
.image-controls .button { min-height: 34px; }
.image-controls output { width: 46px; color: var(--muted); text-align: center; font-size: 12px; }
.image-viewport { height: min(55vh, 560px); overflow: auto; background: #e9eee9; border: 1px solid var(--border); border-radius: 12px; position: relative; }
.image-frame { position: relative; margin-inline: auto; }
.image-frame img { position: absolute; top: 50%; left: 50%; object-fit: contain; }
.image-error { position: absolute; inset: 0; display: grid; place-items: center; padding: 14px; text-align: center; color: var(--muted); }
.document-preview { display: grid; justify-items: start; gap: 10px; padding: 6px; }
.document-preview iframe { width: 100%; height: min(55vh, 560px); background: white; border: 1px solid var(--border); border-radius: 10px; }
.document-preview p { margin: 20px 5px; color: var(--muted); }
.detail-side { min-width: 0; padding: 16px; }
.detail-info { display: grid; gap: 11px; margin: 0; }
.detail-info dt { color: var(--muted); font-size: 12px; }
.detail-info dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.detail-side form { margin-top: 16px; }
.detail-side form button { margin-top: 6px; }
#detail-message { margin-top: 12px; }
.detail-actions { display: flex; gap: 6px; margin-top: 7px; }
.detail-actions button { flex: 1; }
.print-view { display: none; }

@media (max-width: 1230px) {
  .filters { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
}
@media (max-width: 820px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; flex-direction: row; align-items: center; justify-content: space-between; height: auto; gap: 12px; padding: 10px 12px; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar > .brand-logo { width: clamp(108px, 29vw, 150px); margin: 0; }
  .sidebar nav { display: flex; flex-wrap: wrap; justify-content: end; }
  .nav-button { font-size: 12px; min-height: 42px; padding: 8px 10px; }
  .nav-icon, .side-link { display: none; }
  .topbar { min-height: 58px; }
  .main-content { padding-top: 18px; }
}
@media (max-width: 570px) {
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-actions { justify-content: end; }
  .filter-actions .button { padding-inline: 9px; }
  .account .avatar { display: none; }
  .breadcrumb { font-size: 12px; }
  .detail-grid { display: block; }
  .image-viewport { height: min(44vh, 380px); }
}
@media print {
  @page { size: A4; margin: 10mm; }
  html:has(.print-view.is-printing), body:has(.print-view.is-printing) { background: white; }
  body:has(.print-view.is-printing) > :not(.print-view) { display: none !important; }
  body:has(.print-view.is-printing) .receipt-dialog::backdrop { display: none !important; }
  .print-view.is-printing { display: block; color: #000; }
  .print-page { box-sizing: border-box; height: 266mm; overflow: hidden; break-inside: avoid; }
  .print-page:not(:last-child) { break-after: page; }
  .print-page h2 { margin: 0; line-height: 1.2; font-size: 12pt; }
  .print-page p { display: -webkit-box; margin: 0; overflow: hidden; overflow-wrap: anywhere; line-height: 1.3; font-size: 9pt; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .print-image { position: relative; width: 100%; height: 247mm; margin-top: 2mm; }
  .print-image img { position: absolute; left: 50%; top: 50%; width: 184mm; height: 247mm; object-fit: contain; }
  .print-image img[data-sideways="true"] { width: 247mm; height: 184mm; }
  .print-image img.print-slice { top: 0; left: 50%; width: 80mm; height: auto; transform: translateX(-50%); }
}
.nav-button { text-decoration: none; }
.nav-button .count { margin-inline-start: auto; }
.scope-form { display: grid; gap: 1rem; }
.scope-form label { display: flex; align-items: center; gap: .5rem; margin: .35rem 0; }
.scope-form fieldset { min-width: 0; margin: .6rem 0; border: 1px solid #d6dfe5; border-radius: .5rem; }
.institution-permissions { max-height: 8rem; overflow: auto; margin-inline-start: 1rem; }
