:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --text: #1e2930;
  --muted: #60717b;
  --border: #d8e0e3;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --info: #2563eb;
  --warn: #b45309;
  --danger: #b42318;
  --ok: #157f3b;
  --shadow: 0 10px 28px rgba(28, 43, 51, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
  line-height: 1.3;
}

button,
input,
select,
textarea {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 11px;
  background: #fff;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--accent);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  color: #3a4c55;
  background: #f0f4f5;
  font-size: 12px;
  text-transform: uppercase;
}

code {
  white-space: normal;
  color: #30434c;
}

.public-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-shell {
  width: min(430px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.auth-panel {
  padding: 34px;
}

.brand-line {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-line small {
  display: block;
  color: var(--muted);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 7px;
  background: var(--accent);
  color: white;
  display: inline-grid;
  place-items: center;
  font-weight: 800;
}

.form-stack {
  display: grid;
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.wide,
.module-box,
.form-actions {
  grid-column: 1 / -1;
}

.module-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.module-box legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 6px 18px 6px 0;
  color: var(--text);
  font-weight: 500;
}

.check-row input {
  width: 16px;
  height: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
  border-color: #9fb1b8;
}

.btn.primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.btn.primary:hover {
  background: var(--accent-strong);
}

.btn.small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  background: #ffffff;
  border-right: 1px solid var(--border);
  padding: 22px;
  display: flex;
  flex-direction: column;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-list a {
  color: #2c3e46;
  padding: 10px 11px;
  border-radius: 6px;
  font-weight: 700;
}

.nav-list a.active,
.nav-list a:hover {
  background: #e8f2f0;
  color: var(--accent-strong);
  text-decoration: none;
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.logout-form {
  margin-top: 8px;
}

.logout-form button {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  padding: 0;
  cursor: pointer;
  font-weight: 700;
}

.logout-form button:hover {
  text-decoration: underline;
}

.main {
  padding: 26px;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.topbar h1 {
  margin-bottom: 4px;
}

.topbar p,
.muted {
  color: var(--muted);
}

.metric-grid,
.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.status-grid article,
.panel,
.form-panel,
.session-header,
.focus-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.focus-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  margin-bottom: 18px;
  border-left: 5px solid var(--accent);
}

.focus-panel h2 {
  margin-bottom: 6px;
}

.focus-panel p {
  margin-bottom: 0;
  color: var(--muted);
}

.metric-card,
.status-grid article {
  padding: 16px;
}

.metric-card span,
.status-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-card strong,
.status-grid strong {
  display: block;
  margin: 6px 0;
  font-size: 28px;
  line-height: 1;
}

.metric-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.panel,
.form-panel,
.session-header {
  padding: 18px;
  margin-bottom: 18px;
}

.panel-head,
.session-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.panel-head h2,
.session-header h2 {
  margin-bottom: 4px;
}

.workflow-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.workflow-step {
  min-height: 58px;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  background: #fbfcfc;
  color: #30434c;
  font-weight: 700;
}

.security-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.security-strip div {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 13px;
  background: #fbfcfc;
}

.security-strip strong,
.security-strip span {
  display: block;
}

.security-strip strong {
  margin-bottom: 4px;
}

.security-strip span {
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  border: 1px dashed #aab8be;
  border-radius: 6px;
  padding: 16px;
  background: #fbfcfc;
}

.empty-state p {
  color: var(--muted);
}

.progress-list,
.security-list,
.upload-grid {
  display: grid;
  gap: 12px;
}

.progress-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.progress-item,
.security-list article,
.upload-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fbfcfc;
  padding: 13px;
}

.progress-item {
  border-left: 5px solid #aab8be;
}

.progress-item.done {
  border-left-color: var(--ok);
}

.progress-item p,
.security-list p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.upload-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.upload-card {
  display: grid;
  gap: 10px;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #eaf1f7;
  color: #284b63;
  font-size: 12px;
  font-weight: 800;
}

.status.large {
  min-height: 32px;
  font-size: 13px;
}

.flash {
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  background: #fff;
}

.flash.success {
  border-color: #a8d5ba;
  background: #edf8f1;
  color: #185b31;
}

.flash.error {
  border-color: #f0b7b0;
  background: #fff1ef;
  color: var(--danger);
}

.empty {
  margin-bottom: 0;
  color: var(--muted);
}

.plain-list {
  margin-bottom: 0;
  padding-left: 20px;
}

.plain-list li + li {
  margin-top: 8px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .progress-list,
  .metric-grid,
  .status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .public-page,
  .main,
  .sidebar {
    padding: 16px;
  }

  .form-grid,
  .upload-grid,
  .progress-list,
  .metric-grid,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-head,
  .session-header,
  .focus-panel {
    display: grid;
  }

  .security-strip {
    grid-template-columns: 1fr;
  }

  .nav-list {
    grid-template-columns: 1fr 1fr;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}
