:root{
  --bg: #070414;
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.64);

  /* neon default */
  --p: 168 85 247;
  --c: 34 211 238;
  --m: 236 72 153;
  --deep: 109 40 217;

  --border: rgba(255,255,255,.10);
  --card: rgba(255,255,255,.06);
  --card2: rgba(255,255,255,.035);

  --shadow: 0 26px 90px rgba(0,0,0,.55);
  --radius: 18px;

  --gap: 10px;

  /* ===== Premium UI tokens (themed) ===== */
  --ui-underline: linear-gradient(90deg, rgba(var(--p), .95), rgba(var(--c), .95));
  --ui-underline-off: rgba(255,255,255,.16);

  --ui-text-off: rgba(255,255,255,.70);
  --ui-text-on: rgba(255,255,255,.96);

  --ui-glow-soft: 0 0 0 4px rgba(var(--c), .10), 0 18px 60px rgba(var(--p), .12);
  --ui-glow:      0 0 0 4px rgba(var(--c), .12), 0 18px 60px rgba(var(--p), .14);
  --ui-glow-strong: 0 0 0 4px rgba(var(--c), .16), 0 26px 90px rgba(var(--p), .18);

  --ui-sweep-ms: 520ms;
  --ui-pulse-s: 3.4s;
}

body[data-theme="purple"]{
  --bg: #050013;
  --p: 168 85 247;
  --c: 139 92 246;
  --m: 217 70 239;
  --deep: 88 28 135;

  --ui-underline-off: rgba(255,255,255,.17);
}

body[data-theme="dark"]{
  --bg: #05060a;
  --p: 99 102 241;
  --c: 148 163 184;
  --m: 148 163 184;
  --deep: 30 41 59;

  --ui-underline-off: rgba(255,255,255,.18);
}

/* ===== Base ===== */
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* ===== Background ===== */
.bg{ position:fixed; inset:0; pointer-events:none; }
.bg-aurora{
  position:absolute;
  inset:-35%;
  background:
    radial-gradient(900px 700px at 12% 18%, rgba(var(--p), .28), transparent 60%),
    radial-gradient(900px 700px at 88% 22%, rgba(var(--c), .20), transparent 60%),
    radial-gradient(900px 700px at 50% 96%, rgba(var(--m), .16), transparent 62%),
    radial-gradient(1100px 900px at 60% 35%, rgba(var(--deep), .18), transparent 65%);
  filter: blur(26px);
  opacity: .95;
  animation: floaty 12s ease-in-out infinite;
}
@keyframes floaty{
  0%,100%{ transform: translate3d(0,0,0) scale(1); }
  50%{ transform: translate3d(2%, -1.5%, 0) scale(1.02); }
}
.bg-grid{
  position:absolute;
  inset:0;
  background:
    linear-gradient(to right, rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 70px 70px;
  mask-image: radial-gradient(closest-side, rgba(0,0,0,.55), transparent 72%);
  opacity: .40;
}
.bg-noise{
  position:absolute;
  inset:-20%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)' opacity='.25'/%3E%3C/svg%3E");
  opacity: .18;
  mix-blend-mode: overlay;
  filter: contrast(110%) brightness(110%);
}

.shell{
  max-width: 1280px;
  margin: 12px auto;
  padding: 12px;
  position: relative;
}

/* ===== Hero ===== */
.hero{
  border-radius: calc(var(--radius) + 6px);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--card), var(--card2));
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.hero-inner{
  padding: 12px 12px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}

.brand{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 320px;
}
.brand-mark{
  width: 42px;
  height: 42px;
  border-radius: 999px;          /* rotund */
  display: grid;
  place-items: center;
  overflow: hidden;              /* taie poza în cerc */
  background: rgba(0,0,0,.22);
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 14px 50px rgba(0,0,0,.55);
}

.brand-logo{
  width: 100%;
  height: 100%;
  object-fit: cover;             /* umple cercul frumos */
  display: block;
}
.brand-title{
  font-weight: 1000;
  font-size: 18px;
  letter-spacing: .2px;
  line-height: 1.05;
}
.brand-title-accent{
  background: linear-gradient(90deg, rgba(var(--p), .95), rgba(var(--c), .95));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sub{
  margin-top: 6px;
  color: rgba(255,255,255,.68);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
}
.brand-sub b{ color: rgba(255,255,255,.92); }

.top-actions{ display:flex; align-items:center; }
.action-row{ display:flex; gap: 10px; flex-wrap:wrap; justify-content:flex-end; align-items:center; }

/* ===== Buttons (base) ===== */
.btn{
  cursor:pointer;
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(var(--c), .22);
  font-weight: 1000;
  background: linear-gradient(135deg, rgba(var(--p), .95), rgba(var(--c), .95));
  box-shadow: 0 10px 34px rgba(0,0,0,.45);
  transition: transform .08s ease, filter .2s ease, box-shadow .2s ease;
  color: var(--ui-text-on);
  text-shadow: 0 1px 0 rgba(0,0,0,.35);
}
.btn:active{ transform: translateY(1px); }
.btn:hover{ filter: brightness(1.05); }

.btn.ghost{
  background: rgba(0,0,0,.22);
  color: var(--ui-text-off);
  border-color: rgba(255,255,255,.14);
  box-shadow: none;
}

/* issue button + iconbtn inherit premium underline too */
.iconbtn,
.issue button{
  cursor:pointer;
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.22);
  color: var(--ui-text-off);
  font-weight: 1000;
}

/* ===== Toggle ===== */
.toggle{
  display:flex; align-items:center; gap: 10px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.20);
}
.toggle input{ position:absolute; opacity:0; pointer-events:none; }
.toggle .track{
  width: 44px; height: 24px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.08);
  position: relative;
}
.toggle .thumb{
  width: 18px; height: 18px; border-radius: 999px;
  position:absolute; top:50%; left:3px;
  transform: translateY(-50%);
  background: rgba(255,255,255,.90);
  transition: left .18s ease;
}
.toggle .tlabel{ font-weight: 950; color: rgba(255,255,255,.82); font-size: 12px; }
.toggle input:checked + .track{
  background: linear-gradient(135deg, rgba(var(--p), .55), rgba(var(--c), .45));
  border-color: rgba(var(--c), .30);
}
.toggle input:checked + .track .thumb{ left: 22px; background: #070715; }

/* ===== Theme select wrapper ===== */
.theme{
  display:flex; align-items:center; gap: 10px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.20);
}
.theme .tlabel{ font-weight: 950; color: rgba(255,255,255,.82); font-size: 12px; }

/* ===== Inputs ===== */
.input{
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.22);
  color: rgba(255,255,255,.90);
  outline:none;
}
.input:focus{
  border-color: rgba(var(--c), .35);
  box-shadow: 0 0 0 4px rgba(var(--c), .14);
}
.input.small{ padding: 10px 12px; min-width: 200px; }
.input.tiny{ padding: 8px 10px; border-radius: 12px; }

/* ===== Layout ===== */
.layout{
  margin-top: var(--gap);
  display:grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gap);
}
.span-12{ grid-column: span 12; }
.span-6{ grid-column: span 6; }

/* ===== Cards ===== */
.card{
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--card), var(--card2));
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  padding: 12px;
  position: relative;
  overflow: hidden;
}
.card::before{
  content:"";
  position:absolute;
  inset:-2px;
  background:
    radial-gradient(900px 220px at 10% 0%, rgba(var(--p), .16), transparent 55%),
    radial-gradient(900px 220px at 90% 0%, rgba(var(--c), .12), transparent 55%);
  opacity:.85;
  pointer-events:none;
}
.card > *{ position: relative; z-index: 1; }

.card-head{ margin-bottom: 10px; }
.card-head.row{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 10px;
}
.card-title{ font-weight: 1000; letter-spacing: .2px; }
.card-sub{
  margin-top: 6px;
  color: rgba(255,255,255,.65);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
}

.textarea{
  width:100%;
  min-height: 220px;
  resize: vertical;
  padding: 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.22);
  color: rgba(255,255,255,.92);
  outline:none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 20px;
}
.textarea:focus{
  border-color: rgba(var(--c), .35);
  box-shadow: 0 0 0 4px rgba(var(--c), .14);
}
.smallarea{ min-height: 150px; }

.inline-hint{
  margin-top: 8px;
  color: rgba(255,255,255,.62);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
}

.divider{
  height:1px;
  background: rgba(255,255,255,.10);
  margin: 10px 0;
}

/* ===== Issues ===== */
.issues{
  margin-top: 10px;
  display:none;
  gap: 10px;
  flex-direction: column;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(var(--m), .20);
  background: rgba(0,0,0,.18);
}
.issues.show{ display:flex; }
.issues-title{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  font-weight: 900;
  color: rgba(255,255,255,.78);
  font-size: 12px;
}
.issues-list{ display:flex; flex-direction: column; gap: 8px; }
.issue{
  display:flex; align-items:center; justify-content:space-between; gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.20);
}
.issue .meta{ font-size: 12px; font-weight: 950; color: rgba(255,255,255,.80); }
.issue .msg{ font-size: 12px; font-weight: 850; color: rgba(255,255,255,.62); margin-top:4px; }

/* ===== Quick add ===== */
.quick-title{ font-weight: 1000; margin-bottom: 10px; color: rgba(255,255,255,.82); }
.quick-row{
  display:grid;
  grid-template-columns: minmax(90px, 120px) minmax(0, 1fr) minmax(120px, 170px) minmax(90px, 120px);
  gap: 10px;
  align-items:end;
}
.quick-row .field{ min-width: 0; }
.quick-row .input{ min-width: 0; width: 100%; }
#qaAdd{ width: 100%; }

@media (max-width: 980px){
  .quick-row{ grid-template-columns: 1fr 1fr; }
  .quick-row .field:nth-child(2){ grid-column: span 2; }
  .quick-row #qaAdd{ grid-column: span 2; }
}
@media (max-width: 520px){
  .quick-row{ grid-template-columns: 1fr; }
  .quick-row .field:nth-child(2){ grid-column: auto; }
  .quick-row #qaAdd{ grid-column: auto; }
}

.field{ display:flex; flex-direction:column; gap: 6px; }
.field span{ font-size: 12px; color: rgba(255,255,255,.60); font-weight: 900; }

/* ===== Tables ===== */
.table-wrap{
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  overflow:auto;
}
.table{
  width:100%;
  border-collapse: collapse;
  min-width: 520px;
}
.table th, .table td{
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-align:left;
  font-weight: 850;
}
.table thead th{
  position: sticky;
  top: 0;
  background: rgba(0,0,0,.30);
  backdrop-filter: blur(10px);
  z-index: 1;
  color: rgba(255,255,255,.78);
}
.table tfoot td{ background: rgba(0,0,0,.18); }
.right{ text-align:right !important; }
.muted{ color: rgba(255,255,255,.60); font-weight: 850; }

/* ===== Stats ===== */
.stats{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.stat{
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.20);
}
.stat.span2{ grid-column: span 2; }
.k{ color: rgba(255,255,255,.62); font-size: 12px; font-weight: 900; }
.v{
  margin-top: 8px;
  font-size: 22px;
  font-weight: 1000;
  color: rgba(255,255,255,.95);
  text-shadow: 0 0 18px rgba(var(--c), .14);
}
.v.big{ font-size: 26px; }

.money-title{ font-weight: 1000; }
.money-sub{ margin-top: 6px; color: rgba(255,255,255,.62); font-size: 12px; font-weight: 850; }

/* ===== Settings ===== */
.details{ border-radius: 16px; }
.summary{
  cursor:pointer;
  list-style:none;
  user-select:none;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.16);
  font-weight: 1000;
}
.summary::-webkit-details-marker{ display:none; }
.chev{ color: rgba(255,255,255,.68); font-weight: 1000; }
details[open] .chev{ transform: rotate(180deg); display:inline-block; }

.settings{ margin-top: 10px; }
.settings-tabs{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  margin-bottom: 10px;
}
.stab{
  cursor:pointer;
  border-radius: 999px;
  padding: 9px 12px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.20);
  color: var(--ui-text-off);
  font-weight: 950;
}
.spacer{ flex:1; }

.grid2{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.pane{
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.20);
}
.pane-title{ font-weight: 1000; }
.pane-sub{ margin-top: 6px; color: rgba(255,255,255,.62); font-size: 12px; font-weight: 850; }
.form-row{ margin-top: 10px; }

.spec-table-wrap{
  margin-top: 10px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  overflow:auto;
}
.spec-table{
  width:100%;
  border-collapse: collapse;
  min-width: 460px;
}
.spec-table th, .spec-table td{
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  font-weight: 850;
  text-align:left;
}
.spec-table thead th{
  background: rgba(0,0,0,.28);
  color: rgba(255,255,255,.78);
  position: sticky;
  top: 0;
}

.addrow{
  margin-top: 10px;
  display:grid;
  grid-template-columns: 1fr 160px 120px;
  gap: 10px;
  align-items:end;
}
.addrow.one{ grid-template-columns: 1fr 120px; }

.check{ display:flex; align-items:flex-start; gap:10px; user-select:none; margin-top: 10px; }
.check input{ margin-top: 3px; transform: scale(1.05); }
.check span{ font-weight: 900; color: rgba(255,255,255,.82); }

.preset-list{ margin-top: 10px; display:flex; flex-direction:column; gap: 10px; }
.preset-item{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
}
.preset-name{ font-weight: 1000; color: rgba(255,255,255,.88); }
.preset-actions{ display:flex; gap: 8px; flex-wrap:wrap; }

/* ===== Footer ===== */
.footer{
  margin-top: var(--gap);
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--card), var(--card2));
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}
.foot-left{ display:flex; align-items:center; gap:10px; }
.dot{
  width:10px; height:10px;
  border-radius:999px;
  background: linear-gradient(135deg, rgba(var(--p), .95), rgba(var(--c), .95));
  box-shadow: 0 0 0 5px rgba(var(--c), .12);
}
.foot-text{ color: rgba(255,255,255,.65); font-weight: 900; font-size: 12px; }

/* ===== Responsive ===== */
@media (max-width: 1100px){
  .hero-inner{ flex-direction: column; align-items:flex-start; }
  .span-6{ grid-column: span 12; }
  .quick-row{ grid-template-columns: 1fr; }
  .grid2{ grid-template-columns: 1fr; }
  .addrow{ grid-template-columns: 1fr; }
  .addrow.one{ grid-template-columns: 1fr; }
}

/* =========================================================
   NEXT LEVEL UI: Underline sweep + glow pulse (themed)
   Applies to: .btn / .btn.ghost / .iconbtn / .issue button / .stab
   ========================================================= */

/* underline base */
.btn, .btn.ghost, .iconbtn, .issue button, .stab{
  position: relative;
  overflow: hidden;
}

/* underline pseudo */
.btn::after, .btn.ghost::after, .iconbtn::after, .issue button::after, .stab::after{
  content:"";
  position:absolute;
  left: 12px;
  right: 12px;
  bottom: 7px;
  height: 2px;
  border-radius: 999px;
  background: var(--ui-underline-off);
  opacity: .55;
  transform: scaleX(.55);
  transform-origin: center;
  transition: opacity .18s ease, transform .18s ease, background .18s ease, filter .18s ease;
}

/* hover */
.btn:hover::after, .btn.ghost:hover::after, .iconbtn:hover::after, .issue button:hover::after, .stab:hover::after{
  opacity: .86;
  transform: scaleX(.82);
}

/* Focus/pressed => themed underline + sweep */
.btn:active::after,
.btn:focus-visible::after,
.btn.ghost:active::after,
.btn.ghost:focus-visible::after,
.iconbtn:active::after,
.iconbtn:focus-visible::after,
.issue button:active::after,
.issue button:focus-visible::after{
  background: var(--ui-underline);
  opacity: 1;
  transform: scaleX(1);
  filter: drop-shadow(0 0 14px rgba(var(--c), .22));
  background-size: 220% 100%;
  animation: uiSweep var(--ui-sweep-ms) ease-out both;
}

/* buttons focus glow */
.btn:focus-visible,
.btn.ghost:focus-visible,
.iconbtn:focus-visible,
.issue button:focus-visible{
  outline: none;
  box-shadow: var(--ui-glow);
}

/* Make ghost/icon/issue stay grey until interaction */
.btn.ghost, .iconbtn, .issue button{
  color: var(--ui-text-off);
  border-color: rgba(255,255,255,.14);
}
.btn.ghost:hover, .iconbtn:hover, .issue button:hover{
  color: rgba(255,255,255,.86);
  border-color: rgba(var(--c), .18);
}

/* Tabs: inactive grey, active glow + underline themed + pulse */
.stab{
  color: var(--ui-text-off);
  background: rgba(0,0,0,.18);
  border-color: rgba(255,255,255,.12);
}

.stab:hover{
  color: rgba(255,255,255,.86);
  border-color: rgba(var(--c), .20);
}

/* active tab */
.stab.active{
  color: var(--ui-text-on);
  border-color: rgba(var(--c), .35);
  background: rgba(0,0,0,.22);
  box-shadow: var(--ui-glow);
}

/* active underline sweep (plays on load; still looks premium) */
.stab.active::after{
  background: var(--ui-underline);
  opacity: 1;
  transform: scaleX(1);
  filter: drop-shadow(0 0 14px rgba(var(--c), .22));
  background-size: 220% 100%;
  animation: uiSweep var(--ui-sweep-ms) ease-out both;
}

/* subtle pulse glow on active tab (mov-cyan) */
.stab.active{
  animation: uiPulse var(--ui-pulse-s) ease-in-out infinite;
}

/* press */
.stab:active{
  transform: translateY(1px);
}

/* keyframes */
@keyframes uiSweep{
  0%{ background-position: 0% 50%; }
  100%{ background-position: 100% 50%; }
}
@keyframes uiPulse{
  0%,100%{ box-shadow: var(--ui-glow-soft); }
  50%{ box-shadow: var(--ui-glow); }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
  .bg-aurora{ animation: none !important; }
  .stab.active{ animation: none !important; }
  .btn:active::after,
  .btn:focus-visible::after,
  .btn.ghost:active::after,
  .btn.ghost:focus-visible::after,
  .iconbtn:active::after,
  .iconbtn:focus-visible::after,
  .issue button:active::after,
  .issue button:focus-visible::after,
  .stab.active::after{
    animation: none !important;
  }
}
