/* ERAYAA static — design tokens & layout */
:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --border: #e6e8ee;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #0f172a;
  --accent: #d4a648;
  --accent-soft: #f7eed3;
  --gold: #d4a648;
  --silver: #c0c4cc;
  --bronze: #cd7f32;
  --hero: linear-gradient(135deg, #0b1220 0%, #1e293b 50%, #334155 100%);
  --soft: linear-gradient(135deg, #f7eed3 0%, #fdfaf0 100%);
  --shadow: 0 4px 20px rgba(15,23,42,0.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
img { display: block; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.app.collapsed { grid-template-columns: 64px 1fr; }
.sidebar {
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 16px 12px;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.brand img { width: 36px; height: 36px; border-radius: 10px; background: #fff; object-fit: contain; }
.brand-text { line-height: 1.1; }
.brand-text b { font-size: 15px; }
.brand-text small { color: var(--muted); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; }
.app.collapsed .brand-text, .app.collapsed .nav-label, .app.collapsed .footer-label { display: none; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 500; font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: var(--soft); color: var(--text); }
.nav a.active { background: var(--hero); color: #fff; }
.nav svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer { border-top: 1px solid var(--border); padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.sidebar-footer button {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: transparent; border: 0; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); font-size: 14px; text-align: left;
}
.sidebar-footer button:hover { background: var(--soft); color: var(--text); }
.sidebar-footer button svg { width: 18px; height: 18px; flex-shrink: 0; }

.main { padding: 28px 32px; max-width: 1400px; width: 100%; }
.page-header { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; }
.page-header h1 { font-size: 28px; font-weight: 700; }
.page-header p { color: var(--muted); font-size: 14px; margin-top: 4px; }

/* ---------- Components ---------- */
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px)  { .grid-4, .grid-2 { grid-template-columns: 1fr; } .main { padding: 20px 16px; } .app { grid-template-columns: 64px 1fr; } .brand-text, .nav-label, .footer-label { display: none; } }

.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-accent { background: rgba(212,166,72,0.12); color: var(--accent); }
.badge-primary { background: rgba(15,23,42,0.08); color: var(--primary); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 14px;
  border: 1px solid transparent; transition: opacity 0.15s, background 0.15s;
}
.btn-primary { background: var(--hero); color: #fff; }
.btn-primary:hover { opacity: 0.9; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--soft); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-lg { padding: 12px 18px; font-size: 15px; }

.input, .textarea, .select {
  width: 100%; padding: 10px 12px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  font: inherit; color: var(--text);
}
.input:focus, .textarea:focus, .select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.textarea { resize: vertical; min-height: 120px; }
.label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--soft); color: var(--text);
  font-weight: 700; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.av-9 { width: 36px; height: 36px; font-size: 13px; }
.av-10 { width: 40px; height: 40px; font-size: 14px; }
.av-14 { width: 56px; height: 56px; font-size: 18px; }
.av-28 { width: 112px; height: 112px; font-size: 32px; }

/* ---------- Login ---------- */
.login { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
@media (max-width: 900px) { .login { grid-template-columns: 1fr; } .login-hero { display: none; } }
.login-hero {
  background: var(--hero); color: #fff; padding: 48px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-hero::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 20% 20%, rgba(255,255,255,0.18), transparent 40%);
}
.login-hero > * { position: relative; z-index: 1; }
.login-hero h1 { font-size: 44px; line-height: 1.05; font-weight: 700; }
.login-hero p { color: rgba(255,255,255,0.8); max-width: 380px; margin-top: 16px; }
.login-hero .copyright { color: rgba(255,255,255,0.5); font-size: 12px; }
.login-form {
  display: flex; align-items: center; justify-content: center;
  background: var(--soft); padding: 24px;
}
.login-form-inner { width: 100%; max-width: 360px; }
.demo {
  margin-top: 24px; padding: 14px; border-radius: 12px;
  border: 1px solid var(--border); background: #fff;
  font-size: 12px; color: var(--muted);
}
.demo b { color: var(--text); display: block; margin-bottom: 4px; }

/* ---------- Home — Top 3 ---------- */
.top3-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--soft); padding: 8px; border-radius: 10px; margin-bottom: 6px;
}
.top3-rank { width: 30px; height: 30px; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.rank-1 { background: rgba(212,166,72,0.25); color: #b45309; }
.rank-2 { background: rgba(192,196,204,0.4); color: #475569; }
.rank-3 { background: rgba(205,127,50,0.2); color: #c2410c; }
.top3-row .name { flex: 1; min-width: 0; }
.top3-row .name b { font-size: 13px; display: block; }
.top3-row .name small { font-size: 11px; color: var(--muted); }
.top3-row .sqft { text-align: right; }
.top3-row .sqft b { color: var(--primary); font-size: 17px; }
.top3-row .sqft small { display: block; font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head .label { font-size: 11px; font-weight: 700; color: var(--accent); letter-spacing: 0.1em; text-transform: uppercase; margin: 0; }
.card-head .sub { font-size: 13px; font-weight: 500; }
.icon-tile { width: 40px; height: 40px; border-radius: 12px; background: var(--hero); color: #fff; display: flex; align-items: center; justify-content: center; }

.chart-wrap { height: 320px; position: relative; }

/* ---------- Employees flip cards ---------- */
.flip-card { perspective: 1200px; height: 420px; }
.flip-inner { position: relative; width: 100%; height: 100%; transition: transform 0.7s; transform-style: preserve-3d; cursor: pointer; }
.flip-inner.flipped { transform: rotateY(180deg); }
.flip-face { position: absolute; inset: 0; border-radius: 16px; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: var(--shadow); }
.flip-back { transform: rotateY(180deg); background: var(--card); padding: 22px; }
.flip-front { background: var(--hero); color: #fff; padding: 28px; display: flex; flex-direction: column; }
.flip-front .meta { display: flex; justify-content: space-between; align-items: flex-start; }
.flip-front .meta small { color: rgba(255,255,255,0.75); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600; }
.flip-front .meta .badge-w { width: 40px; height: 40px; border-radius: 12px; background: rgba(255,255,255,0.18); display: flex; align-items: center; justify-content: center; }
.flip-front .body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.flip-front .body h2 { font-size: 22px; margin-top: 12px; }
.flip-front .body p { font-size: 12px; color: rgba(255,255,255,0.75); margin-top: 8px; max-width: 280px; }
.flip-front .hint { font-size: 11px; color: rgba(255,255,255,0.7); text-align: center; }
.team-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-height: 320px; overflow: auto; }
.team-row { display: flex; align-items: center; gap: 8px; padding: 8px; background: var(--soft); border-radius: 10px; }
.team-row b { font-size: 12px; display: block; }
.team-row small { font-size: 10px; color: var(--muted); }

/* ---------- Quiz ---------- */
.progress { width: 100%; height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.progress-bar { height: 100%; background: var(--accent); transition: width 0.3s; }
.diff-chip {
  display: inline-block; padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600; margin-right: 6px; margin-bottom: 6px;
  border: 0; background: #eef0f5; color: var(--muted);
}
.diff-chip.active { outline: 2px solid var(--accent); outline-offset: 1px; }
.opt {
  display: block; width: 100%; text-align: left;
  border: 1px solid var(--border); background: #fff;
  padding: 14px 16px; border-radius: 12px; margin-bottom: 8px; font-size: 14px;
  transition: border-color 0.15s, background 0.15s;
}
.opt:hover { border-color: var(--accent); }
.opt.selected { border-color: var(--accent); background: rgba(212,166,72,0.08); font-weight: 600; }
.opt-letter { display: inline-flex; width: 24px; height: 24px; border-radius: 999px; background: #eef0f5; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; margin-right: 10px; }

/* ---------- Complaint ---------- */
.callout { display: flex; gap: 12px; padding: 14px; border-radius: 12px; background: var(--soft); margin-bottom: 20px; }
.callout .icon-tile { width: 40px; height: 40px; flex-shrink: 0; }
.callout b { font-size: 14px; display: block; }
.callout small { font-size: 12px; color: var(--muted); }

/* Tooltip for chart */
.chart-tooltip {
  position: absolute; pointer-events: none;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; box-shadow: 0 8px 24px rgba(15,23,42,0.12);
  display: none; z-index: 10;
  display: flex; align-items: center; gap: 10px;
}
.chart-tooltip.hidden { display: none; }
.chart-tooltip .av-10 { border: 2px solid var(--accent); }
.chart-tooltip b { font-size: 13px; display: block; }
.chart-tooltip small { font-size: 11px; color: var(--muted); }

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-3 { gap: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.text-muted { color: var(--muted); font-size: 13px; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.text-3xl { font-size: 28px; }
.text-accent { color: var(--accent); }
