:root {
  color-scheme: light;
  --ink: #13231f;
  --muted: #67736f;
  --paper: #f4f3ee;
  --card: #fffefa;
  --line: #dedfd8;
  --green: #134e3a;
  --green-2: #1d6b4d;
  --lime: #d9f06f;
  --red: #9e382d;
  --amber: #8a5c0a;
  --shadow: 0 18px 48px rgba(19, 35, 31, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; color: var(--ink); background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.eyebrow { margin: 0 0 10px; font-size: .72rem; font-weight: 800; letter-spacing: .16em; color: var(--green-2); }
.muted { color: var(--muted); }

.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(380px, .75fr); }
.login-brand { position: relative; display: flex; flex-direction: column; justify-content: center; overflow: hidden; padding: clamp(40px, 7vw, 110px); color: #f9f7ed; background: var(--green); }
.login-brand::after { content: ""; position: absolute; width: 540px; height: 540px; right: -160px; bottom: -210px; border: 1px solid rgba(217, 240, 111, .35); border-radius: 50%; box-shadow: 0 0 0 80px rgba(217,240,111,.04), 0 0 0 160px rgba(217,240,111,.035); }
.login-brand .eyebrow { color: var(--lime); margin-top: 42px; }
.brand-mark { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px 16px 16px 4px; color: var(--green); background: var(--lime); font-weight: 900; font-size: 1.45rem; }
.brand-mark.small { width: 38px; height: 38px; border-radius: 12px 12px 12px 3px; font-size: 1rem; }
.login-brand h1 { position: relative; z-index: 1; max-width: 760px; margin: 0; font-family: Georgia, Cambria, serif; font-size: clamp(2.6rem, 5vw, 5.4rem); line-height: .98; font-weight: 500; letter-spacing: -.045em; }
.brand-copy { position: relative; z-index: 1; max-width: 590px; margin: 30px 0 56px; color: #c9d6cf; font-size: 1.1rem; line-height: 1.6; }
.workflow { position: relative; z-index: 1; display: flex; align-items: center; gap: 16px; max-width: 560px; color: #e7ecdf; font-size: .75rem; font-weight: 750; letter-spacing: .08em; }
.workflow i { height: 1px; flex: 1; background: rgba(231, 236, 223, .35); }
.login-panel { display: grid; place-items: center; padding: 42px; background: #e9e9e2; }
.login-card { width: min(100%, 420px); padding: 42px; border: 1px solid rgba(19,35,31,.08); border-radius: 24px; background: var(--card); box-shadow: var(--shadow); }
.login-card h2, .dialog-card h2 { margin: 0; font-family: Georgia, Cambria, serif; font-size: 2rem; font-weight: 500; letter-spacing: -.02em; }
.login-card > .muted { margin: 10px 0 28px; }
label, legend { display: block; margin: 18px 0 8px; font-size: .82rem; font-weight: 750; }
input, select, textarea { width: 100%; border: 1px solid #cdd1ca; border-radius: 11px; padding: 12px 14px; color: var(--ink); background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(29,107,77,.12); }
input[type=file] { padding: 10px; background: #f8f8f4; }
.primary, .quiet { border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 750; }
.primary { color: #fff; background: var(--green); box-shadow: 0 6px 16px rgba(19,78,58,.15); }
.primary:hover { background: var(--green-2); }
.quiet { color: var(--ink); background: #ecece6; }
.quiet:hover { background: #e0e2db; }
.wide { width: 100%; margin-top: 24px; padding: 13px; }
.form-error { margin: 14px 0 0; color: var(--red); font-size: .88rem; font-weight: 650; }

.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(18px, 4vw, 60px); border-bottom: 1px solid var(--line); background: rgba(255,254,250,.92); backdrop-filter: blur(12px); }
.wordmark { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-family: Georgia, Cambria, serif; font-size: 1.15rem; font-weight: 700; }
.account { display: flex; align-items: center; gap: 18px; }
.account div { display: flex; flex-direction: column; text-align: right; }
.account strong { font-size: .9rem; }
.account span { color: var(--muted); font-size: .72rem; text-transform: capitalize; }
.workspace { width: min(100% - 36px, 1500px); margin: 0 auto; padding: 52px 0 80px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 22px; }
.page-heading h1 { margin: 0; font-family: Georgia, Cambria, serif; font-size: clamp(2.25rem, 5vw, 4rem); font-weight: 500; letter-spacing: -.045em; }
.page-heading .muted { margin: 9px 0 0; }
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 34px 0 18px; }
.summary-grid article { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,254,250,.75); }
.summary-grid span { color: var(--muted); font-size: .82rem; font-weight: 700; }
.summary-grid strong { font-family: Georgia, Cambria, serif; font-size: 1.8rem; font-weight: 500; }
.table-card { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--card); box-shadow: 0 12px 32px rgba(19,35,31,.06); }
.table-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.table-toolbar h2 { margin: 0; font-size: 1rem; }
.table-toolbar p { margin: 5px 0 0; font-size: .82rem; }
.table-wrap { overflow-x: auto; }
.mobile-cards { display: none; }
table { width: 100%; border-collapse: collapse; min-width: 1200px; }
th { padding: 12px 14px; color: var(--muted); background: #f3f3ee; font-size: .68rem; text-align: left; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
td { padding: 16px 14px; border-top: 1px solid #e9e9e3; vertical-align: top; font-size: .82rem; }
tbody tr:hover { background: #fbfbf7; }
.serial { font-family: Georgia, Cambria, serif; font-size: 1.05rem; }
.date { min-width: 110px; color: var(--muted); line-height: 1.4; }
.file-name { display: block; max-width: 180px; margin-bottom: 8px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
audio { width: 190px; height: 32px; }
video { display: block; width: 230px; aspect-ratio: 16 / 9; border-radius: 9px; background: #07110e; }
.tag, .status { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; white-space: nowrap; font-size: .7rem; font-weight: 800; }
.tag { color: #355046; background: #edf0eb; }
.status::before { content: ""; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: currentColor; }
.status-pending, .status-recheck { color: var(--amber); background: #fff3ce; }
.status-fine { color: var(--green-2); background: #dff3e8; }
.status-not-fine { color: var(--red); background: #f9dfdc; }
.remark { max-width: 220px; color: #46534e; line-height: 1.5; white-space: pre-wrap; }
.no-remark { color: #98a19d; }
.row-actions { display: flex; flex-direction: column; align-items: stretch; gap: 7px; min-width: 150px; }
.row-actions button { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; color: var(--ink); background: #fff; font-weight: 700; font-size: .75rem; white-space: nowrap; }
.row-actions button:hover { border-color: #9ba69f; background: #f5f6f1; }
.row-actions .review-action { color: #fff; border-color: var(--green); background: var(--green); }
.empty-state { padding: 68px 20px; text-align: center; }
.empty-state div { display: grid; place-items: center; width: 50px; height: 50px; margin: 0 auto 16px; border-radius: 50%; color: var(--green); background: var(--lime); }
.empty-state h3 { margin: 0 0 8px; }
.empty-state p { margin: 0; color: var(--muted); }
.submission-card { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 8px 22px rgba(19,35,31,.06); }
.submission-card-header { display: flex; align-items: start; justify-content: space-between; gap: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.submission-card h3 { margin: 2px 0 0; font-family: Georgia, Cambria, serif; font-size: 1.55rem; font-weight: 500; }
.card-label { display: block; margin-bottom: 4px; color: var(--muted); font-size: .65rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.card-date { padding: 13px 0; }
.card-date strong { font-size: .82rem; }
.card-media-grid { display: grid; gap: 15px; }
.card-media { min-width: 0; }
.card-filename { display: block; margin-bottom: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
.card-media audio, .card-media video { width: 100%; }
.card-media audio { height: 38px; }
.card-details { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; padding: 14px; border-radius: 10px; background: #f3f3ee; }
.card-details strong { font-size: .8rem; }
.card-remark { margin-top: 14px; }
.card-remark p { margin: 0; line-height: 1.5; white-space: pre-wrap; font-size: .82rem; }
.card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.card-actions button { min-height: 42px; border: 1px solid var(--line); border-radius: 9px; padding: 9px; color: var(--ink); background: #fff; font-size: .78rem; font-weight: 750; }
.card-actions .review-action { color: #fff; border-color: var(--green); background: var(--green); }

dialog { width: min(94vw, 580px); max-height: 90vh; padding: 0; border: 0; border-radius: 20px; color: var(--ink); background: var(--card); box-shadow: 0 24px 80px rgba(0,0,0,.28); }
dialog::backdrop { background: rgba(5,20,15,.58); backdrop-filter: blur(3px); }
.dialog-card { padding: 28px; }
.dialog-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.icon-button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; color: var(--ink); background: #edeee8; font-size: 1.35rem; }
.field-help { margin: 6px 0 0; color: var(--muted); font-size: .75rem; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 26px; }
#reviewPlayer { width: 100%; margin-bottom: 20px; }
fieldset { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0; border: 0; }
legend { grid-column: 1 / -1; }
.choice { display: flex; align-items: center; gap: 9px; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.choice input { width: auto; margin: 0; }
.choice span { display: flex; flex-direction: column; }
.choice small { margin-top: 2px; color: var(--muted); font-weight: 500; }
.remark-callout { padding: 14px; border-left: 3px solid var(--amber); border-radius: 8px; color: #584824; background: #fff6dc; line-height: 1.5; white-space: pre-wrap; }
.history-dialog { width: min(94vw, 760px); }
.history-list { display: grid; gap: 14px; max-height: 65vh; overflow-y: auto; }
.history-item { display: grid; grid-template-columns: 240px 1fr; gap: 18px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.history-item video { width: 100%; }
.history-meta { display: flex; flex-direction: column; align-items: start; gap: 8px; }
.history-meta h3 { margin: 0; }
.history-meta p { margin: 0; color: var(--muted); font-size: .8rem; line-height: 1.45; }
.history-meta .history-remark { color: var(--ink); white-space: pre-wrap; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 10; max-width: 380px; padding: 13px 18px; border-radius: 10px; color: #fff; background: var(--green); box-shadow: var(--shadow); font-weight: 700; }

@media (max-width: 820px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-brand { min-height: 46vh; padding: 40px 26px; }
  .login-brand h1 { font-size: clamp(2.5rem, 12vw, 4rem); }
  .login-brand .eyebrow { margin-top: 28px; }
  .brand-copy { margin: 20px 0 28px; }
  .workflow { display: none; }
  .login-panel { padding: 28px 18px 48px; }
  .login-card { padding: 28px; }
  .account div { display: none; }
  .workspace { width: min(100% - 24px, 1500px); padding-top: 34px; }
  .page-heading { align-items: start; flex-direction: column; }
  .page-heading .primary { width: 100%; }
  .summary-grid { grid-template-columns: 1fr 1fr 1fr; }
  .summary-grid article { flex-direction: column; align-items: start; padding: 14px; }
  .table-toolbar { padding: 18px; }
  .table-wrap { display: none !important; }
  .mobile-cards { display: grid; gap: 12px; padding: 12px; }
  .history-item { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .summary-grid { gap: 7px; }
  .summary-grid span { font-size: .68rem; }
  .summary-grid strong { font-size: 1.45rem; }
  .dialog-card { padding: 20px; }
  fieldset { grid-template-columns: 1fr; }
  .dialog-actions { flex-direction: column-reverse; }
  .dialog-actions button { width: 100%; }
  .card-actions { grid-template-columns: 1fr; }
}
