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

:root{
  --sky:#2F80ED; --sky-light:#56CCF2; --sky-deep:#1B5FD6;
  --ink:#0B1526; --text-dim:#54617A; --text-faint:#8B96AC;
  --bg:#FFFFFF; --bg-soft:#F4F8FE; --bg-elevated:#EEF4FE;
  --border:rgba(15,40,90,.10); --border-strong:rgba(47,128,237,.4);
  --success:#17B978; --warn:#F2A33C; --danger:#EB5757;
  --radius:14px; --radius-l:20px;
}
*,*::before,*::after{ box-sizing:border-box; margin:0; padding:0; }
body{ font-family:'Cairo',sans-serif; background:var(--bg-soft); color:var(--ink); font-size:15px; line-height:1.6; }
a{ color:inherit; text-decoration:none; }
ul{ list-style:none; }

/* ---------------- Buttons & form controls ---------------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:11px 20px; border-radius:100px; font-weight:700; font-size:14px; border:1px solid transparent;
  cursor:pointer; transition:transform .15s, box-shadow .2s, background .2s;
}
.btn-primary{ background:linear-gradient(135deg, var(--sky), var(--sky-light)); color:#fff; box-shadow:0 14px 30px -14px rgba(47,128,237,.6); }
.btn-primary:hover{ transform:translateY(-2px); }
.btn-ghost{ background:var(--bg-elevated); color:var(--ink); border-color:var(--border); }
.btn-ghost:hover{ border-color:var(--border-strong); }
.btn-danger{ background:#FDEDED; color:var(--danger); border-color:rgba(235,87,87,.3); }
.btn-sm{ padding:7px 14px; font-size:13px; }

label{ display:block; font-size:13px; color:var(--text-dim); font-weight:600; margin-bottom:14px; }
input,select,textarea{
  display:block; width:100%; margin-top:6px; padding:11px 14px; border-radius:10px;
  border:1px solid var(--border); background:var(--bg); color:var(--ink); font-family:inherit; font-size:14px;
}
input:focus,select:focus,textarea:focus{ outline:none; border-color:var(--sky); box-shadow:0 0 0 3px rgba(47,128,237,.15); }
textarea{ resize:vertical; min-height:90px; }
form .btn{ margin-top:6px; }

/* ---------------- Auth pages (login / setup) ---------------- */
.auth-page{ min-height:100vh; display:flex; align-items:center; justify-content:center; background:radial-gradient(circle at 30% 20%, var(--bg-elevated), var(--bg-soft)); padding:20px; }
.auth-card{ width:100%; max-width:380px; background:var(--bg); border:1px solid var(--border); border-radius:var(--radius-l); padding:34px 30px; box-shadow:0 30px 70px -30px rgba(15,40,90,.25); }
.auth-logo{ display:flex; align-items:center; gap:10px; font-weight:800; font-size:17px; margin-bottom:22px; }
.auth-logo b{ color:var(--sky); }
.auth-title{ font-size:19px; font-weight:800; margin-bottom:18px; }

.alert{ padding:12px 16px; border-radius:10px; font-size:13.5px; margin-bottom:16px; }
.alert-error{ background:#FDEDED; color:#C0392B; }
.alert-success{ background:#EAFBF3; color:#128A5E; }

/* ---------------- Shell layout ---------------- */
.shell{ display:flex; min-height:100vh; }
.sidebar{
  width:230px; flex:none; background:var(--bg); border-left:1px solid var(--border);
  display:flex; flex-direction:column; padding:22px 16px; gap:28px;
}
.sidebar .brand{ display:flex; align-items:center; gap:9px; font-weight:800; font-size:15px; padding:0 6px; }
.sidebar .brand b{ color:var(--sky); }
.side-nav{ display:flex; flex-direction:column; gap:4px; flex:1; }
.side-nav a{ display:flex; align-items:center; gap:10px; padding:11px 12px; border-radius:10px; color:var(--text-dim); font-weight:600; font-size:14px; }
.side-nav a svg{ width:19px; height:19px; stroke:currentColor; flex:none; }
.side-nav a:hover{ background:var(--bg-soft); color:var(--ink); }
.side-nav a.active{ background:var(--bg-elevated); color:var(--sky-deep); }
.logout-link{ display:flex; align-items:center; gap:10px; padding:11px 12px; border-radius:10px; color:var(--danger); font-weight:600; font-size:14px; }
.logout-link svg{ width:19px; height:19px; stroke:currentColor; }
.logout-link:hover{ background:#FDEDED; }

.main{ flex:1; min-width:0; }
.topbar{ display:flex; align-items:center; justify-content:space-between; padding:20px 28px; border-bottom:1px solid var(--border); background:var(--bg); }
.topbar h1{ font-size:19px; font-weight:800; }
.topbar .who{ font-size:13px; color:var(--text-dim); background:var(--bg-soft); padding:7px 14px; border-radius:100px; }
.content{ padding:26px 28px 60px; max-width:1180px; }

/* ---------------- Cards / dashboard stats ---------------- */
.stat-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(200px,1fr)); gap:16px; margin-bottom:28px; }
.stat-card{ background:var(--bg); border:1px solid var(--border); border-radius:var(--radius); padding:20px; }
.stat-card span{ display:block; font-size:13px; color:var(--text-dim); margin-bottom:8px; }
.stat-card b{ font-size:26px; font-weight:800; }
.stat-card.accent{ background:linear-gradient(135deg, var(--sky), var(--sky-light)); border-color:transparent; }
.stat-card.accent span{ color:rgba(255,255,255,.85); }
.stat-card.accent b{ color:#fff; }

.panel{ background:var(--bg); border:1px solid var(--border); border-radius:var(--radius-l); padding:22px; margin-bottom:24px; }
.panel-head{ display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:18px; flex-wrap:wrap; }
.panel-head h2{ font-size:16px; font-weight:800; }

/* ---------------- Tables ---------------- */
.table-wrap{ overflow-x:auto; }
table{ width:100%; border-collapse:collapse; font-size:14px; }
th,td{ padding:12px 14px; text-align:right; border-bottom:1px solid var(--border); white-space:nowrap; }
th{ color:var(--text-dim); font-size:12.5px; font-weight:700; text-transform:uppercase; letter-spacing:.03em; }
tbody tr:hover{ background:var(--bg-soft); }
td.wrap{ white-space:normal; }
.row-actions{ display:flex; gap:8px; }

.badge{ display:inline-block; padding:5px 12px; border-radius:100px; font-size:12px; font-weight:700; }
.badge-new{ background:#EAF2FF; color:var(--sky-deep); }
.badge-contacted{ background:#FFF4E0; color:#B9770E; }
.badge-active{ background:#EAFBF3; color:#128A5E; }
.badge-cancelled{ background:#FDEDED; color:#C0392B; }

.empty-state{ text-align:center; padding:50px 20px; color:var(--text-faint); }

.filters{ display:flex; gap:10px; flex-wrap:wrap; margin-bottom:18px; }
.filters select, .filters input{ margin-top:0; width:auto; min-width:160px; }

.form-grid{ display:grid; grid-template-columns:1fr 1fr; gap:0 20px; }
.form-grid .full{ grid-column:1 / -1; }

@media (max-width:860px){
  .shell{ flex-direction:column; }
  .sidebar{ width:100%; flex-direction:row; align-items:center; border-left:none; border-bottom:1px solid var(--border); overflow-x:auto; }
  .side-nav{ flex-direction:row; }
  .logout-link{ flex:none; }
  .content{ padding:18px; }
  .form-grid{ grid-template-columns:1fr; }
}
