﻿:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1d232b;
  --muted: #667085;
  --line: #d9dee7;
  --primary: #f58220;
  --primary-dark: #c76512;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --ok-bg: #effaf3;
  --ok: #067647;
  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(--text);
}

button, input, textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: white;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

button:hover { background: var(--primary-dark); }
button:disabled { cursor: not-allowed; opacity: 0.55; }

button.ghost {
  background: transparent;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.7);
}

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

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

button.icon-button {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.65);
}

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: white;
  color: var(--text);
}

textarea { min-height: 92px; resize: vertical; }
label { display: grid; gap: 6px; color: var(--muted); font-weight: 650; }

h1, h2, h3 { margin: 0; }
p { margin: 0; color: var(--muted); }

.topbar {
  height: 72px;
  background: var(--primary);
  color: white;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar h1 { font-size: 24px; line-height: 1; }
.topbar p { color: rgba(255, 255, 255, 0.85); margin-top: 6px; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tenant-switcher {
  background: transparent;
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 6px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

.tenant-switcher option {
  background: #1d232b;
  color: white;
}

.version-pill {
  display: inline-flex;
  margin-left: 8px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.86);
  vertical-align: middle;
}

.shell { padding: 24px; }

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.sidebar, .content, .stack { display: grid; gap: 16px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.narrow { max-width: 520px; margin: 48px auto; }
.empty { min-height: 280px; display: grid; align-content: center; justify-items: center; gap: 8px; }
.hidden { display: none !important; }
.error { color: var(--danger); margin-top: 12px; }
.status { border-radius: 6px; padding: 12px 14px; border: 1px solid var(--line); background: white; }
.status.error { color: var(--danger); background: var(--danger-bg); border-color: #f3b9b4; }
.status.ok { color: var(--ok); background: var(--ok-bg); border-color: #b7e6c7; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
button.compact { padding: 7px 10px; font-size: 13px; }
.tag-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.role-pill { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; color: var(--muted); font-size: 13px; font-weight: 700; }
.tag-list { display: grid; gap: 8px; max-height: min(56vh, 640px); overflow: auto; padding-right: 2px; }
.tag-list p { padding: 6px 0; }
.tag-list-item {
  display: grid;
  gap: 3px;
  width: 100%;
  text-align: left;
  background: #f8fafc;
  color: var(--text);
  border: 1px solid var(--line);
  padding: 10px 12px;
}
.tag-list-item:hover, .tag-list-item.active {
  background: #fff7ed;
  border-color: var(--primary);
  color: var(--text);
}
.tag-title { font-weight: 750; overflow-wrap: anywhere; }
.tag-meta { color: var(--muted); font-size: 12px; font-weight: 650; overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid #eef1f5; }
.kv span { color: var(--muted); }
.kv strong { overflow-wrap: anywhere; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.checkbox-label { display: flex; flex-direction: row; align-items: center; gap: 8px; }
.checkbox-label input { width: auto; }

.tenant-list { margin-top: 18px; display: grid; gap: 10px; }
.tenant-choice { text-align: left; background: #eef1f5; color: var(--text); }

.uploads { margin-top: 20px; display: grid; gap: 22px; }
.upload-section { display: grid; gap: 10px; }
.upload-section-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.upload-subsection { display: grid; gap: 8px; padding-left: 14px; border-left: 2px solid var(--line); margin-top: 6px; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.photo-card { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fafbfc; }
.photo-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #e5e9f0; }
.photo-card footer { padding: 10px; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.photo-card small { color: var(--muted); overflow-wrap: anywhere; }

.document-list { display: grid; gap: 8px; }
.document-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfc; }
.document-row small { color: var(--muted); overflow-wrap: anywhere; }

.history-list { display: grid; gap: 10px; }
.history-entry { border: 1px solid var(--line); border-radius: 8px; background: #fafbfc; padding: 10px 12px; display: grid; gap: 8px; }
.history-entry-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.history-meta { color: var(--muted); font-size: 0.85em; }
.history-diff-list { display: grid; gap: 4px; }
.history-diff-row { display: flex; align-items: center; gap: 8px; font-size: 0.9em; flex-wrap: wrap; }
.history-diff-field { color: var(--muted); min-width: 110px; }
.history-diff-value { overflow-wrap: anywhere; }
.history-diff-arrow { color: var(--muted); }

.photo-dialog {
  width: min(1100px, 94vw);
  height: min(760px, 90vh);
  border: 0;
  padding: 0;
  background: #111;
}

.photo-dialog::backdrop { background: rgba(0, 0, 0, 0.72); }
.photo-dialog img { width: 100%; height: 100%; object-fit: contain; }
.photo-dialog .icon-button { position: absolute; top: 12px; right: 12px; }

.admin-shell {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 24px;
}

.admin-tab-btn {
  text-align: left;
  background: transparent;
  color: var(--text);
  font-weight: 650;
}

.admin-tab-btn:hover { background: #eef1f5; color: var(--text); }
.admin-tab-btn.active { background: #fff7ed; color: var(--primary-dark); }

.admin-content { display: grid; gap: 16px; align-items: start; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th { text-align: left; padding: 8px 10px; color: var(--muted); font-weight: 700; border-bottom: 2px solid var(--line); white-space: nowrap; }
.admin-table td { padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tr:hover td { background: #f8fafc; }

.badge { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.badge.disabled { background: var(--danger-bg); color: var(--danger); border-color: #f3b9b4; }
.badge.superadmin { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge.success { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }

.admin-error { color: var(--danger); font-size: 14px; margin-top: 6px; }

.membership-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.membership-row:last-child { border-bottom: 0; }

@media (max-width: 820px) {
  .shell { padding: 14px; }
  .workspace { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
  .tag-header { display: grid; }
}

/* login <-> request-access toggle */
.auth-switch { margin-top: 14px; font-size: 0.9rem; color: var(--muted); }
.linklike { background: none; border: none; color: var(--primary); font: inherit; padding: 0; cursor: pointer; text-decoration: underline; width: auto; }
.linklike:hover { color: var(--primary-dark); }

