:root {
  color-scheme: light;
  --ink: #18201b;
  --muted: #667068;
  --paper: #ffffff;
  --background: #f4f5f1;
  --line: #d9ddd6;
  --olive: #4d5835;
  --olive-dark: #333d24;
  --olive-soft: #e8eadf;
  --blue: #245f91;
  --danger: #a23737;
  --shadow: 0 14px 40px rgba(31, 40, 31, 0.08);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--background); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--background);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.header-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand, .login-brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: white;
  background: var(--olive);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.brand strong, .brand small, .login-brand strong, .login-brand small { display: block; }
.brand small, .login-brand small { color: var(--muted); font-size: 12px; }
.main-nav { display: flex; align-items: center; gap: 22px; font-size: 14px; }
.main-nav a, .link-button { color: #3c453e; }
.main-nav form { margin: 0; }
.link-button { border: 0; padding: 0; background: none; cursor: pointer; }

.page-shell { max-width: 1160px; margin: 0 auto; padding: 42px 28px 70px; }
.hero-row, .page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 32px; }
.hero-row { margin-bottom: 28px; }
.page-heading { align-items: center; margin-bottom: 26px; }
h1, h2 { margin-top: 0; letter-spacing: -0.025em; }
h1 { margin-bottom: 10px; font-size: clamp(28px, 4vw, 42px); line-height: 1.1; }
h2 { font-size: 22px; }
.eyebrow { margin: 0 0 8px; color: var(--olive); font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.lead, .muted { color: var(--muted); }
.lead { max-width: 720px; margin: 0; font-size: 16px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; padding: 9px 13px; border-radius: 999px; background: var(--olive-soft); color: var(--olive-dark); font-size: 13px; font-weight: 700; }
.status-pill span { width: 8px; height: 8px; border-radius: 50%; background: #579148; }

.tab-list { display: flex; gap: 8px; margin-bottom: 16px; }
.tab-button { border: 1px solid var(--line); border-radius: 10px; padding: 11px 16px; background: var(--paper); color: var(--muted); cursor: pointer; font-weight: 700; }
.tab-button.active { border-color: var(--olive); color: white; background: var(--olive); }
.form-panel { display: none; }
.form-panel.active { display: block; }
.certificate-form { padding: 30px; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); }
.import-card { margin: 0 0 30px; padding: 22px; border: 1px solid #cdd4c5; border-radius: 13px; background: #f7f8f3; }
.import-heading-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.import-heading-row h2 { margin-bottom: 5px; font-size: 18px; }
.import-heading-row p { max-width: 760px; margin: 0; color: var(--muted); font-size: 13px; }
.optional-badge { flex: 0 0 auto; padding: 5px 9px; border-radius: 999px; color: var(--olive-dark); background: var(--olive-soft); font-size: 11px; font-weight: 800; }
.import-grid { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: 18px; margin-top: 18px; }
.import-actions { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.import-status { margin: 0; color: var(--muted); font-size: 13px; }
.import-status.success { color: #37632e; }
.import-status.error { color: var(--danger); }
.import-result { margin-top: 14px; padding: 12px 14px; border-radius: 9px; color: #465047; background: white; font-size: 13px; }
.import-result p { margin: 0; }
.import-result ul { margin: 7px 0 0; padding-left: 20px; }
.import-summary { font-weight: 800; }
fieldset { margin: 0; padding: 0 0 28px; border: 0; }
fieldset + fieldset { padding-top: 28px; border-top: 1px solid var(--line); }
legend { width: 100%; margin-bottom: 18px; padding: 0; font-size: 17px; font-weight: 800; }
legend span { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: 8px; border-radius: 8px; background: var(--olive-soft); color: var(--olive-dark); font-size: 13px; }
.form-grid { display: grid; gap: 18px; }
.two-columns { grid-template-columns: 1.35fr 0.65fr; }
.three-columns { grid-template-columns: 0.55fr 0.65fr 1fr; }
.full-row { grid-column: 1 / -1; }
.wide-field { min-width: 0; }
label { display: grid; gap: 7px; color: #39423b; font-size: 14px; font-weight: 700; }
label small { color: var(--muted); font-size: 12px; font-weight: 400; }
input, select, textarea { width: 100%; border: 1px solid #cbd1c9; border-radius: 9px; padding: 11px 12px; color: var(--ink); background: white; outline: none; transition: border-color 0.15s, box-shadow 0.15s; }
input[readonly] { color: #4a544c; background: #f2f4ef; }
textarea { resize: vertical; min-height: 72px; }
input:focus, select:focus, textarea:focus { border-color: var(--olive); box-shadow: 0 0 0 3px rgba(77, 88, 53, 0.14); }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; padding-top: 26px; border-top: 1px solid var(--line); }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; border-radius: 9px; padding: 10px 17px; cursor: pointer; font-weight: 800; text-decoration: none; }
.primary-button { border: 1px solid var(--olive); color: white; background: var(--olive); }
.primary-button:hover { background: var(--olive-dark); text-decoration: none; }
.secondary-button { border: 1px solid var(--line); color: var(--ink); background: white; }
.secondary-button:hover { border-color: #a8b0a6; text-decoration: none; }
.secondary-button:disabled { cursor: wait; opacity: 0.62; }
.full-width { width: 100%; }
.checkbox-field { display: flex; align-items: flex-start; gap: 11px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: #fafbf8; cursor: pointer; }
.checkbox-field input[type="checkbox"] { flex: 0 0 auto; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--olive); }
.checkbox-field span { display: grid; gap: 3px; }

.table-card { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 13px 15px; border-bottom: 1px solid #e5e8e3; text-align: left; vertical-align: middle; }
th { color: var(--muted); background: #f7f8f5; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.filename-cell { min-width: 280px; word-break: break-word; }
.wide-table { max-width: 100%; }
.empty-state, .error-card { padding: 56px 28px; border: 1px dashed #bec5bb; border-radius: 16px; text-align: center; background: white; }
.empty-state p { margin-bottom: 0; color: var(--muted); }
.error-card { max-width: 620px; margin: 70px auto; border-style: solid; box-shadow: var(--shadow); }
.error-card p { margin-bottom: 26px; color: var(--muted); }
.error-symbol { display: grid; place-items: center; width: 50px; height: 50px; margin: 0 auto 18px; border-radius: 50%; color: white; background: var(--danger); font-size: 26px; font-weight: 800; }
.notice { margin-bottom: 20px; padding: 12px 14px; border-radius: 9px; }
.notice-error { color: #7d2929; background: #faeaea; }
.notice-info { color: #325b78; background: #e7f0f7; }

.login-page { display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top, #e8eadf 0, var(--background) 48%); }
.login-card { width: min(420px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 18px; background: white; box-shadow: var(--shadow); }
.login-brand { margin-bottom: 34px; }
.login-card h1 { font-size: 30px; }
.stacked-form { display: grid; gap: 18px; margin-top: 26px; }

@media (max-width: 760px) {
  .header-inner, .hero-row, .page-heading { align-items: stretch; flex-direction: column; }
  .main-nav { width: 100%; gap: 14px; overflow-x: auto; }
  .page-shell { padding: 28px 16px 50px; }
  .certificate-form { padding: 20px; border-radius: 13px; }
  .two-columns, .three-columns, .import-grid { grid-template-columns: 1fr; }
  .import-heading-row, .import-actions { align-items: stretch; flex-direction: column; }
  .tab-list { align-items: stretch; flex-direction: column; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .primary-button, .secondary-button { width: 100%; }
}
