:root {
  /* Palette aligned to lamplan.com (YOOtheme): reds + neutral greys. */
  --bg: #f5f5f5;
  --panel: #ffffff;
  --panel2: #f0f0f0;
  --text: #403f3f;
  --muted: #727272;
  --border: rgba(64, 63, 63, 0.14);
  --border2: rgba(64, 63, 63, 0.22);
  --accent: #d20a11;
  --accent2: #ba090f;
  --ok: #366341;
  --warn: #dea912;
  --bad: #d20a11;
  --radius: 8px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  background: radial-gradient(1200px 700px at 12% 8%, rgba(210, 10, 17, 0.10), transparent 52%),
              radial-gradient(900px 600px at 92% 24%, rgba(64, 63, 63, 0.08), transparent 55%),
              var(--bg);
  color: var(--text);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 18px;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}
.brand__title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0;
}
.brand__subtitle {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}
.brand__version {
  opacity: 0.7;
}
.status {
  font-size: 12px;
  color: var(--muted);
  min-height: 16px;
  text-align: right;
}
.status--ok { color: var(--ok); }
.status--bad { color: var(--bad); }
.topbar__actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.layout {
  max-width: 1600px;
  margin: 0 auto;
  padding: 18px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.workspace {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 14px;
  align-items: start;
}

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

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 140px;
}
.panel__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.70);
}
.panel__title {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: uppercase;
  color: rgba(64, 63, 63, 0.88);
}
.panel__meta {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}

.panel--filters { padding: 14px 16px; }
.filters-row {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.filters-row .field {
  flex: 1 1 200px;
  min-width: 180px;
  margin-bottom: 0;
}
.filters-row .actions { flex: 0 0 auto; }
.field { display: block; margin-bottom: 12px; }
.field__label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.field--inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}
.field--inline .field__label { margin-bottom: 0; white-space: nowrap; }
.field--inline .field__input { padding: 6px 8px; font-size: 12px; }
.field__input {
  width: 100%;
  padding: 10px 10px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  outline: none;
}
.field__input:focus {
  border-color: rgba(210, 10, 17, 0.55);
  box-shadow: 0 0 0 3px rgba(210, 10, 17, 0.12);
}

.actions { display: flex; gap: 10px; }
.btn {
  border: 1px solid var(--border2);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
.btn--primary {
  border-color: rgba(210, 10, 17, 0.55);
  background: linear-gradient(90deg, rgba(186, 9, 15, 0.95) 0%, rgba(210, 10, 17, 0.95) 100%);
  color: #fff;
}
.btn--ghost {
  padding: 7px 10px;
  background: transparent;
  color: var(--muted);
}
.btn--ghost:hover {
  border-color: rgba(210, 10, 17, 0.40);
  color: var(--accent);
}
.btn:disabled { opacity: 0.55; cursor: default; }

.hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.list-controls {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.55);
}

.list {
  max-height: calc(100vh - 260px);
  overflow: auto;
}

.empty {
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
}

.study-item {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.study-item:hover { background: rgba(210, 10, 17, 0.05); }
.study-item[aria-selected="true"] { background: rgba(210, 10, 17, 0.08); }
.study-item__top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}
.study-ref {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 13px;
}
.study-date { font-size: 12px; color: var(--muted); }
.study-customer { margin-top: 4px; font-size: 12px; color: rgba(64, 63, 63, 0.82); }
.study-created { margin-top: 2px; font-size: 11px; color: var(--muted); }
.chips { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  color: rgba(64, 63, 63, 0.92);
}
.chip--on { border-color: rgba(210, 10, 17, 0.40); background: rgba(210, 10, 17, 0.08); }
.chip--off { opacity: 0.55; }

.detail {
  padding: 14px;
  max-height: calc(100vh - 260px);
  overflow: auto;
}
.detail h3 {
  margin: 0 0 8px 0;
  font-size: 14px;
}
.detail .subtle { color: var(--muted); font-size: 12px; }

.study-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 10px;
}
.study-header__ref {
  font-family: var(--mono);
  font-weight: 800;
  font-size: 16px;
}
.study-header__meta { color: var(--muted); font-size: 12px; }
.study-header__comment {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text);
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.section { margin-top: 14px; }
.subsection {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  overflow: hidden;
}
.subsection__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.80);
}
.subsection__title {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  color: rgba(64, 63, 63, 0.86);
  letter-spacing: 0;
}
.subsection__meta {
  font-size: 12px;
  color: var(--muted);
}
.subsection .empty { padding: 12px; }

.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin: 14px 0 12px 0;
}
.tab {
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab--active {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--border);
  border-bottom: 1px solid rgba(255, 255, 255, 0.85);
}
.tab__count {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(64, 63, 63, 0.10);
  color: var(--muted);
}
.tab--active .tab__count {
  background: rgba(210, 10, 17, 0.12);
  color: var(--accent);
}

.table-wrap {
  overflow: auto;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 980px;
}
.table-comment {
  max-width: 260px;
  overflow-wrap: anywhere;
}
.table-comment .subtle { margin-top: 4px; }
.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--border);
  padding: 10px 10px;
  color: rgba(64, 63, 63, 0.86);
  font-weight: 700;
}
.table tbody td {
  border-bottom: 1px solid rgba(64, 63, 63, 0.10);
  padding: 10px 10px;
  color: var(--text);
  vertical-align: top;
}
.table tbody tr:hover td {
  background: rgba(210, 10, 17, 0.04);
}
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
}

.card {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}
.card__title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 8px;
}
.card__title .ref { font-family: var(--mono); font-weight: 700; }
.card__title .kind { font-size: 12px; color: rgba(64, 63, 63, 0.78); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 10px; font-size: 12px; }
.kv .k { color: var(--muted); }
.kv .v { color: var(--text); overflow-wrap: anywhere; }

.badge {
  font-size: 11px;
  border-radius: 999px;
  padding: 3px 8px;
  border: 1px solid var(--border2);
  color: rgba(64, 63, 63, 0.92);
}
.badge--met { border-color: rgba(210, 10, 17, 0.40); background: rgba(210, 10, 17, 0.08); }
.badge--ind { border-color: rgba(64, 63, 63, 0.28); background: rgba(64, 63, 63, 0.06); }

.files__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.file-thumb {
  display: block;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.6);
}
.file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  text-decoration: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-link:hover {
  border-color: rgba(210, 10, 17, 0.40);
  color: var(--accent);
}
.file-link__icon {
  flex: 0 0 auto;
}

.files__grid--compact { gap: 6px; }
.files__grid--compact .file-thumb { width: 40px; height: 40px; border-radius: 6px; }

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.login-panel {
  width: min(420px, 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  padding: 24px;
}
.login-brand {
  margin-bottom: 22px;
}
.login-form {
  display: grid;
  gap: 4px;
}
.login-error {
  color: var(--bad);
  font-size: 12px;
  margin: 0 0 8px 0;
}
.login-submit {
  width: 100%;
  margin-top: 4px;
}
