/* ── Reset + Root ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --orange:       #E95900;
  --orange-light: #FDF1E8;
  --border:       #E8E0D8;
  --text:         #0D0D0D;
  --muted:        #6B6B6B;
  --white:        #FFFFFF;
  --bg:           #FAF8F5;
  --red:          #B60B0B;
  --green:        #0A9E0A;
  --yellow:       #967600;
  --blue:         #0A5EA8;
  --sidebar-bg:   #0D0D0D;
  --sidebar-w:    240px;
}

/* ── Auth pages (login, mfa) ── */
.auth-body {
  font-family: 'Montserrat', sans-serif;
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.auth-body::before {
  content: '';
  position: fixed;
  top: -200px; right: -200px;
  width: 700px; height: 700px;
  background: radial-gradient(circle, rgba(233,89,0,0.08) 0%, transparent 70%);
  pointer-events: none;
}
.bg-grid {
  position: fixed; inset: 0;
  background-image: linear-gradient(rgba(233,89,0,0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(233,89,0,0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}
.login-wrap { width: 100%; max-width: 440px; position: relative; z-index: 10; }

/* ── Brand ── */
.brand { margin-bottom: 28px; display: flex; align-items: center; gap: 12px; }
.brand-icon { width: 44px; height: 44px; flex-shrink: 0; }
.brand-name { font-size: 20px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; }
.brand-sep { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }
.brand-sub { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.5px; text-transform: uppercase; }

/* ── Card ── */
.card {
  background: var(--white);
  border-radius: 20px;
  padding: 48px 44px;
  box-shadow: 0 1px 0 var(--border), 0 8px 32px rgba(13,13,13,0.08), 0 32px 64px rgba(13,13,13,0.04);
  border: 1px solid var(--border);
}
.card-title { font-size: 24px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; margin-bottom: 4px; }
.card-sub { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 36px; }

/* ── Form ── */
.field { margin-bottom: 20px; }
label { display: block; font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 8px; letter-spacing: 0.6px; text-transform: uppercase; }
label .req { color: var(--orange); margin-left: 2px; }
input[type="text"], input[type="password"], input[type="email"], input[type="date"], select, textarea {
  display: block; width: 100%;
  padding: 13px 16px; font-size: 14px; font-weight: 500;
  font-family: 'Montserrat', sans-serif;
  color: var(--text); background: var(--bg);
  border: 2px solid var(--border); border-radius: 10px;
  outline: none; transition: border-color .15s, background .15s, box-shadow .15s;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--orange); background: var(--white);
  box-shadow: 0 0 0 3px rgba(233,89,0,0.1);
}
input::placeholder, textarea::placeholder { color: #C4B8AE; font-weight: 400; }

/* ── Button ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 11px 18px;
  background: var(--orange); color: var(--white);
  font-family: 'Montserrat', sans-serif;
  font-weight: 700; font-size: 13px; letter-spacing: 0.2px;
  border: none; border-radius: 8px; cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
  box-shadow: 0 4px 16px rgba(233,89,0,0.3);
  text-decoration: none;
}
.btn:hover { background: #D14F00; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(233,89,0,0.4); }
.btn:active { transform: translateY(0); }
.btn-block { display: flex; width: 100%; justify-content: center; padding: 15px; font-size: 15px; margin-top: 32px; }
.btn-ghost { background: transparent; color: var(--text); box-shadow: none; border: 2px solid var(--border); }
.btn-ghost:hover { background: var(--bg); transform: none; box-shadow: none; }
.btn-danger { background: var(--red); box-shadow: 0 4px 16px rgba(182,11,11,0.25); }
.btn-danger:hover { background: #9a0909; }
.btn-blue { background: var(--blue); box-shadow: 0 4px 16px rgba(10,94,168,0.25); }
.btn-blue:hover { background: #084e8e; }
.btn-sm { padding: 7px 12px; font-size: 11px; }

/* ── SVG icons in buttons ── */
.btn svg.icon { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2.2; flex-shrink: 0; }

/* ── Alerts ── */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 20px; font-weight: 500; }
.alert-error   { background: #FFF5F5; color: var(--red); border-left: 3px solid var(--red); }
.alert-warning { background: #FFFAF0; color: var(--yellow); border-left: 3px solid var(--yellow); }
.alert-success { background: #F0FFF0; color: var(--green); border-left: 3px solid var(--green); }

/* ── Divider ── */
.divider { height: 1px; background: var(--border); margin: 28px 0; }
.footer-note { text-align: center; font-size: 11px; color: #C4B8AE; font-weight: 500; letter-spacing: 0.3px; }

/* ── Steps (MFA) ── */
.steps { display: flex; gap: 8px; margin-bottom: 32px; }
.step { flex: 1; height: 4px; border-radius: 2px; background: var(--border); }
.step.done { background: var(--orange); }
.step.active { background: linear-gradient(90deg, var(--orange), rgba(233,89,0,0.3)); }

/* ── OTP inputs ── */
.otp-wrap { display: flex; gap: 10px; justify-content: center; margin: 8px 0; }
.otp-digit {
  width: 52px !important; height: 64px; text-align: center;
  font-size: 24px; font-weight: 700;
  border-radius: 12px; padding: 0 !important;
}
.otp-label { text-align: center; font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 24px; }

/* ── Panel layout ── */
.panel-body {
  font-family: 'Montserrat', sans-serif;
  background: var(--bg);
  min-height: 100vh;
  display: flex;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 0;
  flex-shrink: 0;
  position: fixed;
  left: 0; top: 0; bottom: 0;
}
.sidebar-logo { padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo-inner { display: flex; align-items: center; gap: 10px; }
.sidebar-logo svg { width: 32px; height: 24px; }
.sidebar-logo-text { font-size: 16px; font-weight: 800; color: #fff; }
.sidebar-logo-sub { font-size: 9px; font-weight: 600; color: rgba(255,255,255,0.35); letter-spacing: 0.8px; text-transform: uppercase; margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: rgba(255,255,255,0.5); font-size: 13px; font-weight: 600;
  text-decoration: none; transition: all .15s;
}
.nav-item:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.85); }
.nav-item.active { background: rgba(233,89,0,0.18); color: #fff; }
.nav-item.active .nav-dot { background: var(--orange); }
.nav-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.2); flex-shrink: 0; transition: background .15s; }
.nav-item svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }

.sidebar-user { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08); display: flex; align-items: center; gap: 10px; }
.sidebar-avatar { width: 32px; height: 32px; border-radius: 8px; background: rgba(233,89,0,0.3); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; }
.sidebar-username { font-size: 12px; font-weight: 600; color: rgba(255,255,255,0.7); }
.sidebar-role { font-size: 10px; color: rgba(255,255,255,0.3); margin-top: 1px; }

/* Main content */
.main-content { margin-left: var(--sidebar-w); flex: 1; padding: 32px; }
.page-header { margin-bottom: 28px; }
.page-title { font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -0.4px; }
.page-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ── Stats row ── */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.stat-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--text); letter-spacing: -1px; }
.stat-value.orange { color: var(--orange); }
.stat-value.green  { color: var(--green); }
.stat-value.red    { color: var(--red); }
.stat-value.yellow { color: var(--yellow); }

/* ── Table ── */
.table-wrap { background: var(--white); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.table-toolbar { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.table-toolbar input { max-width: 260px; margin: 0; padding: 9px 14px; font-size: 13px; }
.table-toolbar select { max-width: 160px; margin: 0; padding: 9px 14px; font-size: 13px; }
.toolbar-spacer { flex: 1; }

table { width: 100%; border-collapse: collapse; }
th { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 14px 16px; font-size: 13px; color: var(--text); border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(233,89,0,0.02); }

.td-key { font-family: monospace; font-size: 12px; color: var(--muted); background: var(--bg); padding: 4px 8px; border-radius: 4px; border: 1px solid var(--border); }
.td-actions { display: flex; align-items: center; gap: 6px; }

/* ── Progress bar ── */
.progress-wrap { display: flex; align-items: center; gap: 8px; }
.progress-bar { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--orange); border-radius: 3px; transition: width .3s; }
.progress-fill.full { background: var(--red); }
.progress-label { font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; }

/* ── Badges ── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: 0.3px; }
.badge-active    { background: #E8F8E8; color: var(--green); }
.badge-expired   { background: #FFF0F0; color: var(--red); }
.badge-suspended { background: #F5F5F5; color: #888; }
.badge-pending   { background: #EAF2FF; color: var(--blue); }
.badge-muted     { background: var(--bg); color: var(--muted); }
.badge-yellow    { background: #FFF9E6; color: var(--yellow); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(13,13,13,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: var(--white); border-radius: 20px; padding: 40px; max-width: 520px; width: 100%; box-shadow: 0 24px 80px rgba(13,13,13,0.2); }
.modal-title { font-size: 20px; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.modal-sub { font-size: 13px; color: var(--muted); margin-bottom: 28px; }
.modal-footer { display: flex; gap: 12px; margin-top: 28px; justify-content: flex-end; }

/* ── Form sections (panel forms) ── */
.form-section { background: var(--white); border: 1px solid var(--border); border-radius: 16px; padding: 28px; margin-bottom: 20px; }
.form-section-title { font-size: 14px; font-weight: 800; color: var(--text); margin-bottom: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Plan selector ── */
.plan-options { display: flex; gap: 10px; margin-top: 0; }
.plan-opt { flex: 1; }
.plan-opt input[type="radio"] { display: none; }
.plan-opt label {
  display: block; padding: 14px 12px; border: 2px solid var(--border);
  border-radius: 10px; text-align: center; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--text);
  transition: all .15s; background: var(--bg);
  text-transform: none; letter-spacing: 0; margin-bottom: 0;
}
.plan-opt input:checked + label { border-color: var(--orange); background: var(--orange-light); color: var(--orange); }
.plan-opt-sub { font-size: 10px; font-weight: 500; color: var(--muted); display: block; margin-top: 2px; }

/* ── Template editor ── */
.template-card { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.template-trigger { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 12px; }
.template-card textarea { min-height: 100px; font-size: 13px; resize: vertical; }

/* ── Variables hint ── */
.vars-hint { font-size: 11px; color: var(--muted); margin-top: 8px; }
.vars-hint code { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 11px; }
