/* ========== CSS VARIABLES: THEME TOKENS ========== */
:root{
  --bg0: #070b12;
  --bg1: #070b12;
  --surface: rgba(255,255,255,0.06);
  --surface2: rgba(255,255,255,0.09);
  --line: rgba(255,255,255,0.12);

  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.62);

  /* NEW: Dedicated title colour for stronger hierarchy */
  --title-color: #ffffff;

  --accent: #44d1ff;
  --accent2: #7a5cff;

  --danger: #ff5a5a;

  --radius: 16px;
  --radius2: 12px;

  --shadow2: 0 10px 28px rgba(0,0,0,0.35);

  --font: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* ========== LIGHT MODE OVERRIDES ========== */
[data-theme="light"]{
  --bg0: #f5f7fb;
  --bg1: #ffeeee;
  --surface: rgba(10,18,32,0.05);
  --surface2: rgba(10,18,32,0.07);
  --line: rgba(10,18,32,0.12);

  --text: rgba(10,18,32,0.92);
  --muted: rgba(10,18,32,0.60);

  /* NEW: Dark titles for light theme */
  --title-color: #0a1220;

  --shadow2: 0 10px 28px rgba(10, 18, 32, 0.354);
}

/* ========== RESET / BASE ========== */
*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg0);
}

/* ========== APP SHELL LAYOUT ========== */
.app{ min-height:100%; padding: 16px; }

.topbar{
  display:flex;
  flex-direction: column;
  align-items:flex-start;
  justify-content: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.06));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow2);
}

.body{
  display:grid;
  grid-template-columns: 260px 1fr;
  gap: 14px;
  margin-top: 14px;
}

/* ========== TOP BAR ========== */
.brand{
  display:flex;
  align-items:center;
  gap: 12px;
  min-width: 0;
  width: 100%;
}
.brand-logo{ width: 40px; height: 40px; border-radius: 10px; box-shadow: 0 10px 22px rgba(0,0,0,0.25); }
.brand-title{ font-size: 16px; font-weight: 700; letter-spacing: .2px; }
.brand-sub{ margin-top: 2px; font-size: 12px; color: var(--muted); }
.topbar-right{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
}

/* ========== BADGES (used in top bar + sidebar PRO tags) ========== */
.badge{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.badge.status{ font-weight: 700; color: var(--text); }
.dot{
  width: 10px; height: 10px;
  border-radius: 999px;
  display:inline-block;
  background: rgba(68,209,255,0.65);
  box-shadow: 0 0 0 3px rgba(68,209,255,0.14);
}
.dot.ready{ background: rgba(59,214,113,0.85); box-shadow: 0 0 0 3px rgba(59,214,113,0.14); }
.dot.err{ background: rgba(255,90,90,0.90); box-shadow: 0 0 0 3px rgba(255,90,90,0.16); }
.dot.warn{ background: rgba(255,176,32,0.90); box-shadow: 0 0 0 3px rgba(255,176,32,0.16); }

/* Backwards compatibility: older class names */
.pill{ white-space: nowrap; }
.status-dot{ background: rgba(68,209,255,0.75); }
.status-pill{ color: var(--text); }

/* Licence pill visibility */
#licensePill{
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.16);
  color: var(--text);
}
#licensePill.owner{ color: rgba(59,214,113,0.95); border-color: rgba(59,214,113,0.30); }
#licensePill.pro{ color: rgba(68,209,255,0.95); border-color: rgba(68,209,255,0.30); }
#licensePill.basic{ color: var(--muted); }

.pill{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  font-size: 12px;
  white-space: normal;
}

.status-pill{ color: var(--text); }
.status-dot{
  width: 10px; height: 10px; border-radius: 999px;
  background: rgba(68,209,255,0.75);
  box-shadow: 0 0 0 3px rgba(68,209,255,0.16);
}

.icon-btn{
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  cursor:pointer;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.icon-btn:hover{ background: rgba(255,255,255,0.08); border-color: rgba(68,209,255,0.30); }
.icon-btn:active{ transform: translateY(1px); }
.icon{ font-size: 16px; }

/* ========== SIDEBAR NAV ========== */
.sidebar{
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface2), var(--surface));
  box-shadow: var(--shadow2);
  padding: 10px;
  display:flex;
  flex-direction: column;
  gap: 8px;
  position: static;
  top: 14px;
  height: calc(100vh - 16px - 14px - 74px);
  overflow:auto;
}

.nav-item{
  display:flex;
  align-items:center;
  gap: 10px;
  width:100%;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid #00000029;
  background: transparent;
  color: var(--text);
  cursor:pointer;
  transition: background .15s ease, border-color .15s ease, transform .08s ease;
}
.nav-item:hover{ background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.10); }
.nav-item:active{ transform: translateY(1px); }
.nav-item.active{
  background: rgba(68,209,255,0.12);
  border-color: rgba(68,209,255,0.25);
  box-shadow: inset 0 0 0 1px rgba(68,209,255,0.14);
}
.nav-ic{
  width: 28px; height: 28px;
  display:grid; place-items:center;
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
}
.nav-label{ font-weight: 700; font-size: 13px; letter-spacing: .2px; }

.sidebar-foot{
  margin-top:auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display:flex; flex-direction: column; gap: 6px;
}
.mini{ font-size: 11px; color: var(--muted); }

/* ========== WORKSPACE ========== */
.workspace{
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.045);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow2);
  padding: 14px;
  overflow:hidden;
}

/* ========== TOAST ========== */
.toast-wrap{ margin-bottom: 12px; }
.toast{
  border: 1px solid rgba(68,209,255,0.18);
  background:
    radial-gradient(700px 160px at 0% 0%, rgba(68,209,255,0.14), rgba(0,0,0,0)),
    rgba(255,255,255,0.04);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: 0 10px 26px rgba(0,0,0,0.20);
}
.toast-title{ font-weight: 800; font-size: 13px; }
.toast-body{ margin-top: 4px; font-size: 12px; color: var(--muted); }

/* ========== PANELS ========== */
.panel{ display:none; opacity:0; transform: translateY(6px); }
.panel.active{ display:block; animation: panelIn .16s ease forwards; }
@keyframes panelIn{ to{ opacity:1; transform: translateY(0); } }

.panel-head{
  display:flex;
  align-items:flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px 14px;
}
.panel-title{ font-size: 16px; font-weight: 800; letter-spacing: .2px; }
.panel-sub{ margin-top: 4px; font-size: 12px; color: var(--muted); }

/* ========== HOME: INSTALL CALLOUT + TILES ========== */
.callout{
  border: 1px solid rgba(68,209,255,0.22);
  border-radius: var(--radius);
  background:
    radial-gradient(700px 200px at 0% 0%, rgba(68,209,255,0.12), rgba(0,0,0,0)),
    rgba(255,255,255,0.04);
  padding: 12px;
  margin-bottom: 12px;
}
.callout-title{ font-weight: 900; font-size: 13px; }
.callout-body{ margin-top: 4px; font-size: 12px; color: var(--muted); }
.callout-actions{ margin-top: 10px; display:flex; gap: 10px; flex-wrap: wrap; }

.tile-grid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.tile{
  text-align:left;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius);
  background: rgba(117, 117, 117, 0.135);
  padding: 12px;
  cursor:pointer;
  transition: transform .08s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.tile:hover{
  border-color: rgba(68,209,255,0.24);
  background: rgba(255,255,255,0.05);
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
}
.tile:active{ transform: translateY(1px); }
.tile-ic{
  width: 36px; height: 36px;
  border-radius: 12px;
  display:grid; place-items:center;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
}
.tile-title{ margin-top: 10px; font-weight: 900; font-size: 13px; }
.tile-sub{ margin-top: 4px; font-size: 12px; color: var(--muted); }

.home-foot{
  margin-top: 14px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.home-note{ font-size: 12px; color: var(--muted); }

/* ========== HELP DRAWERS ========== */
.help{
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius);
  background: rgba(0,0,0,0.10);
  padding: 12px;
  margin: 0 2px 12px;
}
.help-title{ font-weight: 900; font-size: 13px; }
.help-body{ margin-top: 10px; display:flex; flex-direction: column; gap: 8px; }
.help-row{ display:flex; gap: 10px; align-items:flex-start; }
.help-k{
  width: 110px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  flex: 0 0 auto;
}
.help-v{ font-size: 12px; color: var(--text); }

/* ========== GRID / CARDS ========== */
.grid{ display:grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card{
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.035);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 8px 22px rgba(0,0,0,0.25);
  padding: 12px;
}
.card-title{
  font-weight: 800;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .3px;
  margin-bottom: 10px;
}

/* ========== FORM CONTROLS ========== */
.lbl{ display:block; font-size: 12px; color: var(--muted); margin: 10px 0 6px; }
.inp{
  width:100%;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  padding: 11px 12px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.inp:focus{ border-color: rgba(68,209,255,0.36); box-shadow: 0 0 0 3px rgba(68,209,255,0.12); }

/* Dropdowns: match theme */
select.inp{ color: var(--text); background: rgba(255,255,255,0.05); }
select.inp option{ color: #0a1220; background-color: #ffffff; }
[data-theme="light"] select.inp{ color:#0a1220; background-color:#ffffff; }
[data-theme="light"] select.inp option{ color:#0a1220; background-color:#ffffff; }
.meta{ margin-top: 10px; font-size: 12px; color: var(--muted); }
.check{ display:flex; align-items:center; gap: 10px; margin-top: 12px; color: var(--text); font-size: 13px; }

/* ========== BUTTONS ========== */
.actions{ display:flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.btn{
  border-radius: 14px;
  padding: 11px 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-weight: 800;
  cursor:pointer;
  transition: transform .08s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:hover{ background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.20); }
.btn:active{ transform: translateY(1px); }
.btn.primary{
  border-color: rgba(68,209,255,0.32);
  background: linear-gradient(180deg, rgba(68,209,255,0.22), rgba(68,209,255,0.10));
  box-shadow: 0 10px 22px rgba(0,0,0,0.25);
}
.btn.primary:hover{
  border-color: rgba(68,209,255,0.42);
  background: linear-gradient(180deg, rgba(68,209,255,0.28), rgba(68,209,255,0.12));
}
.btn.ghost{ background: transparent; }
.btn.danger{ border-color: rgba(255,90,90,0.40); background: rgba(255,90,90,0.10); }
.btn:disabled{ opacity: .55; cursor:not-allowed; }
.btn.loading{ position: relative; padding-left: 40px; }
.btn.loading::before{
  content:"";
  position:absolute; left: 14px; top: 50%;
  width: 14px; height: 14px; border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.30);
  border-top-color: rgba(68,209,255,0.90);
  transform: translateY(-50%);
  animation: spin .8s linear infinite;
}
@keyframes spin{ to{ transform: translateY(-50%) rotate(360deg); } }

/* ========== DROP ZONES ========== */
.drop{
  position:relative;
  border-radius: var(--radius);
  padding: 18px 14px;
  border: 1px solid rgba(68,209,255,0.22);
  background:
    radial-gradient(520px 160px at 0% 0%, rgba(68,209,255,0.12), rgba(0,0,0,0)),
    rgba(255,255,255,0.04);
  cursor:pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease, transform .08s ease;
  user-select:none;
}
.drop:hover{ border-color: rgba(68,209,255,0.34); box-shadow: 0 0 0 3px rgba(68,209,255,0.10); }
.drop:active{ transform: translateY(1px); }
.drop-title{ font-weight: 900; font-size: 14px; letter-spacing: .2px; }
.drop-sub{ margin-top: 4px; font-size: 12px; color: var(--muted); }
.drop input[type="file"]{ position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer; }
.drop.dragover{ border-color: rgba(68,209,255,0.55); box-shadow: 0 0 0 4px rgba(68,209,255,0.14); }

/* ========== LISTS ========== */
.list{
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius);
  background: rgba(0,0,0,0.10);
  padding: 10px;
  min-height: 180px;
}
.empty{ font-size: 12px; color: var(--muted); padding: 8px; }
.list-ul{ list-style:none; margin:0; padding:0; display:flex; flex-direction: column; gap: 8px; }
.li{
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  padding: 10px;
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
}
.li-left{ min-width: 0; }
.li-name{ font-weight: 900; font-size: 12px; overflow:hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }
.li-sub{ margin-top: 3px; font-size: 11px; color: var(--muted); }
.li-actions{ display:flex; gap: 8px; flex-wrap: wrap; justify-content:flex-end; }
.li-actions .btn{ padding: 9px 10px; border-radius: 12px; }

/* ========== MOBILE RESPONSIVE ========== */
@media (max-width: 980px){
  .body{ grid-template-columns: 1fr; }
  .sidebar{
    position: relative;
    height: auto;
    top: auto;
    flex-direction: row;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px;
    flex-wrap: wrap; 
  }
  .nav-item{ width: auto; min-width: 120px; justify-content: center; }
  .sidebar-foot{
    display:flex;
    width: 100%;
    border-top: 1px solid var(--line);
    padding-top: 10px;
    margin-top: 10px;
}
  .grid{ grid-template-columns: 1fr; }
  .tile-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .li-name{ max-width: 260px; }
  .topbar{
    flex-direction: column;
    align-items: flex-start;
}

.topbar-right{
  width: 100%;
  justify-content: flex-start;
  gap: 8px;
}
}

@media (max-width: 520px){
  .tile-grid{ grid-template-columns: 1fr; }
}

/* ========== TYPOGRAPHY: TITLE COLOUR CONTROL ========== */
/* Your UI uses class-based titles, not h1/h2/h3 */
.brand-title,
.panel-title,
.toast-title,
.callout-title,
.help-title,
.tile-title{
  color: var(--title-color);
}

/* Optional: card section labels stay muted */
.card-title{
  color: var(--muted);
}

/* Keep the generic heading rule too, in case you add h1/h2/h3 later */
h1, h2, h3{
  color: var(--title-color);
  font-weight: 600;
}

/* ========== LICENCE / PRO TAGS ========== */
.tag-pro{
  display:inline-flex;
  align-items:center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(68,209,255,0.26);
  background: rgba(68,209,255,0.10);
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .2px;
  margin-left: 8px;
}

#licensePill{
  color: var(--text);
}

/* ========== LOCKED PANEL ========== */
.locked-card{
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--radius);
  background:
    radial-gradient(700px 220px at 0% 0%, rgba(122,92,255,0.12), rgba(0,0,0,0)),
    rgba(255,255,255,0.04);
  padding: 14px;
  box-shadow: 0 10px 26px rgba(0,0,0,0.20);
}
.locked-title{ font-weight: 900; font-size: 14px; }
.locked-body{ margin-top: 6px; font-size: 12px; color: var(--muted); line-height: 1.5; }

/* ========== MODAL ========== */
.modal{
  position: fixed;
  inset: 0;
  display:none;
  z-index: 999;
}
.modal.open{ display:block; }

.modal-backdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-card{
  position:relative;
  width: min(520px, calc(100% - 24px));
  margin: 10vh auto 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow2);
  padding: 14px;
}

.modal-head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.modal-title{ font-size: 14px; font-weight: 900; }
.modal-row{ margin-top: 6px; }
/* ========== PRO PILL (sidebar) ========== */
.pro-pill{
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(68,209,255,0.26);
  background: rgba(68,209,255,0.10);
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .2px;
}
