/* ============================================================
   KOEGO Portal Design System — shared/assets/css/portal.css
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@700;800&family=DM+Sans:wght@400;500;600;700&display=swap');

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --font-display: 'Syne', sans-serif;
  --font-body:    'DM Sans', sans-serif;

  --accent:   #FF4F1F;
  --accent-l: #FFF2EE;
  --navy:     #0D0C18;
  --ink:      #09090F;
  --ink-2:    #4B4B6A;
  --ink-3:    #8888A8;

  --bg:       #F5F4F1;
  --bg-2:     #ECEAE6;
  --border:   #E3E2DE;

  --green:    #0D9E6B;
  --green-l:  #E8F8F2;
  --blue:     #1A4FCF;
  --blue-l:   #EDF2FF;
  --amber:    #D98C00;
  --amber-l:  #FEF9EC;
  --red:      #D03030;
  --red-l:    #FEF1F1;

  --sb-bg:    #0D0C18;
  --sb-w:     240px;
  --top-h:    60px;
  --radius:   12px;
  --shadow:   0 1px 3px rgba(0,0,0,.07), 0 4px 12px rgba(0,0,0,.05);
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ─────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sb-w);
  background: var(--sb-bg);
  position: fixed; top: 0; left: 0; bottom: 0;
  display: flex; flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}
.main {
  margin-left: var(--sb-w);
  flex: 1;
  display: flex; flex-direction: column;
  min-width: 0;
}
.topbar {
  height: var(--top-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 50;
}
.content { padding: 28px; flex: 1; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sb-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sb-logo {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 800;
  color: #fff; letter-spacing: -.3px;
}
.sb-logo span { color: var(--accent); }
.sb-tagline {
  font-size: 10px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  margin-top: 3px;
}
.sb-nav { flex: 1; padding: 14px 0; }
.sb-section {
  font-size: 9.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255,255,255,.22);
  padding: 14px 20px 6px;
}
.sb-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 20px;
  font-size: 13.5px; font-weight: 500;
  color: rgba(255,255,255,.55);
  transition: all .15s;
  border-left: 3px solid transparent;
  text-decoration: none;
}
.sb-link:hover { color: #fff; background: rgba(255,255,255,.05); text-decoration: none; }
.sb-link.active {
  color: #fff;
  background: rgba(255,79,31,.12);
  border-left-color: var(--accent);
}
.sb-link .icon { width: 18px; text-align: center; font-style: normal; font-size: 15px; }
.sb-quota {
  margin: 0 16px 20px;
  background: rgba(255,255,255,.05);
  border-radius: 10px; padding: 14px;
}
.sb-quota-label {
  font-size: 10px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: rgba(255,255,255,.3);
  margin-bottom: 7px; display: flex; justify-content: space-between;
}
.sb-quota-bar {
  height: 4px; background: rgba(255,255,255,.1);
  border-radius: 2px; overflow: hidden;
}
.sb-quota-fill {
  height: 100%; background: var(--accent);
  border-radius: 2px; transition: width .4s;
}
.sb-user {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; gap: 10px;
}
.sb-av {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.sb-user-name { font-size: 13px; font-weight: 600; color: #fff; line-height: 1.2; }
.sb-user-role { font-size: 11px; color: rgba(255,255,255,.35); }

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.topbar-right  { display: flex; align-items: center; gap: 14px; }
.topbar-badge {
  font-size: 11px; font-weight: 600; padding: 3px 10px;
  border-radius: 20px; background: var(--accent-l); color: var(--accent);
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.card-header {
  padding: 18px 22px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.card-body   { padding: 18px 22px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

/* ── Stat cards ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: #fff; border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.stat-label {
  font-size: 11px; font-weight: 600; letter-spacing: .09em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px;
}
.stat-value {
  font-size: 28px; font-weight: 700; color: var(--ink); line-height: 1;
}
.stat-sub { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.stat-icon {
  font-size: 26px; float: right; margin-top: -2px;
  opacity: .18;
}

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%; border-collapse: collapse;
  font-size: 13.5px;
}
.table th {
  background: var(--bg); font-size: 11px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3); padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left; white-space: nowrap;
}
.table td {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--bg); }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 2px 9px;
  border-radius: 20px; white-space: nowrap;
}
.badge-green  { background: var(--green-l);  color: var(--green); }
.badge-blue   { background: var(--blue-l);   color: var(--blue); }
.badge-amber  { background: var(--amber-l);  color: var(--amber); }
.badge-red    { background: var(--red-l);    color: var(--red); }
.badge-grey   { background: var(--bg-2);     color: var(--ink-3); }
.badge-accent { background: var(--accent-l); color: var(--accent); }
.badge-pulse::before {
  content: ''; width: 6px; height: 6px;
  border-radius: 50%; background: currentColor;
  animation: pulse 1.4s infinite;
}
@keyframes pulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .5; transform: scale(.8); }
}

/* ── KOEGO UID pill ──────────────────────────────────────────── */
.uid-pill {
  font-family: 'Courier New', monospace;
  font-size: 12.5px; font-weight: 800;
  letter-spacing: .12em;
  background: var(--navy); color: #fff;
  padding: 3px 10px; border-radius: 6px;
  display: inline-flex; align-items: center; gap: 7px;
}
.uid-pill .copy-btn {
  cursor: pointer; opacity: .45; transition: opacity .15s;
  background: none; border: none; color: inherit; padding: 0; font-size: 12px;
}
.uid-pill .copy-btn:hover { opacity: 1; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 8px;
  font-family: var(--font-body); font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: all .15s;
  border: 1px solid transparent;
  text-decoration: none; white-space: nowrap;
}
.btn-primary  { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #e83d0e; text-decoration: none; color: #fff; }
.btn-secondary { background: var(--blue-l); color: var(--blue); border-color: transparent; }
.btn-secondary:hover { background: #d9e5ff; text-decoration: none; }
.btn-ghost    { background: transparent; color: var(--ink-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg); text-decoration: none; }
.btn-danger   { background: var(--red-l); color: var(--red); border-color: transparent; }
.btn-danger:hover { background: #fde0e0; text-decoration: none; }
.btn-sm       { padding: 6px 14px; font-size: 12.5px; }
.btn-xs       { padding: 4px 10px; font-size: 11.5px; }
.btn-icon {
  background: none; border: none; cursor: pointer;
  font-size: 15px; padding: 4px 6px; border-radius: 6px;
  transition: background .12s; line-height: 1;
}
.btn-icon:hover { background: var(--bg-2); }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group  { margin-bottom: 16px; }
.form-label  { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 13px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-family: var(--font-body); font-size: 13.5px; color: var(--ink);
  background: #fff; transition: border-color .15s;
  appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26,79,207,.08);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238888A8' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 36px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--red); margin-top: 4px; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 16px; border-radius: 8px;
  font-size: 13px; margin-bottom: 12px;
}
.alert-icon  { font-size: 16px; margin-top: 1px; flex-shrink: 0; }
.alert-info  { background: var(--blue-l);  color: var(--blue); }
.alert-warn  { background: var(--amber-l); color: var(--amber); }
.alert-danger{ background: var(--red-l);   color: var(--red); }
.alert-success{background: var(--green-l); color: var(--green);}

/* ── Progress bar ────────────────────────────────────────────── */
.prog { height: 6px; background: var(--bg-2); border-radius: 3px; overflow: hidden; min-width: 60px; }
.prog-fill { height: 100%; background: var(--green); border-radius: 3px; transition: width .4s; }
.prog-fill.amber  { background: var(--amber); }
.prog-fill.danger { background: var(--red); }

/* ── Modals ──────────────────────────────────────────────────── */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(9,9,15,.55); backdrop-filter: blur(3px);
  z-index: 200; align-items: center; justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff; border-radius: 16px;
  width: 92%; max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  max-height: 90vh; overflow-y: auto;
}
.modal-sm  { max-width: 400px; }
.modal-lg  { max-width: 640px; }
.modal-header {
  padding: 22px 24px 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-sub   { font-size: 13px; color: var(--ink-3); margin-top: 3px; }
.modal-body  { padding: 20px 24px; }
.modal-footer {
  padding: 14px 24px 20px;
  display: flex; gap: 10px; justify-content: flex-end;
  border-top: 1px solid var(--border);
}

/* ── ID Card (Teams linking) ─────────────────────────────────── */
.id-card {
  background: var(--navy); border-radius: 14px;
  padding: 26px; position: relative; overflow: hidden;
  text-align: center; margin-bottom: 16px;
}
.id-card::before {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 120px; height: 120px; border-radius: 50%;
  background: rgba(255,79,31,.12);
}
.id-card-label {
  font-size: 10px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: rgba(255,255,255,.3);
  margin-bottom: 12px;
}
.id-card-uid {
  font-family: 'Courier New', monospace;
  font-size: 36px; font-weight: 900;
  color: #fff; letter-spacing: .18em;
}
.id-card-name  { font-size: 13px; color: rgba(255,255,255,.5); margin-top: 10px; }
.id-card-email { font-size: 11px; color: rgba(255,255,255,.28); margin-top: 2px; }

/* ── User cell ───────────────────────────────────────────────── */
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-av {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-name  { font-size: 13.5px; font-weight: 600; }
.user-email { font-size: 11.5px; color: var(--ink-3); }

/* ── Filter bar ──────────────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 18px;
}
.filter-bar .form-input,
.filter-bar .form-select { width: auto; min-width: 140px; padding: 7px 13px; }

/* ── Toast ───────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast-item {
  background: var(--navy); color: #fff;
  padding: 12px 18px; border-radius: 10px;
  font-size: 13.5px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  display: flex; align-items: center; gap: 8px;
  animation: slide-in .25s ease;
  max-width: 320px;
}
.toast-item.success { border-left: 3px solid var(--green); }
.toast-item.error   { border-left: 3px solid var(--red); }
.toast-item.info    { border-left: 3px solid var(--blue); }
@keyframes slide-in {
  from { transform: translateX(40px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* ── Login page ──────────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex;
  background: linear-gradient(135deg, var(--navy) 0%, #1a1932 100%);
}
.login-left {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 48px;
}
.login-box {
  background: #fff; border-radius: 20px;
  padding: 44px 40px; width: 100%; max-width: 420px;
  box-shadow: 0 24px 80px rgba(0,0,0,.3);
}
.login-logo {
  font-family: var(--font-display); font-size: 28px; font-weight: 800;
  color: var(--navy); margin-bottom: 6px;
}
.login-logo span { color: var(--accent); }
.login-sub   { font-size: 13.5px; color: var(--ink-3); margin-bottom: 30px; }
.login-right {
  width: 420px; background: var(--accent);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 48px; color: #fff;
}
@media (max-width: 800px) { .login-right { display: none; } }

/* ── Pagination ──────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 4px; margin-top: 16px; }
.pag-btn {
  width: 32px; height: 32px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border); background: #fff; color: var(--ink-2);
  transition: all .12s;
}
.pag-btn:hover   { background: var(--bg); border-color: var(--ink-3); }
.pag-btn.active  { background: var(--accent); color: #fff; border-color: var(--accent); }
.pag-btn:disabled { opacity: .35; cursor: not-allowed; }

/* ── Setup Steps (Teams wizard) ──────────────────────────────── */
.setup-steps { display: flex; flex-direction: column; gap: 0; }
.setup-step {
  display: flex; gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
  opacity: .45;
  transition: opacity .2s;
}
.setup-step:last-child { border-bottom: 0; }
.setup-step.active, .setup-step.done { opacity: 1; }
.step-num {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: var(--bg-2); color: var(--ink-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.setup-step.active .step-num { background: var(--accent); color: #fff; }
.setup-step.done .step-num   { background: var(--green);  color: #fff; }
.setup-step.done .step-num::after { content: '✓'; }
.step-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.step-desc  { font-size: 13px; color: var(--ink-3); line-height: 1.5; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .content { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
