:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --ink: #172026;
  --muted: #64707d;
  --line: #d9dee5;
  --panel: #ffffff;
  --accent: #0d7a74;
  --accent-2: #8f4a22;
  --danger: #b3261e;
  --ok: #20744a;
  --warn: #9a6700;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
.topbar {
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(16px, 5vw, 56px);
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}
h1 { margin: 0; font-size: clamp(28px, 4vw, 42px); letter-spacing: 0; }
p { margin: 6px 0 0; color: var(--muted); }
main { padding: 18px clamp(16px, 5vw, 56px) 48px; }
.user-panel {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}
.user-panel div { display: grid; gap: 2px; text-align: right; }
.user-panel span { color: var(--muted); font-size: 13px; }
select, input, textarea, button {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}
select, input, textarea { padding: 10px 11px; width: 100%; }
textarea { resize: vertical; min-height: 72px; }
button {
  padding: 10px 13px;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  cursor: pointer;
}
button.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
button.compact { padding: 6px 9px; font-size: 13px; }
button.danger-btn { color: var(--danger); border-color: #efb5b1; }
button:disabled { opacity: .45; cursor: not-allowed; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tab { background: #fff; color: var(--ink); border-color: var(--line); }
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.grid { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 16px; align-items: start; }
.panel, .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.panel { padding: 16px; }
.panel h2 { margin: 0 0 14px; font-size: 18px; }
.form { display: grid; gap: 10px; }
.form label { display: grid; gap: 5px; color: var(--muted); font-size: 13px; }
.list { display: grid; gap: 10px; }
.card { padding: 14px; display: grid; gap: 9px; }
.card.clickable { cursor: pointer; }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.title { font-weight: 700; }
.meta { color: var(--muted); font-size: 13px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { border-radius: 999px; padding: 3px 8px; background: #edf3f2; color: #145b57; font-size: 12px; }
.badge.warn { background: #fff3cd; color: var(--warn); }
.badge.danger { background: #fde8e7; color: var(--danger); }
.badge.ok { background: #e7f4ed; color: var(--ok); }
.toolbar { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 10px; margin-bottom: 12px; }
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); background: #f9fafb; font-weight: 600; }
tr:last-child td { border-bottom: 0; }
.empty { padding: 28px; text-align: center; color: var(--muted); background: #fff; border: 1px dashed var(--line); border-radius: 8px; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.kpi { display: grid; gap: 4px; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.kpi strong { font-size: 24px; }
.restricted { border-left: 4px solid var(--accent-2); padding-left: 12px; color: var(--muted); }
.detail-page { display: grid; gap: 14px; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.detail-grid div { display: grid; gap: 3px; }
.detail-grid strong { font-size: 12px; color: var(--muted); }
.toast {
  position: sticky;
  top: 12px;
  z-index: 20;
  margin-bottom: 12px;
  padding: 12px 14px;
  background: #e7f4ed;
  color: var(--ok);
  border: 1px solid #b7dec9;
  border-radius: 8px;
}
.selected-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #edf3f2;
  color: #145b57;
  font-size: 13px;
}
.pill button {
  padding: 0 5px;
  min-width: 22px;
  min-height: 22px;
  border-radius: 999px;
}
.progress {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e8ecef;
  overflow: hidden;
}
.progress span { display: block; height: 100%; background: var(--accent); }
.progress.small { height: 7px; min-width: 90px; }
.asset-photo {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.thumb-photo {
  max-width: 100px;
  max-height: 100px;
  width: auto;
  height: auto;
}
.detail-photo {
  max-width: 320px;
  max-height: 240px;
  width: auto;
  height: auto;
}
.asset-detail-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
}
.attachments { display: flex; flex-wrap: wrap; gap: 6px; }
.attachments a {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--accent);
  text-decoration: none;
  background: #fff;
  font-size: 13px;
}
.attachment-grid, .component-list, .component-detail { display: grid; gap: 10px; }
.attachment-thumb,
.attachments a.attachment-thumb {
  display: inline-grid;
  gap: 6px;
  justify-items: start;
  align-items: start;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  padding: 0;
  border: 0;
  background: transparent;
}
.attachment-thumb img,
.attachment-thumb video {
  max-width: 100px;
  max-height: 100px;
  width: auto;
  height: auto;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.attachment-doc {
  color: var(--accent);
  text-decoration: none;
}
.component-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
  text-align: left;
}
.directory-list { display: grid; gap: 8px; }
.directory-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.directory-row > div:first-child { display: grid; gap: 2px; }
.color-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 7px;
  border-radius: 999px;
  vertical-align: middle;
}
.asset-attachment {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.compact-list { gap: 8px; }
.inline-form {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(160px, 1.4fr) auto;
  gap: 8px;
  align-items: center;
}
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.auth-shell {
  width: min(100%, 460px);
  padding: 24px;
}
.login-panel {
  display: grid;
  gap: 22px;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 44px rgba(23, 32, 38, .08);
}
.auth-error {
  padding: 10px 12px;
  border: 1px solid #efb5b1;
  border-radius: 7px;
  background: #fde8e7;
  color: var(--danger);
}
@media (max-width: 860px) {
  .topbar { align-items: stretch; flex-direction: column; }
  .user-panel { justify-content: space-between; }
  .user-panel div { text-align: left; }
  .grid, .split, .toolbar { grid-template-columns: 1fr; }
  .inline-form { grid-template-columns: 1fr; }
  .asset-detail-head { grid-template-columns: 1fr; }
  .directory-row { align-items: stretch; flex-direction: column; }
  .thumb-photo, .attachment-thumb img, .attachment-thumb video {
    max-width: 84px;
    max-height: 84px;
  }
}
