:root {
  --bg: #f3f6f8;
  --panel: #ffffff;
  --panel-2: #eef4f7;
  --text: #102033;
  --muted: #637083;
  --line: #d8e0e8;
  --brand: #155e75;
  --brand-2: #2563eb;
  --accent: #14b8a6;
  --danger: #b42318;
  --warning: #b45309;
  --ok: #15803d;
  --shadow: 0 18px 55px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: var(--brand-2);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px 1fr;
}

.sidebar {
  background: #0f2533;
  color: #e8f3f6;
  padding: 28px 22px;
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), #60a5fa);
  color: #06222e;
  font-weight: 800;
}

.brand strong {
  display: block;
  font-size: 1.05rem;
}

.brand span {
  color: #9db6c1;
  font-size: 0.88rem;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav a {
  color: #dcebf0;
  padding: 11px 12px;
  border-radius: 8px;
}

.nav a.active,
.nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}

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

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

h1,
h2,
h3 {
  letter-spacing: 0;
  line-height: 1.16;
  margin: 0;
}

h1 {
  font-size: clamp(1.7rem, 3vw, 2.55rem);
}

h2 {
  font-size: 1.35rem;
  margin-bottom: 14px;
}

h3 {
  font-size: 1rem;
  margin-bottom: 10px;
}

.lead {
  color: var(--muted);
  margin: 7px 0 0;
  max-width: 760px;
}

.grid {
  display: grid;
  gap: 18px;
}

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

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

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.metric {
  display: grid;
  gap: 6px;
}

.metric span {
  color: var(--muted);
  font-size: 0.9rem;
}

.metric strong {
  font-size: 2rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.button,
button,
input[type="submit"] {
  appearance: none;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 15px;
  font-size: 0.95rem;
  font-weight: 700;
}

.button.secondary,
button.secondary {
  background: #e2e8f0;
  color: var(--text);
}

.button.danger {
  background: var(--danger);
}

.button:hover,
button:hover {
  text-decoration: none;
  filter: brightness(0.96);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

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

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.status {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.82rem;
  font-weight: 700;
  background: #e2e8f0;
}

.status.ok {
  background: #dcfce7;
  color: var(--ok);
}

.status.warn {
  background: #fef3c7;
  color: var(--warning);
}

.status.danger {
  background: #fee2e2;
  color: var(--danger);
}

form {
  display: grid;
  gap: 15px;
}

.field {
  display: grid;
  gap: 6px;
}

label {
  color: #334155;
  font-size: 0.92rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

textarea {
  min-height: 140px;
  resize: vertical;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  border: 1px solid var(--line);
  padding: 10px;
  border-radius: 8px;
  background: #fbfdff;
}

.check-grid label {
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 600;
}

.check-grid input {
  width: auto;
  min-height: 0;
}

.notice {
  border-left: 4px solid var(--brand-2);
  background: #eff6ff;
  padding: 12px 14px;
  border-radius: 8px;
  color: #1e3a8a;
}

.notice.error {
  border-left-color: var(--danger);
  background: #fff1f2;
  color: #9f1239;
}

.public-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 26px;
  background:
    linear-gradient(135deg, rgba(20, 184, 166, 0.16), transparent 34%),
    linear-gradient(315deg, rgba(37, 99, 235, 0.14), transparent 38%),
    var(--bg);
}

.public-card {
  width: min(980px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.item-content {
  white-space: pre-wrap;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.inline-images {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.inline-images figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.inline-images img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  background: #f8fafc;
}

.inline-images figcaption {
  padding: 9px 12px;
  color: var(--muted);
  font-size: 0.88rem;
  border-top: 1px solid var(--line);
}

.signature-box {
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  height: 190px;
  background: #fff;
  touch-action: none;
}

.signature-box canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.chart {
  width: 100%;
  height: 300px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.progress {
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand-2), var(--accent));
}

.muted {
  color: var(--muted);
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(21, 94, 117, 0.94), rgba(15, 37, 51, 0.98)),
    var(--bg);
}

.login .card {
  width: min(440px, 100%);
}

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

  .sidebar {
    position: static;
    padding: 18px;
  }

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

  .main {
    padding: 20px;
  }

  .topbar {
    display: grid;
  }

  .grid.cols-2,
  .grid.cols-3 {
    grid-template-columns: 1fr;
  }

  .public-card {
    padding: 18px;
  }
}
