:root {
  color-scheme: light;
  --ink: #1e252b;
  --muted: #66717b;
  --line: #d7dde2;
  --bg: #f7f8f8;
  --panel: #ffffff;
  --accent: #286c6a;
  --accent-2: #8b4c31;
  --danger: #9d2f2f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
}
h1 { margin: 0; font-size: 21px; letter-spacing: 0; }
h2 { margin: 0 0 14px; font-size: 18px; letter-spacing: 0; }
main { max-width: 1180px; margin: 0 auto; padding: 24px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  padding: 9px 13px;
  cursor: pointer;
  font-weight: 650;
}
.nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.nav form { margin: 0; }
.nav button { padding: 7px 10px; background: #fff; color: var(--accent); }
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.metric, .panel, .auth {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 16px;
}
.metric span { display: block; color: var(--muted); font-size: 13px; }
.metric strong { display: block; font-size: 30px; margin-top: 4px; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th, td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.auth { max-width: 430px; margin: 44px auto; }
label { display: grid; gap: 6px; margin: 0 0 12px; color: var(--muted); font-weight: 650; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}
textarea { min-height: 96px; resize: vertical; }
.edit { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.edit label:nth-last-child(2), .edit label:nth-last-child(3) { grid-column: 1 / -1; }
.edit button { justify-self: start; }
.inline {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(140px, 1.2fr) auto;
  gap: 6px;
  align-items: center;
}
.inline input, .inline select, .inline button { padding: 7px 8px; }
.toolbar form { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; align-items: end; }
.kv { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--muted); font-weight: 700; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.tag {
  display: inline-block;
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f2ece8;
  color: var(--accent-2);
  font-weight: 700;
}
.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.asset-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.asset-card h3 { font-size: 15px; margin: 10px 0 4px; letter-spacing: 0; }
.asset-card p { margin: 4px 0; color: var(--muted); }
.thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f1f3f4;
}
.thumb.file {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}
.dropzone {
  grid-column: 1 / -1;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  padding: 18px;
  background: #f5fbfa;
}
.warn { color: var(--danger) !important; font-weight: 700; }
.gate-list { margin-top: 16px; }
.gate-pass, .gate-block {
  margin: 6px 0;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
}
.gate-pass { background: #f2faf6; color: #22623d; }
.gate-block { background: #fff6f6; color: var(--danger); }
.detail .panel { margin-bottom: 0; }
.checkgrid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 6px 12px;
  margin-bottom: 12px;
}
.checkgrid label {
  display: block;
  margin: 0;
  color: var(--ink);
  font-weight: 500;
}
.checkgrid input {
  width: auto;
  margin-right: 6px;
}
.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 600;
}
.checkline input {
  width: auto;
  min-width: 18px;
  min-height: 18px;
}
.notice {
  border: 1px solid var(--danger);
  color: var(--danger);
  background: #fff6f6;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 16px;
}
@media (max-width: 760px) {
  header { align-items: stretch; flex-direction: column; padding: 16px; }
  main { padding: 16px; }
  .nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .nav a, .nav button {
    display: block;
    width: 100%;
    min-height: 42px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    text-align: center;
  }
  .nav form { width: 100%; }
  .edit, .inline, .toolbar form, .kv { grid-template-columns: 1fr; }
  table, thead, tbody, tr, th, td { display: block; width: 100%; }
  thead, th { display: none; }
  tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    margin-bottom: 10px;
    padding: 8px;
  }
  td {
    border-bottom: 1px solid #eef1f3;
    padding: 8px 4px;
  }
  td:last-child { border-bottom: 0; }
}
