:root{
  --bg:#0b0b0b;
  --surface:#0e0e10;
  --card:#121216;
  --muted:#9aa0a6;
  --text:#ffffff;
  --primary:#5b8cff;
  --primary-contrast:#0b1a3f;
  --ring:#5b8cff66;
  --border:#1b1b1f;
  --success:#2ecc71;
  --danger:#ff6b6b;
  --radius:12px;
  --shadow:0 10px 30px rgba(0,0,0,.35), 0 2px 8px rgba(0,0,0,.4);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  font-family:Inter,Arial,Helvetica,sans-serif;
  background:radial-gradient(1200px 600px at 10% -10%, #121423 0%, rgba(18,20,35,0) 60%),
             radial-gradient(1000px 500px at 90% -20%, #1b1230 0%, rgba(27,18,48,0) 55%),
             var(--bg);
  color:var(--text);
  margin:0;
  line-height:1.55;
}

.container{max-width:1080px;margin:28px auto;padding:0 20px}
.header{position:sticky;top:0;z-index:100;background:rgba(10,10,12,.7);backdrop-filter: blur(8px);border-bottom:1px solid var(--border)}
.header-inner{display:flex;align-items:center;justify-content:space-between;padding:14px 0}
.brand{font-weight:700;letter-spacing:.4px;color:#fff;text-decoration:none}
.nav a{color:#cfcfcf;margin-left:16px;text-decoration:none;padding:8px 10px;border-radius:8px}
.nav a:hover{background:#141418}
.user-pill{margin-left:8px;color:var(--danger);opacity:.95;font-weight:700; text-decoration: underline; text-underline-offset: 2px}

.main{background:linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0));padding:24px;border-radius:var(--radius);box-shadow:var(--shadow)}

/* Buttons */
.btn{display:inline-block;border:1px solid var(--border);background:#17171a;color:#fff;padding:10px 14px;border-radius:10px;text-decoration:none;cursor:pointer;transition:box-shadow .18s ease, background-color .18s ease, color .18s ease}
/* Hover: keep white button look with black text and a light red shadow */
.btn:hover{background:#ffffff !important; color:#0b0f19 !important; box-shadow:0 4px 12px rgba(220,38,38,.22) !important; transform:none}
.btn:focus{outline:none;box-shadow:0 0 0 4px var(--ring)}
.btn-primary{background:linear-gradient(180deg, #ef4444, #dc2626);border-color:#b91c1c}
.btn-ghost{background:transparent}

/* Special black button variant */
.btn-black{background:#000000 !important; color:#ffffff !important; border-color:#000000 !important}

/* Forms */
form label{display:block;margin-top:12px;color:var(--muted);font-size:.95rem}
.input, input, textarea, select{width:100%;padding:12px 12px;border-radius:10px;border:1px solid var(--border);background:#0b0b0f;color:#fff;transition:.15s ease}
.input:focus, input:focus, textarea:focus, select:focus{outline:none;border-color:#2a2b34;box-shadow:0 0 0 4px var(--ring)}
.inline-msg{color:var(--danger)}

/* Alerts */
.alerts{margin-bottom:16px}
.alert{background:#0e141a;border:1px solid #122033;color:#dce8ff;padding:10px 12px;border-radius:10px;margin-bottom:8px}

/* Cards & grids */
.cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:16px}
.card{background:var(--card);border:1px solid var(--border);border-radius:14px;padding:16px;box-shadow:var(--shadow)}
.card .title{font-weight:600}
.card.span-2{grid-column:span 2}

/* Devices */
.devices-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:16px;margin-bottom:24px}
.device-card{background:var(--card);border:1px solid var(--border);border-radius:14px;overflow:hidden}
.device-card .thumb{height:120px;background:url('/static/img/placeholder-device.svg') center/72px 72px no-repeat, linear-gradient(180deg, #14161c, #0f1015)}
.device-card .body{padding:12px}
.device-card .meta{color:var(--muted);font-size:.92rem}
.device-card .actions{display:flex;gap:8px;margin-top:8px}

.muted{color:var(--muted);font-size:0.92rem}
.capitalize{text-transform:capitalize}
.form-row.small{max-width:220px}
.footer{padding:18px 0;text-align:center;color:var(--muted);margin-top:28px}

/* Emphasis utilities */
.accent-red{color:var(--danger);}
.caps{text-transform:uppercase; letter-spacing:.06em}

/* Icon-only buttons utility */
.btn-icon{width:36px; height:36px; display:inline-flex; align-items:center; justify-content:center; padding:0}
.btn-icon.btn-sm{width:32px; height:32px}

/* Hero sections */
.hero{position:relative;border-radius:var(--radius);overflow:hidden}
.hero::before{content:'';position:absolute;inset:0;background:radial-gradient(800px 300px at 10% -10%, rgba(91,140,255,.25), rgba(91,140,255,0)), linear-gradient(180deg, rgba(0,0,0,.3), rgba(0,0,0,.6)), url('/static/img/hero-bg.svg') center/cover no-repeat;filter:saturate(1.1)}
.hero .overlay{position:relative;padding:40px 24px}
.hero .card{max-width:520px;margin:0 auto;background:rgba(16,16,22,.8)}

/* Gallery */
.thumb-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:10px}
.thumb-grid img{width:100%;height:120px;object-fit:cover;border-radius:10px;border:1px solid var(--border)}

/* Device type backgrounds for thumbs */
.device-card.phone .thumb{background:url('/static/fa/svgs/solid/mobile-screen-button.svg') center/90px 90px no-repeat, linear-gradient(180deg, #f1f5f9, #e2e8f0) !important; opacity:0.95}
.device-card.laptop .thumb{background:url('/static/fa/svgs/solid/laptop.svg') center/100px 100px no-repeat, linear-gradient(180deg, #f1f5f9, #e2e8f0) !important}
.device-card.tablet .thumb{background:url('/static/fa/svgs/solid/tablet-screen-button.svg') center/90px 90px no-repeat, linear-gradient(180deg, #f1f5f9, #e2e8f0) !important}
.device-card.vehicle .thumb{background:url('/static/fa/svgs/solid/car.svg') center/110px 110px no-repeat, linear-gradient(180deg, #f1f5f9, #e2e8f0) !important}
.device-card.appliance .thumb{background:url('/static/fa/svgs/solid/plug-circle-bolt.svg') center/90px 90px no-repeat, linear-gradient(180deg, #f1f5f9, #e2e8f0) !important}

/* Footer actions pinned to base of device cards */
.device-card .body{display:flex; flex-direction:column; min-height:160px}
.device-card .actions{margin-top:auto; display:flex; gap:8px; justify-content:flex-end}

/* Profile banner/avatar sizing */
.profile-banner{display:flex; align-items:stretch; gap:16px; flex-wrap:wrap; min-height:160px}
.profile-details{flex:1 1 320px; min-width:240px}
.profile-avatar-lg{height:100%; aspect-ratio:1/1; width:auto; min-width:120px; max-height:220px; border-radius:16px; background:#f1f5f9; color:#111827; font-weight:700; overflow:hidden; display:inline-flex; align-items:center; justify-content:center}

/* Prevent text overlapping avatar on wider screens by reserving avatar width
   and nudging the text block to the right */
@media (min-width: 721px){
  .profile-banner{flex-wrap:nowrap}
  .profile-avatar-lg{flex:0 0 200px}
  .profile-details{margin-left:24px}
}


/* === Light theme overrides (white background, black text, rounded buttons, responsive) === */
/* Variables override */
:root{
  --bg:#ffffff;
  --surface:#f8fafc;
  --card:#ffffff;
  --muted:#475569; /* slate-600 */
  --text:#0b0f19;  /* near-black */
  --primary:#2563eb; /* blue-600 */
  --primary-contrast:#ffffff;
  --ring:rgba(37,99,235,.25);
  --border:#e5e7eb; /* gray-200 */
  --success:#16a34a; /* green-600 */
  --danger:#dc2626;  /* red-600 */
  --radius:14px;
  --shadow:0 8px 24px rgba(2,6,23,.06), 0 1px 2px rgba(2,6,23,.08);
}

/* Base */
body{
  background:#fff !important; /* ensure plain white background */
  color:var(--text) !important; /* dark text */
}

.header{background:#ffffffcc !important; border-bottom:1px solid var(--border) !important; backdrop-filter:saturate(1.1) blur(6px)}
.brand{color:#111827 !important}
.nav a{color:#111827 !important}
.nav a:hover{background:#f1f5f9 !important}
.user-pill{color:var(--danger) !important; font-weight:700 !important; text-decoration: underline !important; text-underline-offset: 2px !important}

.main{background:linear-gradient(180deg, rgba(15,23,42,.02), rgba(15,23,42,0)) !important}

/* Buttons: rounded edges and clear contrast */
.btn{background:#f8fafc !important; color:#0b0f19 !important; border:1px solid var(--border) !important; border-radius:14px !important; padding:10px 16px}
/* Light theme hover: white with black text and red shadow */
.btn:hover{background:#ffffff !important; color:#0b0f19 !important; box-shadow:0 4px 12px rgba(220,38,38,.22) !important}
.btn-primary{background:linear-gradient(180deg, #ef4444, #dc2626) !important; color:#fff !important; border-color:#b91c1c !important; border-radius:14px !important}
.btn-ghost{background:transparent !important; color:#0b0f19 !important}
/* Black button for light theme as well */
.btn-black{background:#000000 !important; color:#ffffff !important; border-color:#000000 !important}

/* Forms on white */
form label{color:#334155 !important}
.input, input, textarea, select{background:#fff !important; color:#0b0f19 !important; border:1px solid var(--border) !important; border-radius:12px !important}
.input:focus, input:focus, textarea:focus, select:focus{border-color:#93c5fd !important; box-shadow:0 0 0 4px var(--ring) !important}

/* Alerts on light */
.alert{background:#f8fafc !important; border:1px solid var(--border) !important; color:#0b0f19 !important; border-radius:12px}

/* Cards & device visuals */
.card{background:var(--card) !important; border:1px solid var(--border) !important; box-shadow:var(--shadow)}
.device-card{background:var(--card) !important; border:1px solid var(--border) !important; border-radius:16px !important; box-shadow:var(--shadow)}
.device-card .thumb{background:url('/static/img/placeholder-device.svg') center/72px 72px no-repeat, linear-gradient(180deg, #f1f5f9, #e2e8f0) !important}
.device-card .meta{color:#64748b !important}
.footer{color:#64748b !important}

/* Transactions tabs: full width and bold black text */
.nav.nav-tabs.full-width{display:flex; width:100%}
.nav.nav-tabs.full-width .nav-item{flex:1 1 0}
.nav.nav-tabs.full-width .nav-link{width:100%; text-align:center}
.nav-tabs .nav-link{color:#0b0f19 !important; font-weight:700}
.nav-tabs .nav-link.active{color:#0b0f19 !important}

/* Equal-size quick action buttons */
.btn-block{display:block; width:100%}
.quick-actions .btn{height:44px}

/* Hero adjustments for light background */
.hero::before{background:radial-gradient(900px 320px at 10% -10%, rgba(37,99,235,.08), rgba(37,99,235,0)), linear-gradient(180deg, rgba(255,255,255,.6), rgba(255,255,255,.9)) !important}
.hero .card{background:rgba(255,255,255,.92) !important; border:1px solid var(--border) !important}

/* Gallery */
.thumb-grid img{border-radius:12px !important; border:1px solid var(--border) !important; box-shadow:0 2px 8px rgba(2,6,23,.06)}

/* Responsive: stack grids and adjust spacing on small screens */
@media (max-width: 720px){
  .container{margin:16px auto; padding:0 14px}
  .header-inner{flex-wrap:wrap; gap:8px}
  .nav a{margin-left:8px}
  .devices-grid{grid-template-columns:1fr !important}
  .cards{grid-template-columns:1fr !important}
  .card.span-2{grid-column:span 1 !important}
  .form-row.small{max-width:100%}
  .profile-banner{min-height:0}
  .profile-avatar-lg{height:120px; width:120px; aspect-ratio:auto}
}

/* Settings: full-width profile banner image */
.settings-profile-banner img{width:100%; height:auto; display:block; border-radius:12px}
.settings-profile-banner .placeholder{width:100%; border-radius:12px}

/* Notifications: viewed state appears blurred/dimmed */
.notif-viewed{filter: blur(0.6px); opacity:.6}

/* Settings: pin submit buttons to the base of their cards */
.settings-card{display:flex; flex-direction:column}
.settings-card form{display:flex; flex-direction:column; height:100%}
.settings-card .btn-submit{margin-top:auto}
