/* ==========================================================
   Addons-i Portal — login, register & dashboard
   ========================================================== */

:root {
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --dark: #0f172a;
  --text: #334155;
  --muted: #64748b;
  --bg: #f0f8fd;
  --border: #e2e8f0;
  --danger: #e11d48;
  --success: #15803d;
  --grad: linear-gradient(135deg, #0369a1 0%, #0284c7 45%, #38bdf8 100%);
  --shadow: 0 20px 50px -20px rgba(15, 23, 42, .25);
}

*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0; font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--text);
  background: var(--bg); line-height: 1.6; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: "Poppins", sans-serif; color: var(--dark); line-height: 1.25; margin: 0 0 .4em; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 26px;
  border-radius: 12px; border: 0; font: 600 15px "Poppins", sans-serif; cursor: pointer; transition: all .2s;
}
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 24px -10px rgba(2,132,199,.8); }
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-block { width: 100%; }

.brand-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border-radius: 999px;
  font-size: 13px; font-weight: 600; background: rgba(255,255,255,.15); color: #fff;
}
.brand-pill b { background: #fff; color: var(--primary); padding: 1px 8px; border-radius: 99px; font-size: 11px; }

.alert { padding: 12px 16px; border-radius: 12px; font-weight: 500; font-size: 14px; margin-bottom: 18px; }
.alert-error { background: #fff1f2; color: var(--danger); border: 1px solid #fecdd3; }
.alert-success { background: #dcfce7; color: var(--success); border: 1px solid #bbf7d0; }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.forgot-link { font-size: 13px; font-weight: 600; color: var(--primary); }
.forgot-link:hover { text-decoration: underline; }

/* ======================= AUTH (login / register) ======================= */
/* Desktop: a fixed one-screen split layout. Smaller screens scroll normally. */
.auth-body { background: #f4f7fb; }
.auth-wrap { display: grid; grid-template-columns: minmax(400px, 44%) 1fr; min-height: 100vh; min-height: 100dvh; }

/* ---- Brand panel ---- */
.auth-brand {
  position: relative; overflow: hidden; color: #cbd5e1; padding: clamp(24px, 4vh, 44px) clamp(28px, 3.4vw, 52px);
  display: flex; flex-direction: column; gap: clamp(16px, 3vh, 30px);
  background:
    radial-gradient(520px 380px at 100% 100%, rgba(56,189,248,.22), transparent 70%),
    radial-gradient(420px 320px at 0% 0%, rgba(2,132,199,.25), transparent 70%),
    linear-gradient(160deg, #081a33 0%, #0b2a4d 55%, #0c4a6e 100%);
}
.auth-brand::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgba(255,255,255,.12) 1px, transparent 1px); background-size: 22px 22px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 75%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 75%);
}
.auth-brand > * { position: relative; }
.auth-logo { display: inline-flex; background: #fff; padding: 8px 14px; border-radius: 12px; box-shadow: 0 10px 30px -12px rgba(0,0,0,.5); }
.auth-logo img { height: clamp(36px, 5.4vh, 58px); display: block; }

.brand-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; font: 600 12px "Inter"; letter-spacing: .14em; text-transform: uppercase; color: #7dd3fc;
}
.brand-eyebrow i { width: 22px; height: 2px; background: #38bdf8; border-radius: 2px; }
.brand-copy h1 {
  color: #fff; font: 600 clamp(1.45rem, 2.1vw, 2.05rem)/1.28 "Poppins"; letter-spacing: -.01em; margin: 12px 0 10px; max-width: 560px;
}
.brand-copy h1 span { color: #38bdf8; }
.brand-copy p { margin: 0; font-size: 15px; color: #94a3b8; max-width: 460px; }

.brand-products { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.bp {
  display: flex; align-items: center; gap: 12px; padding: clamp(8px, 1.4vh, 12px) 12px; border-radius: 12px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); transition: background .2s, border-color .2s;
}
.bp:hover { background: rgba(255,255,255,.08); border-color: color-mix(in srgb, var(--c) 60%, transparent); }
.bp-icon {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--c) 22%, transparent); color: color-mix(in srgb, var(--c) 55%, #fff);
}
.bp-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bp-text { display: flex; flex-direction: column; min-width: 0; }
.bp-text b { font: 600 13.5px "Poppins"; color: #fff; }
.bp-text small { font-size: 11.5px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.brand-copy { margin-top: auto; }
.brand-foot { margin-top: auto; }
.trust { list-style: none; margin: 0 0 14px; padding: 14px 0 0; border-top: 1px solid rgba(255,255,255,.1); display: flex; flex-wrap: wrap; gap: 8px 22px; }
.trust li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #cbd5e1; }
.trust svg { width: 16px; height: 16px; fill: none; stroke: #38bdf8; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.brand-foot p { margin: 0; font-size: 12px; color: #64748b; }

/* ---- Form panel ---- */
.auth-main {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: clamp(16px, 3vh, 32px) clamp(16px, 3vw, 40px); gap: clamp(10px, 2vh, 18px);
}
.auth-topline { width: 100%; max-width: 640px; display: flex; align-items: center; justify-content: flex-end; }
.auth-logo-sm { display: none; }
.auth-logo-sm img { height: 38px; display: block; }
.back-home { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 500; color: var(--muted); }
.back-home svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.back-home:hover { color: var(--primary); }

.auth-card {
  width: 100%; background: #fff; border-radius: 18px; border: 1px solid #e5eaf1;
  padding: clamp(20px, 3.4vh, 34px) clamp(20px, 2.6vw, 36px);
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 24px 48px -24px rgba(15,23,42,.18);
}
.card-login { max-width: 440px; }
.card-register { max-width: 640px; }
.auth-topline:has(+ .card-login) { max-width: 440px; }

.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: #f1f5f9; border-radius: 10px; padding: 4px; margin-bottom: clamp(14px, 2.4vh, 22px); }
.auth-tabs a { text-align: center; padding: 8px; border-radius: 8px; font: 600 14px "Inter"; color: var(--muted); transition: all .2s; }
.auth-tabs a:hover { color: var(--dark); }
.auth-tabs a.active { background: #fff; color: var(--dark); box-shadow: 0 1px 3px rgba(15,23,42,.12); }

.auth-head { margin-bottom: clamp(12px, 2.2vh, 20px); }
.auth-head h2 { font: 600 1.45rem "Poppins"; letter-spacing: -.01em; margin: 0 0 2px; }
.auth-head p { margin: 0; color: var(--muted); font-size: 14px; }

.auth-form { display: grid; gap: clamp(10px, 1.7vh, 16px); }
.auth-form.grid-2 { grid-template-columns: 1fr 1fr; column-gap: 16px; }
.span-2 { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font-size: 13px; font-weight: 600; color: #1e293b; }
.field label em { color: var(--danger); font-style: normal; }
.field label small { color: var(--muted); font-weight: 400; }

.control { position: relative; display: flex; align-items: center; }
.control > svg {
  position: absolute; left: 12px; width: 17px; height: 17px; pointer-events: none;
  fill: none; stroke: #94a3b8; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: stroke .2s;
}
.control input {
  width: 100%; height: clamp(40px, 5.4vh, 44px); font: 400 14.5px "Inter"; color: var(--dark);
  padding: 0 12px 0 38px; border-radius: 10px; border: 1px solid #d8e0ea; background: #fff;
  transition: border-color .2s, box-shadow .2s;
}
.control input::placeholder { color: #a3aebd; }
.control input:hover { border-color: #c2cdda; }
.control input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(2,132,199,.14); }
.control:focus-within > svg { stroke: var(--primary); }
.control input.has-toggle { padding-right: 60px; }
.control input.upper { text-transform: uppercase; }
.control input.upper::placeholder { text-transform: none; }
.control input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(225,29,72,.1); }

.control.prefix .cc {
  display: grid; place-items: center; height: clamp(40px, 5.4vh, 44px); padding: 0 11px; flex-shrink: 0;
  border: 1px solid #d8e0ea; border-right: 0; border-radius: 10px 0 0 10px; background: #f8fafc;
  font-size: 14px; font-weight: 600; color: #475569;
}
.control.prefix input { padding-left: 12px; border-radius: 0 10px 10px 0; }

.pass-toggle {
  position: absolute; right: 6px; border: 0; background: none; cursor: pointer; padding: 6px 8px; border-radius: 6px;
  font: 600 12.5px "Inter"; color: var(--primary);
}
.pass-toggle:hover { background: #f0f9ff; }
.error { color: var(--danger); font-size: 12px; font-weight: 500; line-height: 1.35; }

.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: #475569; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }

.auth-card .btn-primary {
  height: clamp(42px, 5.8vh, 48px); padding: 0 20px; border-radius: 10px; font: 600 15px "Inter"; margin-top: 4px;
  background: linear-gradient(180deg, #0891d1 0%, #0270ab 100%); box-shadow: 0 8px 20px -10px rgba(2,112,171,.9), inset 0 1px 0 rgba(255,255,255,.15);
}
.auth-card .btn-primary svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.auth-card .btn-primary:hover svg { transform: translateX(3px); }

.auth-switch { text-align: center; margin: clamp(12px, 2vh, 18px) 0 0; color: var(--muted); font-size: 14px; }
.auth-switch a { color: var(--primary); font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }
.auth-legal { margin: 0; font-size: 12.5px; color: #94a3b8; }
.auth-legal span { color: #64748b; font-weight: 500; }

/* Lock to one screen on desktop-sized viewports */
@media (min-width: 961px) and (min-height: 600px) {
  .auth-body { overflow: hidden; }
  .auth-wrap { height: 100vh; height: 100dvh; }
  .auth-brand, .auth-main { overflow: hidden; }
  .auth-main { overflow-y: auto; } /* safety net if many validation errors show */
}
/* Short desktop screens: trim secondary brand content */
@media (min-width: 961px) and (max-height: 760px) {
  .brand-copy p, .brand-foot p { display: none; }
  .bp-text small { display: none; }
  .bp-icon { width: 30px; height: 30px; }
  .auth-legal { display: none; }
}
@media (max-width: 1180px) and (min-width: 961px) {
  .auth-wrap { grid-template-columns: 400px 1fr; }
  .bp-text small { display: none; }
}

/* ======================= DASHBOARD ======================= */
.dash { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

.side {
  position: sticky; top: 0; height: 100vh; background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 22px 16px; z-index: 50;
}
.side-logo { display: block; padding: 4px 6px 22px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.side-logo img { height: 48px; display: block; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a, .side-logout button {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px;
  font-weight: 500; font-size: 14.5px; color: var(--text); transition: all .2s;
}
.side-nav a:hover { background: var(--bg); color: var(--primary); }
.side-nav a.active { background: var(--grad); color: #fff; box-shadow: 0 8px 18px -8px rgba(2,132,199,.8); }
.side svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.side-logout { margin-top: auto; }
.side-logout button { width: 100%; border: 0; background: #fff1f2; color: var(--danger); font-family: inherit; cursor: pointer; }
.side-logout button:hover { background: #ffe4e6; }
.side-overlay { display: none; }

.dash-main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 16px; padding: 16px 32px;
  background: rgba(255,255,255,.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 1.25rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title p { margin: 0; font-size: 13px; color: var(--muted); }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-user b { display: block; font-size: 14px; color: var(--dark); line-height: 1.2; }
.topbar-user small { color: var(--muted); font-size: 12px; }
.avatar {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--grad); color: #fff; font: 700 16px "Poppins";
}
.side-toggle { display: none; background: none; border: 0; padding: 6px; cursor: pointer; }
.side-toggle span { display: block; width: 22px; height: 2px; background: var(--dark); margin: 5px 0; border-radius: 2px; }

.dash-content { padding: 28px 32px 48px; display: grid; gap: 24px; }

.welcome {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 32px 36px; border-radius: 22px; color: #e0f2fe;
  background: linear-gradient(135deg, #0c4a6e, #075985 50%, #0284c7);
}
.welcome h2 { color: #fff; font-size: clamp(1.4rem, 2.4vw, 1.9rem); margin-top: 14px; }
.welcome p { margin: 0; opacity: .9; }
.welcome-ai {
  flex-shrink: 0; width: 96px; height: 96px; border-radius: 28px; display: grid; place-items: center;
  background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.3); color: #fff; font: 800 36px "Poppins";
}

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.stat { background: #fff; border-radius: 18px; padding: 20px 22px; border: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; }
.stat small { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.stat b { font: 700 1.5rem "Poppins"; color: var(--dark); margin: 6px 0 2px; overflow-wrap: anywhere; }
.stat b.ok { color: var(--success); }
.stat span { font-size: 13px; color: var(--muted); }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace !important; letter-spacing: .02em; }
.stat b.mono { font-size: 1.05rem; padding-top: 6px; }

.panel { background: #fff; border-radius: 22px; padding: 28px; border: 1px solid var(--border); }
.panel-head { margin-bottom: 20px; }
.panel-head h3 { font-size: 1.2rem; margin: 0; }
.panel-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.prod-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.prod {
  position: relative; display: flex; flex-direction: column; padding: 22px; border-radius: 18px;
  border: 1px solid var(--border); transition: all .25s; background: #fff;
}
.prod:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--c) 35%, #fff); }
.prod-ai { position: absolute; top: 18px; right: 18px; background: var(--grad); color: #fff; font: 800 11px "Poppins"; padding: 3px 9px; border-radius: 7px; }
.prod-icon {
  width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 14px;
  background: color-mix(in srgb, var(--c) 12%, #fff); color: var(--c);
}
.prod-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.prod h4 { font-size: 1.08rem; margin: 0 0 2px; }
.prod p { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; }
.prod-feature {
  font-size: 13px; font-weight: 500; color: var(--c); padding: 8px 12px; border-radius: 10px; margin-bottom: 16px;
  background: color-mix(in srgb, var(--c) 7%, #fff);
}
.prod-btn {
  margin-top: auto; text-align: center; padding: 10px; border-radius: 10px; font: 600 14px "Poppins";
  background: var(--c); color: #fff;
}
.prod-btn:hover { filter: brightness(1.08); }
.prod-btn.soon { background: var(--bg); color: var(--muted); cursor: default; filter: none; }

.profile { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 28px; margin: 0; }
.profile div { padding: 14px 0; border-bottom: 1px solid #f1f5f9; min-width: 0; }
.profile .wide { grid-column: 1 / -1; border-bottom: 0; }
.profile dt { font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.profile dd { margin: 4px 0 0; font-weight: 500; color: var(--dark); overflow-wrap: anywhere; }

/* ======================= RESPONSIVE ======================= */
@media (max-width: 1200px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .prod-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 960px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-main { justify-content: flex-start; padding-top: 24px; }
  .auth-topline { justify-content: space-between; }
  .auth-logo-sm { display: inline-flex; }
  .dash { grid-template-columns: 1fr; }
  .side {
    position: fixed; left: 0; top: 0; bottom: 0; width: 270px; height: auto; transform: translateX(-100%);
    transition: transform .3s ease; box-shadow: 20px 0 40px -20px rgba(0,0,0,.3);
  }
  .side.open { transform: none; }
  .side-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 45; }
  .side-overlay.show { display: block; }
  .side-toggle { display: block; }
  .topbar { padding: 14px 18px; }
  .dash-content { padding: 20px 18px 40px; }
}

@media (max-width: 600px) {
  .auth-form.grid-2 { grid-template-columns: 1fr; }
  .auth-card { border-radius: 16px; }
  .stats, .prod-grid, .profile { grid-template-columns: 1fr; }
  .welcome { padding: 24px; }
  .welcome-ai { display: none; }
  .topbar-user div { display: none; }
  .panel { padding: 20px; }
}

/* ======================= SHARED: plans, tables, badges ======================= */
.stat b .of { font-style: normal; font-size: .95rem; color: var(--muted); font-weight: 500; }
.muted { color: var(--muted); }
.empty { margin: 0; padding: 28px; text-align: center; color: var(--muted); background: #f8fafc; border-radius: 14px; border: 1px dashed var(--border); }

.prod-state {
  position: absolute; top: 18px; right: 18px; font: 600 11.5px "Inter"; padding: 4px 10px; border-radius: 99px;
}
.prod-state.live { background: #dcfce7; color: #15803d; }
.prod-state.pending { background: #fef3c7; color: #b45309; }
.prod-state.expired { background: #fee2e2; color: #b91c1c; }
.prod-meta { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.prod-meta span:first-child { color: var(--dark); font-weight: 600; }
.prod-btn.outline { background: #fff; color: var(--c); border: 1.5px solid var(--c); }
button.prod-btn { border: 0; cursor: pointer; font: 600 14px "Poppins"; width: 100%; }

.plan-pick { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.plan-opt {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 13.5px; transition: border-color .15s, background .15s;
}
.plan-opt:hover { border-color: color-mix(in srgb, var(--c) 45%, #fff); }
.plan-opt:has(input:checked) { border-color: var(--c); background: color-mix(in srgb, var(--c) 6%, #fff); }
.plan-opt input { accent-color: var(--c); margin: 0; }
.plan-name { font-weight: 600; color: var(--dark); }
.plan-price { font-weight: 700; color: var(--dark); white-space: nowrap; }
.plan-price small { font-weight: 500; color: var(--muted); font-size: 11.5px; }
.plan-pick .prod-btn { margin-top: 6px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 720px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  background: #f8fafc; padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafcff; }
.table td b { color: var(--dark); font-weight: 600; }
.table .num { text-align: right; white-space: nowrap; }
.table small { font-size: 12.5px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; font: 600 12px "Inter"; padding: 3px 10px; border-radius: 99px; white-space: nowrap;
  background: #f1f5f9; color: #475569;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.active, .badge.paid { background: #dcfce7; color: #15803d; }
.badge.pending, .badge.unpaid { background: #fef3c7; color: #b45309; }
.badge.expired, .badge.suspended { background: #fee2e2; color: #b91c1c; }
.badge.cancelled, .badge.inactive { background: #f1f5f9; color: #64748b; }
