/* ModsWave Dashboard — Crimson Authority design system
   ("institutional confidence through dark precision") applied exactly,
   per ModsOs/references/examples/crimson-authority-design.md */

:root {
  --bg-primary: #0f1729;
  --bg-elevated: #1a2540;
  --bg-floating: #243055;
  --accent-crimson: #c0392b;
  --accent-gold: #d4a843;
  --accent-gold-light: #f0c96a;
  --accent-blue: #4a90d9;
  --accent-purple: #8b5cf6;
  --text-primary: #e8eaf0;
  --text-secondary: #b8bdd0;
  --text-muted: #8892a4;

  --success: #2ed573;
  --warning: #ffa502;
  --danger: #ff6b6b;

  --shadow: 0 4px 6px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(212, 168, 67, 0.1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(192, 57, 43, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(74, 144, 217, 0.06) 0%, transparent 60%),
    var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  line-height: 1.7;
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: 'Inter', 'SF Pro Display', -apple-system, sans-serif;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0 0 16px;
}
h1 { font-size: 1.6rem; }
h3 { font-size: 1.05rem; color: var(--accent-gold-light); }

.muted { color: var(--text-muted); }
.eyebrow {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--text-muted);
}

a { color: var(--accent-blue); }

/* Layout */
.topbar {
  background: var(--bg-elevated);
  border-bottom: 1px solid rgba(212, 168, 67, 0.3);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--accent-gold);
  font-size: 1.1rem;
}
.tabs { display: flex; gap: 4px; }
.tab {
  padding: 8px 16px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 3px solid transparent;
  transition: color 0.2s;
}
.tab:hover { color: var(--text-secondary); }
.tab.active { color: var(--accent-gold); border-bottom-color: var(--accent-gold); }

.wrap { max-width: 1000px; margin: 0 auto; padding: 32px 24px; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

/* Cards */
.card {
  background: var(--bg-elevated);
  border: 1px solid rgba(212, 168, 67, 0.15);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

/* Stat grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat {
  background: var(--bg-floating);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  border: 1px solid rgba(212, 168, 67, 0.15);
}
.stat .val { font-size: 28px; font-weight: 700; color: var(--accent-gold); }
.stat .lbl {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Tables */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(212, 168, 67, 0.15);
}
td {
  padding: 10px;
  border-bottom: 1px solid rgba(212, 168, 67, 0.08);
  font-size: 14px;
}

.badge-done { color: var(--success); font-weight: 600; }
.badge-pending { color: var(--warning); font-weight: 600; }
.badge-miss { color: var(--danger); font-weight: 600; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  color: #fff;
  background: var(--bg-floating);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s var(--spring), background 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent-crimson); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* Forms */
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 12px 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
input[type=text], input[type=password], input[type=url], textarea, select {
  background: var(--bg-primary);
  border: 1px solid rgba(212, 168, 67, 0.2);
  border-radius: 6px;
  color: var(--text-primary);
  padding: 10px 12px;
  font-size: 14px;
  width: 100%;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent-gold); }
textarea { min-height: 80px; resize: vertical; }

/* Toasts */
.toast {
  background: var(--bg-floating);
  border-left: 3px solid var(--success);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 16px;
  animation: toast-in 0.3s var(--spring);
}
.toast-error { border-left-color: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Login page */
.login-wrap {
  display: flex;
  justify-content: center;
  padding-top: 12vh;
}
.login-card {
  background: var(--bg-elevated);
  border: 1px solid rgba(212, 168, 67, 0.3);
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-card h1 { color: var(--accent-gold); }

/* QR link page */
.qr-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
#qr-img {
  width: 280px;
  height: 280px;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  display: none;
  animation: qr-in 0.4s var(--spring);
}
@keyframes qr-in {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.secret-field {
  filter: blur(4px);
  cursor: pointer;
  transition: filter 0.2s;
}
.secret-field:hover { filter: blur(2px); }

/* Contacts tab — folder sidebar + contact list */
.contacts-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 720px) {
  .contacts-layout { grid-template-columns: 1fr; }
}
.folder-list { display: flex; flex-direction: column; gap: 2px; }
.folder-row { display: flex; align-items: center; gap: 4px; }
.folder-link {
  flex: 1;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.folder-link:hover { background: var(--bg-floating); }
.folder-link.active { background: var(--bg-floating); color: var(--accent-gold); }

/* A "..." disclosure used for inline rename/delete (folder rows) and
   per-contact edit — plain <details>/<summary>, no JS required. */
.folder-menu summary {
  list-style: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
}
.folder-menu summary::-webkit-details-marker { display: none; }
.folder-menu summary:hover { color: var(--text-secondary); background: var(--bg-floating); }
.folder-menu[open] summary { color: var(--accent-gold); }
.folder-menu-body {
  background: var(--bg-floating);
  border: 1px solid rgba(212, 168, 67, 0.15);
  border-radius: 8px;
  padding: 12px;
  margin-top: 6px;
  position: relative;
  z-index: 5;
}

input[type=file] {
  color: var(--text-secondary);
  font-size: 13px;
  padding: 8px 0;
}
