/* ======================================================
   style.css — نظام التصميم الكامل
   ====================================================== */

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

/* ── Variables ── */
:root {
  --bg:        #0a0e1a;
  --bg2:       #111827;
  --bg3:       #1a2235;
  --bg4:       #1e2845;
  --border:    rgba(255,255,255,0.07);
  --primary:   #6366f1;
  --primary2:  #4f46e5;
  --violet:    #8b5cf6;
  --cyan:      #06b6d4;
  --emerald:   #10b981;
  --amber:     #f59e0b;
  --red:       #ef4444;
  --rose:      #f43f5e;
  --text:      #f1f5f9;
  --text2:     #94a3b8;
  --text3:     #64748b;
  --sidebar-w: 260px;
  --header-h:  64px;
  --radius:    12px;
  --radius-lg: 18px;
  --shadow:    0 4px 24px rgba(0,0,0,0.4);
  --glow:      0 0 40px rgba(99,102,241,0.15);
  --trans:     all 0.22s cubic-bezier(0.4,0,0.2,1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 4px; }

/* ── Layout ── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 200;
  transition: var(--trans);
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 20px;
  box-shadow: 0 4px 14px rgba(99,102,241,0.4);
  flex-shrink: 0;
}
.logo-text h2 { font-size: 14px; font-weight: 700; line-height: 1.2; }
.logo-text p  { font-size: 11px; color: var(--text2); margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }

.nav-section-title {
  font-size: 10px;
  color: var(--text3);
  letter-spacing: 1px;
  padding: 12px 10px 6px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--trans);
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  position: relative;
}
.nav-item:hover { background: rgba(99,102,241,0.1); color: var(--text); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(99,102,241,0.25), rgba(139,92,246,0.15));
  color: var(--primary);
  font-weight: 700;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  right: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--primary);
  border-radius: 2px;
}
.nav-item .nav-icon { font-size: 18px; width: 22px; text-align: center; }
.nav-badge {
  margin-right: auto;
  background: var(--red);
  color: white;
  font-size: 11px;
  font-weight: 700;
  border-radius: 20px;
  padding: 2px 8px;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}
.sidebar-footer-text { font-size: 11px; color: var(--text3); text-align: center; line-height: 1.6; }

/* ── Main ── */
.main {
  margin-right: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  overflow-x: auto;
}

/* ── Header ── */
.header {
  height: var(--header-h);
  background: rgba(17,24,39,0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.menu-btn {
  display: none;
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--bg3);
  font-size: 18px;
  align-items: center;
  justify-content: center;
  transition: var(--trans);
}
.menu-btn:hover { background: var(--bg4); }
.page-title { font-size: 20px; font-weight: 700; flex: 1; }
.header-actions { display: flex; gap: 10px; }
.btn-header {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: var(--trans);
}
.btn-header.primary { background: var(--primary); color: white; }
.btn-header.primary:hover { background: var(--primary2); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(99,102,241,0.4); }
.btn-header.ghost { background: var(--bg3); color: var(--text2); border: 1px solid var(--border); }
.btn-header.ghost:hover { background: var(--bg4); color: var(--text); }

/* ── Content ── */
.content { padding: 28px; flex: 1; min-width: 0; overflow-x: auto; }
.view { display: none; animation: fadeIn 0.3s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:none; } }

/* ── Section Header ── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.section-header h2 { font-size: 18px; font-weight: 700; }
.section-meta { color: var(--text2); font-size: 13px; }

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: var(--trans);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 0 0 0 100%;
  opacity: 0.12;
}
.stat-card.indigo::before { background: var(--primary); }
.stat-card.cyan::before   { background: var(--cyan); }
.stat-card.amber::before  { background: var(--amber); }
.stat-card.red::before    { background: var(--red); }
.stat-card.emerald::before{ background: var(--emerald); }
.stat-card.violet::before { background: var(--violet); }

.stat-icon {
  font-size: 28px;
  margin-bottom: 12px;
  display: block;
}
.stat-val {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 6px;
}
.stat-card.indigo .stat-val { color: var(--primary); }
.stat-card.cyan   .stat-val { color: var(--cyan); }
.stat-card.amber  .stat-val { color: var(--amber); }
.stat-card.red    .stat-val { color: var(--red); }
.stat-card.emerald .stat-val{ color: var(--emerald); }
.stat-card.violet .stat-val { color: var(--violet); }
.stat-label { font-size: 13px; color: var(--text2); font-weight: 500; }

/* ── Dashboard Grid ── */
.dash-grid { display: grid; grid-template-columns: 1fr 1.6fr; gap: 20px; margin-bottom: 28px; }
.dash-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}
.dash-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 16px; color: var(--text); }
.dash-card canvas { max-height: 220px; }

/* ── Alerts ── */
.alerts-section { background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; }
.alerts-section h3 { font-size: 15px; font-weight: 700; margin-bottom: 16px; }
.alert-item {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px; border-radius: var(--radius);
  margin-bottom: 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  transition: var(--trans);
}
.alert-item:hover { background: rgba(255,255,255,0.06); }
.alert-item.critical { border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.05); }
.alert-item.warning  { border-color: rgba(245,158,11,0.3); background: rgba(245,158,11,0.05); }
.alert-icon { font-size: 20px; }
.alert-info { flex: 1; }
.alert-info strong { display: block; font-size: 14px; margin-bottom: 2px; }
.alert-info span   { font-size: 12px; color: var(--text2); }
.alert-badge {
  padding: 4px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 700;
}
.alert-badge.critical { background: rgba(239,68,68,0.2); color: var(--red); }
.alert-badge.warning  { background: rgba(245,158,11,0.2); color: var(--amber); }
.alert-badge.active   { background: rgba(16,185,129,0.2); color: var(--emerald); }

/* ── Charts Row ── */
.charts-row { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; }

/* ── Toolbar ── */
.toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.search-box {
  flex: 1; min-width: 220px;
  position: relative;
}
.search-box input {
  width: 100%; padding: 10px 16px 10px 40px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 14px;
  transition: var(--trans);
}
.search-box input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.search-box input::placeholder { color: var(--text3); }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: 16px; }

/* ── Table ── */
.table-wrap {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  width: 100%;
}
.table-scroll {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  /* Custom scrollbar for table */
  scrollbar-width: thin;
  scrollbar-color: var(--bg4) transparent;
}
.table-scroll::-webkit-scrollbar { height: 8px; }
.table-scroll::-webkit-scrollbar-track { background: var(--bg2); border-radius: 4px; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; opacity: 0.7; }
.table-scroll::-webkit-scrollbar-thumb:hover { background: var(--primary-light); }
table { width: 100%; border-collapse: collapse; }
thead { background: var(--bg4); }
th {
  padding: 14px 16px;
  text-align: right;
  font-size: 12px; font-weight: 700;
  color: var(--text2);
  white-space: nowrap;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--primary); }
td {
  padding: 13px 16px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  white-space: nowrap;
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }
.num { font-variant-numeric: tabular-nums; font-weight: 600; }
.mono { font-size: 11px; color: var(--text3); }

/* ── Badges ── */
.status-badge {
  display: inline-block;
  padding: 4px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.status-badge.active   { background: rgba(16,185,129,0.15); color: var(--emerald); border: 1px solid rgba(16,185,129,0.3); }
.status-badge.warning  { background: rgba(245,158,11,0.15); color: var(--amber);   border: 1px solid rgba(245,158,11,0.3); }
.status-badge.critical { background: rgba(239,68,68,0.15);  color: var(--red);     border: 1px solid rgba(239,68,68,0.3); }
.status-badge.expired  { background: rgba(100,116,139,0.15);color: var(--text3);   border: 1px solid rgba(100,116,139,0.3); }
.status-badge.renewed  { background: rgba(59,130,246,0.15); color: #3b82f6;        border: 1px solid rgba(59,130,246,0.3); }
.status-badge.paused   { background: rgba(168,162,158,0.15);color: #78716c;        border: 1px solid rgba(168,162,158,0.3); }
.status-badge.cancelled{ background: rgba(153,27,27,0.15);  color: #ef4444;        border: 1px solid rgba(153,27,27,0.3); }

.tag {
  display: inline-block; padding: 3px 9px; border-radius: 6px;
  font-size: 11px; font-weight: 600;
  background: rgba(99,102,241,0.15); color: var(--primary);
}
.tag-alt { background: rgba(6,182,212,0.15); color: var(--cyan); }

/* ── Action Buttons ── */
.actions { display: flex; gap: 6px; }
.btn-icon {
  width: 30px; height: 30px; border-radius: 7px;
  display: grid; place-items: center;
  font-size: 14px; transition: var(--trans);
  background: transparent;
}
.btn-icon.edit:hover { background: rgba(99,102,241,0.2); }
.btn-icon.del:hover  { background: rgba(239,68,68,0.2); }
.btn-icon.log:hover  { background: rgba(59,130,246,0.2); }
.btn-icon.notif:hover{ background: rgba(245,158,11,0.2); }
.btn-icon.renew       { position: relative; }
.btn-icon.renew:hover { background: rgba(16,185,129,0.2); }
.btn-icon.renew sup   { position:absolute; top:-4px; right:-4px; background:var(--red); color:white; border-radius:50%; font-size:9px; width:14px; height:14px; display:flex; align-items:center; justify-content:center; }

/* ── Auto Date Display ── */
.auto-date-display {
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--emerald);
  min-height: 40px;
  display: flex;
  align-items: center;
}

/* ── Renewal Modal Info Card ── */
.renewal-info-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.renewal-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.renewal-info-row:last-child { border-bottom: none; }
.renewal-label { font-size: 13px; color: var(--text3); white-space: nowrap; }
.renewal-value { font-size: 14px; color: var(--text); text-align: left; }

/* ── Section Divider ── */
.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  color: var(--red);
  font-size: 14px;
  font-weight: 700;
}
.section-divider::before, .section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(239,68,68,0.3);
}

/* ── Expired Section Header ── */
.expired-section-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(239,68,68,0.06);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
}
.expired-section-header > span { font-size: 28px; flex-shrink: 0; }
.expired-section-header h3 { color: var(--red); margin: 0 0 4px; font-size: 15px; }
.expired-section-header p  { color: var(--text3); font-size: 13px; margin: 0; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius);
  font-size: 14px; font-weight: 600; font-family: inherit;
  transition: var(--trans); cursor: pointer; border: none;
}
.btn-primary  { background: var(--primary); color: white; }
.btn-primary:hover  { background: var(--primary2); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(99,102,241,0.4); }
.btn-ghost    { background: var(--bg4); color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover    { color: var(--text); background: rgba(255,255,255,0.08); }
.btn-danger   { background: rgba(239,68,68,0.15); color: var(--red); border: 1px solid rgba(239,68,68,0.3); }
.btn-danger:hover   { background: rgba(239,68,68,0.25); }
.btn-emerald  { background: rgba(16,185,129,0.15); color: var(--emerald); border: 1px solid rgba(16,185,129,0.3); }
.btn-emerald:hover  { background: rgba(16,185,129,0.25); }

/* ── Notifications ── */
.notif-header-bar {
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.1));
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  display: flex; align-items: center; gap: 16px;
}
.notif-header-bar .icon { font-size: 32px; }
.notif-header-bar h3 { font-size: 16px; font-weight: 700; }
.notif-header-bar p  { font-size: 13px; color: var(--text2); margin-top: 2px; }

.notif-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px; margin-bottom: 16px;
  transition: var(--trans);
}
.notif-card:hover { border-color: rgba(99,102,241,0.3); box-shadow: var(--glow); }
.notif-card.critical { border-color: rgba(239,68,68,0.3); }
.notif-card.warning  { border-color: rgba(245,158,11,0.3); }
.notif-header { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.notif-icon { font-size: 28px; }
.notif-title h3 { font-size: 16px; font-weight: 700; }
.notif-title p  { font-size: 13px; color: var(--text2); margin-top: 3px; }
.notif-days {
  margin-right: auto; text-align: center;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius); padding: 10px 18px;
}
.notif-days.critical { background: rgba(239,68,68,0.1); }
.notif-days.warning  { background: rgba(245,158,11,0.1); }
.days-num  { display: block; font-size: 28px; font-weight: 800; line-height: 1; }
.days-label{ display: block; font-size: 12px; color: var(--text2); }
.notif-days.critical .days-num { color: var(--red); }
.notif-days.warning  .days-num { color: var(--amber); }
.notif-body { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.notif-detail { font-size: 13px; color: var(--text2); }
.notif-detail strong { color: var(--text); }
.notif-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ── Settings ── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.settings-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
}
.settings-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 18px; display: flex; align-items: center; gap: 8px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; font-weight: 500; }
.form-input {
  width: 100%; padding: 10px 14px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 14px; font-family: inherit;
  transition: var(--trans);
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.form-input::placeholder { color: var(--text3); }
.form-select { appearance: none; }

.recipient-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.recipient-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 14px; font-size: 13px;
}
.recipient-item button { color: var(--text3); transition: var(--trans); padding: 2px 6px; border-radius: 4px; }
.recipient-item button:hover { color: var(--red); background: rgba(239,68,68,0.1); }

.add-recipient-row { display: flex; gap: 8px; }
.add-recipient-row .form-input { flex: 1; }

.day-checkboxes { display: flex; gap: 12px; flex-wrap: wrap; }
.day-check {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 16px; cursor: pointer; transition: var(--trans);
}
.day-check:hover { border-color: var(--primary); }
.day-check input { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }
.day-check span { font-size: 13px; font-weight: 600; }

/* ── Modal ── */
.modal {
  display: none;
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  align-items: center; justify-content: center; padding: 20px;
}
.modal.open { display: flex; animation: fadeIn 0.2s ease; }
.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.6);
}
.modal-box.wide { max-width: 820px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--bg3); color: var(--text2); font-size: 18px;
  display: grid; place-items: center; transition: var(--trans);
}
.modal-close:hover { background: rgba(239,68,68,0.2); color: var(--red); }
.modal-body { padding: 24px; }
.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 24px; border-top: 1px solid var(--border);
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span2 { grid-column: 1 / -1; }

/* ── Email preview ── */
#email-preview-frame {
  width: 100%; min-height: 520px;
  border: none; border-radius: var(--radius);
  background: white;
}

/* ── Empty States ── */
.empty-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 40px; gap: 12px;
  color: var(--text3); text-align: center;
}
.empty-state span { font-size: 40px; }
.empty-state p    { font-size: 14px; }
.empty-state.big  { padding: 80px; }
.empty-td { padding: 0 !important; }

/* ── Toast ── */
#toast-container { position: fixed; bottom: 24px; left: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 20px; font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  transform: translateX(-120%); transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  max-width: 340px;
}
.toast.show { transform: translateX(0); }
.toast.toast-error   { border-color: rgba(239,68,68,0.4); }
.toast.toast-warning { border-color: rgba(245,158,11,0.4); }
.toast.toast-success { border-color: rgba(16,185,129,0.4); }

/* ── Sidebar Overlay (mobile) ── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); z-index: 190;
}

/* ── Import/Export Zone ── */
.import-zone {
  border: 2px dashed var(--border); border-radius: var(--radius-lg);
  padding: 32px; text-align: center; cursor: pointer;
  transition: var(--trans); margin-bottom: 16px;
}
.import-zone:hover { border-color: var(--primary); background: rgba(99,102,241,0.05); }
.import-zone .icon { font-size: 40px; margin-bottom: 10px; }
.import-zone h4   { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.import-zone p    { font-size: 13px; color: var(--text2); }

/* ── Info Banner ── */
.info-banner {
  background: linear-gradient(135deg, rgba(6,182,212,0.1), rgba(99,102,241,0.1));
  border: 1px solid rgba(6,182,212,0.25);
  border-radius: var(--radius); padding: 14px 18px;
  font-size: 13px; color: var(--text2);
  margin-bottom: 20px;
}

/* ── Responsive ── */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { grid-template-columns: 1fr; }
  .charts-row { grid-template-columns: 1fr; }
  .dash-grid  { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
  .sidebar.open ~ .sidebar-overlay { opacity: 1; pointer-events: all; }
  .main { margin-right: 0; }
  .menu-btn { display: flex; }
  .content { padding: 18px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .header { padding: 0 16px; }
  .btn-header span { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: 1; }
}
@media (max-width: 600px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-val { font-size: 24px; }
  .header-actions .btn-header:not(.primary) { display: none; }
  .renewal-info-row { flex-direction: column; align-items: flex-start; gap: 4px; }
}

/* ── Import Preview Modal ── */
.import-table { min-width: 800px; }
.import-table th { font-size: 12px; white-space: nowrap; padding: 8px 10px; }
.import-table td { padding: 6px 8px; vertical-align: middle; }

.form-input-sm {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 12px;
  font-family: inherit;
  width: 100%;
  min-width: 80px;
}
.form-input-sm:focus { outline: none; border-color: var(--primary); }
.form-input-sm.missing {
  border-color: var(--red);
  background: rgba(239,68,68,0.08);
  animation: pulse-border 1.5s infinite;
}
@keyframes pulse-border {
  0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50%      { box-shadow: 0 0 0 3px rgba(239,68,68,0.1); }
}

.row-missing { background: rgba(239,68,68,0.04); }
.cell-missing { background: rgba(239,68,68,0.08); }

.import-summary-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.import-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}
.import-badge.blue   { background: rgba(99,102,241,0.15); color: var(--indigo); border: 1px solid rgba(99,102,241,0.3); }
.import-badge.green  { background: rgba(16,185,129,0.12); color: var(--emerald); border: 1px solid rgba(16,185,129,0.3); }
.import-badge.red    { background: rgba(239,68,68,0.12);  color: var(--red);     border: 1px solid rgba(239,68,68,0.3); }

.import-lines-summary {
  padding: 14px 18px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.import-clear-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text2);
}
.import-clear-label input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--red); }
.import-clear-label:hover { color: var(--red); }

/* ── Line Status Toggle Button ── */
.status-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--trans);
  white-space: nowrap;
}
.status-toggle-btn.active {
  background: rgba(16,185,129,0.15);
  color: var(--emerald);
  border-color: rgba(16,185,129,0.3);
}
.status-toggle-btn.active:hover {
  background: rgba(16,185,129,0.25);
  transform: scale(1.02);
}
.status-toggle-btn.expired {
  background: rgba(239,68,68,0.12);
  color: var(--red);
  border-color: rgba(239,68,68,0.3);
}
.status-toggle-btn.expired:hover {
  background: rgba(239,68,68,0.22);
  transform: scale(1.02);
}
.status-toggle-btn.warning {
  background: rgba(245,158,11,0.12);
  color: var(--amber);
  border-color: rgba(245,158,11,0.3);
}
.status-toggle-btn.warning:hover {
  background: rgba(245,158,11,0.22);
  transform: scale(1.02);
}

/* ── Inactive line row dim ── */
tr.line-inactive td:not(:last-child):not(:first-child) {
  opacity: 0.5;
}
tr.line-inactive td:first-child strong {
  opacity: 0.6;
}

/* ── Lines Table: Sticky Columns ── */
#line-tbody tr td:first-child,
#line-tbody tr td:last-child,
#view-lines thead th:first-child,
#view-lines thead th:last-child {
  position: sticky;
  z-index: 2;
  background: var(--bg3);
}
#view-lines thead th:first-child,
#view-lines thead th:last-child {
  background: var(--bg4);
  z-index: 3;
}
#view-lines thead th:first-child,
#line-tbody tr td:first-child {
  right: 0;
  box-shadow: -3px 0 8px rgba(0,0,0,0.25);
}
#view-lines thead th:last-child,
#line-tbody tr td:last-child {
  left: 0;
  box-shadow: 3px 0 8px rgba(0,0,0,0.25);
}
/* Min widths for columns so they don't collapse */
#view-lines table { min-width: 1600px; }
