:root{
  --brand:#8b5cf6;
  --brand-2:#ec4899;
  --brand-3:#06b6d4;
  --bg:#0b1020;
  --surface:rgba(255,255,255,.78);
  --surface-strong:rgba(255,255,255,.92);
  --text:#111827;
  --muted:#6b7280;
  --line:rgba(148,163,184,.28);
  --sidebar:#080b16;
  --shadow:0 24px 80px rgba(15,23,42,.18);
  --radius:24px;
}

*{box-sizing:border-box}

html{
  min-height:100%;
  background:
    radial-gradient(circle at top left, rgba(139,92,246,.34), transparent 32rem),
    radial-gradient(circle at top right, rgba(236,72,153,.22), transparent 28rem),
    linear-gradient(135deg,#eef2ff 0%,#fdf2f8 48%,#ecfeff 100%);
}

body{
  margin:0;
  min-height:100vh;
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at 85% 10%, rgba(6,182,212,.18), transparent 22rem),
    radial-gradient(circle at 20% 90%, rgba(139,92,246,.18), transparent 24rem);
}

body:before{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background-image:linear-gradient(rgba(255,255,255,.18) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.18) 1px,transparent 1px);
  background-size:48px 48px;
  mask-image:linear-gradient(to bottom,rgba(0,0,0,.22),transparent 70%);
}

aside{
  position:fixed;
  inset:16px auto 16px 16px;
  width:260px;
  padding:22px;
  color:#fff;
  background:
    linear-gradient(180deg,rgba(15,23,42,.96),rgba(8,11,22,.92)),
    radial-gradient(circle at top left,rgba(139,92,246,.42),transparent 18rem);
  border:1px solid rgba(255,255,255,.12);
  border-radius:28px;
  box-shadow:0 28px 90px rgba(15,23,42,.36);
  backdrop-filter:blur(24px);
}

aside h2{
  margin:0 0 22px;
  font-size:19px;
  letter-spacing:-.04em;
  line-height:1.15;
}

aside h2:before{
  content:"✦";
  display:inline-grid;
  place-items:center;
  width:34px;
  height:34px;
  margin-right:10px;
  border-radius:12px;
  background:linear-gradient(135deg,var(--brand),var(--brand-2));
  box-shadow:0 12px 30px rgba(139,92,246,.45);
}

aside a{
  display:flex;
  align-items:center;
  gap:10px;
  color:rgba(255,255,255,.82);
  text-decoration:none;
  padding:12px 13px;
  margin:4px 0;
  border:1px solid transparent;
  border-radius:16px;
  transition:.18s ease;
}

aside a:hover{
  color:#fff;
  background:rgba(255,255,255,.1);
  border-color:rgba(255,255,255,.12);
  transform:translateX(2px);
}

main{
  position:relative;
  z-index:1;
  margin-left:292px;
  padding:34px;
  max-width:1440px;
}

h1{
  margin:0 0 18px;
  font-size:clamp(30px,4vw,48px);
  line-height:1.02;
  letter-spacing:-.06em;
  color:#0f172a;
}

h2,h3{
  letter-spacing:-.035em;
  color:#111827;
}

a{
  color:#6d28d9;
  font-weight:650;
}

.card{
  position:relative;
  background:var(--surface);
  border:1px solid rgba(255,255,255,.62);
  border-radius:var(--radius);
  padding:22px;
  margin:18px 0;
  box-shadow:var(--shadow);
  backdrop-filter:blur(22px);
}

.card:before{
  content:"";
  position:absolute;
  inset:0;
  border-radius:inherit;
  pointer-events:none;
  background:linear-gradient(135deg,rgba(255,255,255,.55),transparent 42%);
}

.grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:18px;
}

.grid .card{
  overflow:hidden;
}

.grid .card strong{
  display:block;
  font-size:42px;
  line-height:1;
  letter-spacing:-.08em;
  background:linear-gradient(135deg,var(--brand),var(--brand-2),var(--brand-3));
  -webkit-background-clip:text;
  background-clip:text;
  color:transparent;
}

.grid .card span{
  display:block;
  margin-top:10px;
  text-transform:capitalize;
  color:var(--muted);
  font-weight:650;
}

label{
  display:block;
  margin:8px 0 6px;
  color:#374151;
  font-size:13px;
  font-weight:750;
}

input,select,textarea{
  width:100%;
  padding:13px 14px;
  border:1px solid rgba(148,163,184,.42);
  border-radius:16px;
  margin:6px 0 15px;
  color:#111827;
  background:rgba(255,255,255,.72);
  outline:none;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.7);
  transition:border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

input:focus,select:focus,textarea:focus{
  border-color:rgba(139,92,246,.72);
  background:#fff;
  box-shadow:0 0 0 5px rgba(139,92,246,.13);
}

textarea{
  min-height:180px;
  resize:vertical;
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;
}

button{
  appearance:none;
  border:0;
  padding:12px 18px;
  border-radius:16px;
  cursor:pointer;
  color:#fff;
  font-weight:800;
  letter-spacing:-.02em;
  background:linear-gradient(135deg,var(--brand),var(--brand-2));
  box-shadow:0 14px 34px rgba(139,92,246,.32);
  transition:transform .16s ease, box-shadow .16s ease, filter .16s ease;
}

button:hover{
  transform:translateY(-1px);
  filter:saturate(1.08);
  box-shadow:0 18px 44px rgba(139,92,246,.38);
}

button:active{
  transform:translateY(0);
}

.form-row{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(200px,1fr));
  gap:14px;
  align-items:end;
}

table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  overflow:hidden;
  background:var(--surface-strong);
  border:1px solid rgba(255,255,255,.62);
  border-radius:22px;
  box-shadow:var(--shadow);
  backdrop-filter:blur(22px);
}

th,td{
  text-align:left;
  padding:15px 16px;
  border-bottom:1px solid var(--line);
  vertical-align:top;
}

th{
  color:#475569;
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.08em;
  background:rgba(248,250,252,.72);
}

tr:last-child td{
  border-bottom:0;
}

pre{
  white-space:pre-wrap;
  max-width:760px;
  background:rgba(15,23,42,.92);
  color:#e5e7eb;
  border-radius:18px;
  padding:16px;
  overflow:auto;
}

.login{
  display:grid;
  place-items:center;
  min-height:100vh;
  padding:24px;
}

.login-card{
  width:min(440px,92vw);
  padding:30px;
  background:rgba(255,255,255,.78);
}

.login-card h1{
  font-size:32px;
  margin-bottom:24px;
  text-align:center;
}

.error{
  display:block;
  color:#be123c;
  background:#fff1f2;
  border:1px solid #fecdd3;
  padding:10px 12px;
  border-radius:14px;
}

.preview{
  width:100%;
  min-height:680px;
  background:#fff;
  border:1px solid rgba(148,163,184,.34);
  border-radius:22px;
  box-shadow:var(--shadow);
}

@media (max-width:860px){
  aside{
    position:static;
    width:auto;
    margin:14px;
  }
  main{
    margin-left:0;
    padding:16px;
  }
}

/* Theme and language controls */
.sidebar-tools{
  position:absolute;
  left:22px;
  right:22px;
  bottom:22px;
  display:grid;
  gap:12px;
}

.theme-toggle{
  width:100%;
  background:rgba(255,255,255,.1);
  border:1px solid rgba(255,255,255,.14);
  box-shadow:none;
}

.language-switcher{
  display:grid;
  grid-template-columns:repeat(3,1fr);
  gap:6px;
  padding:6px;
  border-radius:18px;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.1);
}

.language-switcher button{
  padding:9px 6px;
  border-radius:13px;
  font-size:12px;
  background:transparent;
  color:rgba(255,255,255,.7);
  box-shadow:none;
}

.language-switcher button.active{
  color:#fff;
  background:linear-gradient(135deg,var(--brand),var(--brand-2));
}

/* Light mode */
html[data-theme="light"]{
  background:
    radial-gradient(circle at top left, rgba(139,92,246,.24), transparent 32rem),
    radial-gradient(circle at top right, rgba(236,72,153,.16), transparent 28rem),
    linear-gradient(135deg,#f8fafc 0%,#fdf2f8 48%,#ecfeff 100%);
}

html[data-theme="light"] body{
  background:
    radial-gradient(circle at 85% 10%, rgba(6,182,212,.12), transparent 22rem),
    radial-gradient(circle at 20% 90%, rgba(139,92,246,.12), transparent 24rem);
}

html[data-theme="light"] aside{
  background:
    linear-gradient(180deg,rgba(255,255,255,.86),rgba(248,250,252,.82)),
    radial-gradient(circle at top left,rgba(139,92,246,.22),transparent 18rem);
  color:#111827;
  border-color:rgba(148,163,184,.34);
}

html[data-theme="light"] aside a{
  color:#334155;
}

html[data-theme="light"] aside a:hover{
  color:#111827;
  background:rgba(15,23,42,.06);
  border-color:rgba(15,23,42,.08);
}

html[data-theme="light"] .theme-toggle{
  background:rgba(15,23,42,.06);
  border-color:rgba(15,23,42,.08);
  color:#111827;
}

html[data-theme="light"] .language-switcher{
  background:rgba(15,23,42,.05);
  border-color:rgba(15,23,42,.08);
}

html[data-theme="light"] .language-switcher button{
  color:#475569;
}

html[data-theme="light"] .language-switcher button.active{
  color:#fff;
}

@media (max-width:860px){
  .sidebar-tools{
    position:static;
    margin-top:18px;
  }
}

/* Fix StartDM logo sizing */
aside .brand-block{
  display:grid;
  grid-template-columns:1fr;
  justify-items:start;
  gap:10px;
  overflow:hidden;
}

aside .brand-logo{
  display:block;
  width:160px !important;
  max-width:100% !important;
  height:auto !important;
  max-height:70px !important;
  object-fit:contain !important;
  border-radius:0 !important;
  background:transparent !important;
  padding:0 !important;
}

aside .brand-text{
  display:none;
}

@media (max-width:860px){
  aside .brand-logo{
    width:132px !important;
    max-height:56px !important;
  }
}

/* RTL language layout fixes */
html[dir="rtl"] body{
  direction:rtl;
  text-align:right;
}

html[dir="rtl"] aside{
  left:auto;
  right:16px;
}

html[dir="rtl"] main{
  margin-left:0;
  margin-right:292px;
  direction:rtl;
  text-align:right;
}

html[dir="rtl"] aside a{
  justify-content:flex-start;
  text-align:right;
}

html[dir="rtl"] .grid .card,
html[dir="rtl"] .card,
html[dir="rtl"] table,
html[dir="rtl"] th,
html[dir="rtl"] td{
  text-align:right;
}

html[dir="rtl"] input,
html[dir="rtl"] select,
html[dir="rtl"] textarea{
  direction:rtl;
  text-align:right;
}

html[dir="rtl"] .brand-block{
  justify-items:end;
}

html[dir="rtl"] .sidebar-tools{
  left:22px;
  right:22px;
}

@media (max-width:860px){
  html[dir="rtl"] aside{
    right:auto;
  }

  html[dir="rtl"] main{
    margin-right:0;
    margin-left:0;
  }
}

/* RTL logo and sidebar polish */
html[dir="rtl"] aside .brand-block{
  justify-items:start !important;
  text-align:right;
}

html[dir="rtl"] aside .brand-logo{
  margin-left:auto;
  margin-right:0;
}

html[dir="rtl"] aside{
  text-align:right;
}

html[dir="rtl"] .language-switcher{
  direction:ltr;
}

/* Protected Yekan Bakh font loading */
@font-face{
  font-family:"Yekan Bakh";
  src:url("/fonts/yekan-bakh-en-04-regular.ttf") format("truetype");
  font-weight:400;
  font-style:normal;
  font-display:swap;
}

@font-face{
  font-family:"Yekan Bakh";
  src:url("/fonts/yekan-bakh-en-05-medium.ttf") format("truetype");
  font-weight:500;
  font-style:normal;
  font-display:swap;
}

@font-face{
  font-family:"Yekan Bakh";
  src:url("/fonts/yekan-bakh-en-06-bold.ttf") format("truetype");
  font-weight:700;
  font-style:normal;
  font-display:swap;
}

@font-face{
  font-family:"Yekan Bakh";
  src:url("/fonts/yekan-bakh-en-07-heavy.ttf") format("truetype");
  font-weight:800;
  font-style:normal;
  font-display:swap;
}

body,
input,
select,
textarea,
button{
  font-family:"Yekan Bakh", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;
}

/* Protected Yekan Bakh font loading */
@font-face{
  font-family:"Yekan Bakh";
  src:url("/fonts/yekan-bakh-en-04-regular.ttf") format("truetype");
  font-weight:400;
  font-style:normal;
  font-display:swap;
}

@font-face{
  font-family:"Yekan Bakh";
  src:url("/fonts/yekan-bakh-en-05-medium.ttf") format("truetype");
  font-weight:500;
  font-style:normal;
  font-display:swap;
}

@font-face{
  font-family:"Yekan Bakh";
  src:url("/fonts/yekan-bakh-en-06-bold.ttf") format("truetype");
  font-weight:700;
  font-style:normal;
  font-display:swap;
}

@font-face{
  font-family:"Yekan Bakh";
  src:url("/fonts/yekan-bakh-en-07-heavy.ttf") format("truetype");
  font-weight:800;
  font-style:normal;
  font-display:swap;
}

body,
input,
select,
textarea,
button{
  font-family:"Yekan Bakh", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;
}

/* Gallery */
.gallery-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(280px,1fr));
  gap:22px;
  margin-top:22px;
}

.gallery-card{
  overflow:hidden;
  border-radius:24px;
  background:rgba(255,255,255,.78);
  border:1px solid rgba(255,255,255,.62);
  box-shadow:0 24px 80px rgba(15,23,42,.16);
  backdrop-filter:blur(22px);
}

.gallery-card img{
  display:block;
  width:100%;
  height:210px;
  object-fit:cover;
  background:#f1f5f9;
}

.gallery-body{
  padding:18px;
}

.gallery-body strong{
  display:block;
  font-size:14px;
  line-height:1.35;
  word-break:break-word;
}

.gallery-body small{
  display:block;
  margin:6px 0 14px;
  color:var(--muted);
  word-break:break-word;
}

.gallery-actions{
  display:grid;
  grid-template-columns:1fr 1fr 1fr;
  gap:8px;
  margin-top:8px;
}

.gallery-actions button{
  padding:10px 8px;
  font-size:12px;
  border-radius:13px;
}

.gallery-actions .danger{
  background:linear-gradient(135deg,#ef4444,#be123c);
  box-shadow:0 14px 34px rgba(239,68,68,.26);
}

html[data-theme="light"] .gallery-card{
  background:rgba(255,255,255,.88);
  border-color:rgba(148,163,184,.28);
}

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

  .gallery-actions{
    grid-template-columns:1fr;
  }
}

/* Gallery edit mode toggle */
.gallery-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  margin-bottom:18px;
}

.gallery-subtitle{
  margin-top:-8px;
  color:var(--muted);
}

.edit-toggle{
  display:flex;
  align-items:center;
  gap:10px;
  width:auto;
  padding:12px 16px;
  border-radius:18px;
  background:rgba(255,255,255,.72);
  border:1px solid rgba(148,163,184,.28);
  box-shadow:0 12px 34px rgba(15,23,42,.08);
  cursor:pointer;
}

.edit-toggle input{
  width:auto;
  margin:0;
}

.gallery-edit-panel{
  display:none;
  margin-top:14px;
}

body.gallery-edit-mode .gallery-edit-panel{
  display:block;
}

body.gallery-edit-mode .simple-actions{
  display:none;
}

.simple-actions{
  grid-template-columns:1fr;
}

.gallery-info{
  font-size:14px;
  color:#334155;
}

@media (max-width:860px){
  .gallery-header{
    display:grid;
  }

  .edit-toggle{
    width:100%;
    justify-content:space-between;
  }
}

/* API Manager provider logos */
.api-name-cell{
  display:flex;
  align-items:flex-start;
  gap:12px;
}

.api-logo{
  flex:0 0 auto;
  width:38px;
  height:38px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:14px;
  font-size:12px;
  font-weight:900;
  letter-spacing:-.02em;
  color:#fff;
  box-shadow:0 14px 34px rgba(15,23,42,.14);
}

.api-logo-openai{
  background:linear-gradient(135deg,#111827,#374151);
}

.api-logo-serpapi{
  background:linear-gradient(135deg,#2563eb,#06b6d4);
}

.api-logo-google{
  background:linear-gradient(135deg,#4285f4,#34a853);
}

.api-logo-postgres{
  background:linear-gradient(135deg,#336791,#1e3a8a);
}

.api-logo-http{
  background:linear-gradient(135deg,#f97316,#db2777);
}

.api-logo-custom{
  background:linear-gradient(135deg,var(--brand),var(--brand-2));
}

/* Provider logo inside provider column */
.api-provider-cell{
  display:flex;
  align-items:center;
  gap:10px;
}

.api-provider-logo{
  width:24px;
  height:24px;
  object-fit:contain;
  border-radius:7px;
  flex:0 0 auto;
}

/* Project management cards */
.project-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(320px,1fr));
  gap:22px;
  margin-top:22px;
}

.project-card{
  padding:22px;
  border-radius:26px;
  background:rgba(255,255,255,.78);
  border:1px solid rgba(255,255,255,.62);
  box-shadow:0 24px 80px rgba(15,23,42,.14);
  backdrop-filter:blur(22px);
}

.project-head{
  display:flex;
  align-items:center;
  gap:16px;
  margin-bottom:18px;
}

.project-logo,
.project-logo-fallback{
  width:64px;
  height:64px;
  border-radius:20px;
  object-fit:contain;
  background:#fff;
  box-shadow:0 16px 38px rgba(15,23,42,.12);
  padding:8px;
}

.project-logo-fallback{
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  font-size:24px;
  color:#fff;
  background:linear-gradient(135deg,var(--brand),var(--brand-2));
}

.project-head h2{
  margin:0;
}

.project-head p{
  margin:4px 0 0;
  color:var(--muted);
  font-weight:700;
}

.project-meta{
  display:grid;
  gap:8px;
  margin:16px 0 18px;
  color:var(--muted);
  font-size:13px;
}

.project-actions{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:10px;
}

.project-actions a{
  text-align:center;
  text-decoration:none;
  padding:10px 8px;
  border-radius:14px;
  color:#fff;
  font-size:13px;
  font-weight:800;
  background:linear-gradient(135deg,var(--brand),var(--brand-2));
  box-shadow:0 14px 34px rgba(139,92,246,.18);
}

html[data-theme="light"] .project-card{
  background:rgba(255,255,255,.9);
  border-color:rgba(148,163,184,.28);
}

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

  .project-actions{
    grid-template-columns:1fr 1fr;
  }
}

/* Keyword Research */
.drive-preview-card{
  padding:0;
  overflow:hidden;
}

.drive-preview{
  width:100%;
  min-height:760px;
  border:0;
  display:block;
  background:#fff;
  border-radius:24px;
}

@media (max-width:860px){
  .drive-preview{
    min-height:620px;
  }
}

.project-actions{
  grid-template-columns:repeat(auto-fit,minmax(110px,1fr));
}

/* Keyword Research dashboard */
.keyword-chart-placeholder{
  min-height:260px;
  display:grid;
  place-items:center;
  border:1px dashed rgba(148,163,184,.5);
  border-radius:22px;
  color:var(--muted);
  background:rgba(255,255,255,.42);
  text-align:center;
  padding:28px;
  font-weight:700;
}

.keyword-sections{
  display:grid;
  gap:18px;
}

.security-note{
  margin-top:18px;
  padding:14px 16px;
  border-radius:16px;
  background:rgba(245,158,11,.12);
  border:1px solid rgba(245,158,11,.28);
  color:var(--muted);
  font-weight:700;
}

.data-control-actions{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(280px,1fr));
  gap:18px;
  margin-top:22px;
}

.data-control-box{
  padding:18px;
  border-radius:20px;
  background:rgba(255,255,255,.55);
  border:1px solid rgba(148,163,184,.24);
}

.danger-box{
  border-color:rgba(239,68,68,.28);
  background:rgba(239,68,68,.06);
}

button.danger,
.danger{
  background:linear-gradient(135deg,#ef4444,#be123c) !important;
  color:#fff !important;
}

.security-note{
  margin-top:18px;
  padding:14px 16px;
  border-radius:16px;
  background:rgba(245,158,11,.12);
  border:1px solid rgba(245,158,11,.28);
  color:var(--muted);
  font-weight:700;
}

.chart-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:18px;
  margin-top:18px;
}

.chart-card{
  padding:18px;
  border-radius:22px;
  background:linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border:1px solid rgba(255,255,255,.08);
  box-shadow:0 10px 30px rgba(0,0,0,.18);
}

.chart-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}

.chart-head h3{
  margin:0;
  font-size:16px;
  font-weight:800;
}

.chart-head span{
  color:var(--muted);
  font-size:12px;
}

.chart-box{
  min-height:320px;
}

.full-span{
  grid-column:1 / -1;
}

.mini-note{
  margin-top:8px;
  font-size:12px;
  color:var(--muted);
}

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

.kr-tabs{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin:18px 0 22px;
}

.kr-tab{
  padding:11px 15px;
  border-radius:999px;
  background:rgba(255,255,255,.55);
  border:1px solid rgba(148,163,184,.22);
  color:var(--text);
  text-decoration:none;
  font-weight:800;
  font-size:13px;
  box-shadow:0 10px 24px rgba(15,23,42,.06);
}

.kr-tab.active{
  background:linear-gradient(135deg,var(--brand),var(--brand-2));
  color:#fff;
  border-color:transparent;
}

.section-hero{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
}

.section-hero h2{
  margin:0 0 8px;
}

.section-hero p{
  margin:0;
  color:var(--muted);
}

.section-badge{
  padding:12px 16px;
  border-radius:999px;
  background:rgba(139,92,246,.12);
  border:1px solid rgba(139,92,246,.22);
  color:var(--text);
  font-weight:900;
  white-space:nowrap;
}

.chart-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:18px;
  margin:18px 0;
}

.chart-card{
  padding:18px;
  border-radius:24px;
  background:rgba(255,255,255,.72);
  border:1px solid rgba(148,163,184,.18);
  box-shadow:0 18px 50px rgba(15,23,42,.08);
}

.chart-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}

.chart-head h3,
.chart-head h2{
  margin:0;
}

.chart-head span{
  color:var(--muted);
  font-size:12px;
}

.chart-box{
  min-height:320px;
}

.full-span{
  grid-column:1 / -1;
}

.cluster-ideas{
  margin:0;
  padding-left:18px;
}

.cluster-ideas li{
  margin:4px 0;
  line-height:1.45;
}

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

  .section-hero{
    align-items:flex-start;
    flex-direction:column;
  }
}

.soft-button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:44px;
  padding:0 18px;
  border-radius:14px;
  background:rgba(148,163,184,.14);
  color:var(--text);
  font-weight:800;
  text-decoration:none;
  border:1px solid rgba(148,163,184,.24);
}

.load-more-wrap{
  display:flex;
  justify-content:center;
  margin-top:22px;
}

.load-more-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:13px 22px;
  border-radius:999px;
  color:#fff;
  font-weight:900;
  text-decoration:none;
  background:linear-gradient(135deg,var(--brand),var(--brand-2));
  box-shadow:0 14px 32px rgba(139,92,246,.22);
}

.form-row label{
  display:block;
  margin:0 0 7px;
  font-size:12px;
  font-weight:900;
  color:var(--muted);
}

.cluster-keyword-list{
  display:flex;
  flex-direction:column;
  gap:10px;
  min-width:420px;
}

.cluster-keyword-item{
  display:grid;
  grid-template-columns:minmax(220px,1fr) auto;
  gap:12px;
  align-items:center;
  padding:10px 12px;
  border-radius:14px;
  background:rgba(255,255,255,.55);
  border:1px solid rgba(148,163,184,.18);
}

.cluster-keyword-item strong{
  display:block;
  font-size:13px;
  color:var(--text);
}

.cluster-keyword-item span{
  display:block;
  margin-top:3px;
  font-size:11px;
  color:var(--muted);
  font-weight:800;
}

.cluster-keyword-metrics{
  display:grid;
  grid-template-columns:auto auto auto auto auto auto;
  gap:5px 7px;
  align-items:baseline;
  white-space:nowrap;
}

.cluster-keyword-metrics b{
  font-size:12px;
  color:var(--text);
}

.cluster-keyword-metrics small{
  font-size:10px;
  color:var(--muted);
  font-weight:800;
}

@media (max-width:900px){
  .cluster-keyword-item{
    grid-template-columns:1fr;
  }

  .cluster-keyword-list{
    min-width:0;
  }
}

.suggest-item{
  background:rgba(59,130,246,.07);
  border-color:rgba(59,130,246,.18);
}

.suggest-item strong{
  color:var(--text);
}

.kr-section-top{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:18px;
  padding:20px;
  border-radius:26px;
  background:rgba(255,255,255,.72);
  border:1px solid rgba(148,163,184,.18);
  box-shadow:0 18px 50px rgba(15,23,42,.07);
  margin:18px 0;
}

.kr-section-title h2{
  margin:0 0 8px;
}

.kr-section-title p{
  margin:0;
  color:var(--muted);
}

.kr-count-badge{
  padding:12px 18px;
  border-radius:999px;
  background:rgba(123,48,123,.10);
  border:1px solid rgba(123,48,123,.20);
  font-weight:900;
  white-space:nowrap;
}

.kr-filter-card{
  padding:18px;
  border-radius:24px;
  background:rgba(255,255,255,.68);
  border:1px solid rgba(148,163,184,.18);
  box-shadow:0 16px 42px rgba(15,23,42,.06);
  margin-bottom:16px;
}

.kr-filter-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
  align-items:end;
}

.kr-filter-grid label{
  display:block;
  margin-bottom:7px;
  font-size:12px;
  color:var(--muted);
  font-weight:900;
}

.kr-filter-actions{
  display:flex;
  gap:10px;
  align-items:center;
}

.kr-filter-actions a{
  min-height:44px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0 16px;
  border-radius:14px;
  background:rgba(148,163,184,.14);
  color:var(--text);
  font-weight:800;
  text-decoration:none;
}

.kr-sort-card{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:10px;
  padding:14px 16px;
  margin-bottom:16px;
  border-radius:22px;
  background:rgba(255,255,255,.62);
  border:1px solid rgba(148,163,184,.18);
}

.kr-sort-card span{
  color:var(--muted);
  font-weight:900;
  font-size:13px;
}

.kr-sort-btn{
  padding:10px 14px;
  border-radius:999px;
  text-decoration:none;
  background:rgba(148,163,184,.12);
  border:1px solid rgba(148,163,184,.18);
  color:var(--text);
  font-weight:900;
  font-size:13px;
}

.kr-sort-btn.active{
  background:linear-gradient(135deg,var(--brand),var(--brand-2));
  color:#fff;
  border-color:transparent;
}

.table-sort-link{
  color:var(--text);
  text-decoration:none;
  font-weight:900;
}

.pillar-card-grid{
  display:grid;
  grid-template-columns:1fr;
  gap:18px;
  margin-top:18px;
}

.pillar-card{
  padding:20px;
  border-radius:28px;
  background:rgba(255,255,255,.74);
  border:1px solid rgba(148,163,184,.18);
  box-shadow:0 22px 60px rgba(15,23,42,.08);
}

.pillar-card-head{
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:flex-start;
  margin-bottom:16px;
}

.pillar-card-head h3{
  margin:0 0 6px;
  font-size:20px;
}

.pillar-card-head small{
  color:var(--muted);
  word-break:break-word;
}

.pillar-card-head > span{
  padding:8px 12px;
  border-radius:999px;
  background:rgba(123,48,123,.10);
  color:var(--text);
  font-weight:900;
}

.pillar-metrics{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
  margin-bottom:18px;
}

.pillar-metrics div{
  padding:14px;
  border-radius:18px;
  background:rgba(248,250,252,.78);
  border:1px solid rgba(148,163,184,.16);
}

.pillar-metrics b{
  display:block;
  font-size:20px;
  color:var(--text);
}

.pillar-metrics span{
  display:block;
  margin-top:4px;
  color:var(--muted);
  font-size:12px;
  font-weight:800;
}

.pillar-keyword-columns{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px;
}

.pillar-keyword-columns details{
  border-radius:20px;
  border:1px solid rgba(148,163,184,.18);
  background:rgba(255,255,255,.55);
  overflow:hidden;
}

.pillar-keyword-columns summary{
  cursor:pointer;
  padding:14px 16px;
  font-weight:900;
  background:rgba(248,250,252,.88);
  border-bottom:1px solid rgba(148,163,184,.14);
}

.pillar-keyword-list{
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:14px;
  max-height:520px;
  overflow:auto;
}

.pillar-keyword-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:12px;
  align-items:center;
  padding:11px 12px;
  border-radius:15px;
  background:rgba(255,255,255,.78);
  border:1px solid rgba(148,163,184,.16);
}

.pillar-keyword-row strong{
  display:block;
  font-size:13px;
  color:var(--text);
}

.pillar-keyword-row span{
  display:block;
  margin-top:4px;
  font-size:11px;
  color:var(--muted);
  font-weight:800;
}

.pillar-mini-metrics{
  display:grid;
  grid-template-columns:auto auto auto auto auto auto;
  gap:4px 6px;
  align-items:baseline;
  white-space:nowrap;
}

.pillar-mini-metrics b{
  font-size:12px;
}

.pillar-mini-metrics small{
  font-size:10px;
  color:var(--muted);
  font-weight:800;
}

.suggest-item{
  background:rgba(59,130,246,.07);
  border-color:rgba(59,130,246,.18);
}

@media (max-width:1100px){
  .kr-filter-grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .pillar-keyword-columns{
    grid-template-columns:1fr;
  }

  .pillar-metrics{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }
}

@media (max-width:720px){
  .kr-section-top,
  .pillar-card-head{
    flex-direction:column;
  }

  .kr-filter-grid{
    grid-template-columns:1fr;
  }

  .pillar-metrics{
    grid-template-columns:1fr;
  }

  .pillar-keyword-row{
    grid-template-columns:1fr;
  }
}

.explorer-list{
  display:flex;
  flex-direction:column;
  gap:16px;
  margin-top:18px;
}

.explorer-card{
  padding:18px;
  border-radius:26px;
  background:rgba(255,255,255,.74);
  border:1px solid rgba(148,163,184,.18);
  box-shadow:0 18px 50px rgba(15,23,42,.07);
}

.explorer-main{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto auto;
  gap:18px;
  align-items:center;
}

.explorer-main h3{
  margin:0 0 6px;
  font-size:17px;
  word-break:break-word;
}

.explorer-main small{
  color:var(--muted);
  word-break:break-word;
}

.explorer-metrics{
  display:grid;
  grid-template-columns:repeat(4,110px);
  gap:10px;
}

.explorer-metrics div{
  padding:10px;
  border-radius:16px;
  background:rgba(248,250,252,.82);
  border:1px solid rgba(148,163,184,.16);
}

.explorer-metrics b{
  display:block;
  font-size:15px;
}

.explorer-metrics span{
  display:block;
  margin-top:3px;
  font-size:10px;
  color:var(--muted);
  font-weight:800;
}

.show-details-btn{
  white-space:nowrap;
}

.explorer-details{
  margin-top:16px;
  padding-top:16px;
  border-top:1px solid rgba(148,163,184,.18);
}

.details-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px;
}

.details-title{
  margin:0 0 10px;
}

.mini-data-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:12px;
  align-items:center;
  padding:11px 12px;
  border-radius:15px;
  background:rgba(255,255,255,.78);
  border:1px solid rgba(148,163,184,.16);
  margin-bottom:8px;
}

.mini-data-row strong{
  display:block;
  font-size:13px;
  word-break:break-word;
}

.mini-data-row span{
  display:block;
  margin-top:3px;
  font-size:11px;
  color:var(--muted);
  font-weight:800;
}

.mini-metrics{
  display:grid;
  grid-template-columns:auto auto auto auto auto auto;
  gap:4px 6px;
  white-space:nowrap;
  align-items:baseline;
}

.mini-metrics b{
  font-size:12px;
}

.mini-metrics small{
  font-size:10px;
  color:var(--muted);
  font-weight:800;
}

.empty-mini{
  padding:16px;
  border-radius:16px;
  background:rgba(148,163,184,.10);
  color:var(--muted);
  font-weight:800;
}

@media (max-width:1200px){
  .explorer-main{
    grid-template-columns:1fr;
  }

  .explorer-metrics{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .details-grid{
    grid-template-columns:1fr;
  }
}

.table-wrap{
  width:100%;
  overflow-x:auto;
}

.pillar-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0 10px;
}

.pillar-table thead th{
  padding:10px 12px;
  color:var(--muted);
  font-size:12px;
  font-weight:900;
  text-align:left;
  white-space:nowrap;
}

.pillar-table tbody tr.pillar-main-row{
  background:rgba(255,255,255,.76);
  box-shadow:0 10px 28px rgba(15,23,42,.05);
}

.pillar-table tbody tr.pillar-main-row td{
  padding:14px 12px;
  border-top:1px solid rgba(148,163,184,.16);
  border-bottom:1px solid rgba(148,163,184,.16);
  vertical-align:middle;
}

.pillar-table tbody tr.pillar-main-row td:first-child{
  border-left:1px solid rgba(148,163,184,.16);
  border-radius:16px 0 0 16px;
}

.pillar-table tbody tr.pillar-main-row td:last-child{
  border-right:1px solid rgba(148,163,184,.16);
  border-radius:0 16px 16px 0;
}

.url-cell{
  display:block;
  max-width:420px;
  word-break:break-word;
  color:var(--muted);
}

.lang-pill{
  display:inline-flex;
  padding:7px 10px;
  border-radius:999px;
  background:rgba(123,48,123,.10);
  border:1px solid rgba(123,48,123,.18);
  font-size:11px;
  font-weight:900;
}

.cluster-toggle-btn,
.cluster-close-btn{
  border:0;
  cursor:pointer;
  padding:10px 14px;
  border-radius:999px;
  font-weight:900;
  background:rgba(123,48,123,.10);
  color:var(--text);
  border:1px solid rgba(123,48,123,.20);
  white-space:nowrap;
}

.cluster-toggle-btn.active{
  background:linear-gradient(135deg,var(--brand),var(--brand-2));
  color:#fff;
  border-color:transparent;
}

.pillar-cluster-row td{
  padding:0 0 14px;
}

.pillar-cluster-panel{
  margin:0 8px 12px;
  padding:18px;
  border-radius:24px;
  background:rgba(248,250,252,.86);
  border:1px solid rgba(148,163,184,.18);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.55);
}

.cluster-panel-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:16px;
}

.cluster-panel-head h3{
  margin:0 0 6px;
}

.cluster-panel-head p{
  margin:0;
  color:var(--muted);
  font-size:12px;
  word-break:break-word;
}

@media (max-width:900px){
  .url-cell{
    max-width:260px;
  }

  .cluster-panel-head{
    flex-direction:column;
  }
}

.suggestion-service-card textarea{
  width:100%;
  border:1px solid rgba(148,163,184,.26);
  border-radius:18px;
  padding:14px;
  font-family:inherit;
  resize:vertical;
  background:rgba(255,255,255,.78);
}

.suggestion-service-card label{
  display:block;
  margin-bottom:8px;
  font-size:12px;
  font-weight:900;
  color:var(--muted);
}

.suggestion-service-card small{
  display:block;
  margin-top:8px;
  color:var(--muted);
}

.suggestion-form{
  display:flex;
  flex-direction:column;
  gap:18px;
}

.suggestion-options{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
}

.status-pill{
  display:inline-flex;
  padding:7px 10px;
  border-radius:999px;
  font-size:11px;
  font-weight:900;
  white-space:nowrap;
}

.status-pill.good{
  background:rgba(34,197,94,.12);
  color:#166534;
  border:1px solid rgba(34,197,94,.24);
}

.status-pill.neutral{
  background:rgba(148,163,184,.12);
  color:var(--muted);
  border:1px solid rgba(148,163,184,.22);
}

@media (max-width:900px){
  .suggestion-options{
    grid-template-columns:1fr;
  }
}

.movement-pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:7px 11px;
  border-radius:999px;
  font-weight:900;
  font-size:13px;
  white-space:nowrap;
}

.movement-up{
  background:rgba(34,197,94,.12);
  color:#15803d;
  border:1px solid rgba(34,197,94,.26);
}

.movement-down{
  background:rgba(239,68,68,.12);
  color:#dc2626;
  border:1px solid rgba(239,68,68,.26);
}

.translation-workbench-form textarea{
  width:100%;
  border:1px solid rgba(148,163,184,.26);
  border-radius:18px;
  padding:14px;
  font-family:inherit;
  resize:vertical;
  background:rgba(255,255,255,.78);
}

.translation-options{
  display:flex;
  gap:18px;
  flex-wrap:wrap;
  margin-top:16px;
  color:var(--muted);
  font-weight:800;
}

.form-actions{
  display:flex;
  gap:12px;
  align-items:center;
  margin-top:18px;
}

.translation-progress-card{
  background:rgba(255,255,255,.82);
  border:1px solid rgba(148,163,184,.22);
  border-radius:22px;
  padding:18px;
  margin:18px 0;
  box-shadow:0 14px 40px rgba(15,23,42,.06);
}

.translation-progress-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:10px;
  color:var(--text);
}

.translation-progress-track{
  width:100%;
  height:12px;
  background:rgba(148,163,184,.18);
  border-radius:999px;
  overflow:hidden;
}

.translation-progress-fill{
  height:100%;
  background:linear-gradient(90deg,#7b307b,#22c55e);
  border-radius:999px;
  transition:width .25s ease;
}

.translation-progress-steps{
  display:flex;
  justify-content:space-between;
  gap:8px;
  margin-top:12px;
  font-size:12px;
  color:var(--muted);
  font-weight:800;
}

.translation-progress-steps span.done{
  color:#15803d;
}

.translation-workbench-form textarea{
  width:100%;
  border:1px solid rgba(148,163,184,.26);
  border-radius:18px;
  padding:14px;
  font-family:inherit;
  resize:vertical;
  background:rgba(255,255,255,.78);
}

.translation-options{
  display:flex;
  gap:18px;
  flex-wrap:wrap;
  margin-top:16px;
  color:var(--muted);
  font-weight:800;
}

.form-actions{
  display:flex;
  gap:12px;
  align-items:center;
  margin-top:18px;
}

.translation-api-select{
  margin-top:18px;
}

.translation-api-select label{
  display:block;
  margin-bottom:8px;
  font-size:12px;
  font-weight:900;
  color:var(--muted);
}

.translation-api-select select{
  width:100%;
  max-width:520px;
  padding:13px 14px;
  border-radius:16px;
  border:1px solid rgba(148,163,184,.26);
  background:rgba(255,255,255,.82);
  font-weight:800;
}

.accounting-table th,
.accounting-table td{
  text-align:center;
  vertical-align:middle;
}

.accounting-table td:first-child,
.accounting-table th:first-child{
  text-align:left;
  min-width:220px;
}

.perm-check{
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

.perm-check input{
  width:20px;
  height:20px;
  accent-color:#7b307b;
}

.accounting-table small{
  color:var(--muted);
}

.profile-box{
  display:flex;
  align-items:center;
  gap:18px;
}

.profile-avatar{
  width:84px;
  height:84px;
  object-fit:cover;
  border-radius:999px;
  border:3px solid rgba(123,48,123,.25);
}

.profile-avatar-placeholder{
  width:84px;
  height:84px;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(123,48,123,.12);
  color:#7b307b;
  font-size:34px;
  font-weight:900;
  border:3px solid rgba(123,48,123,.18);
}

.admin-pill{
  display:inline-block;
  margin-top:6px;
  padding:4px 8px;
  border-radius:999px;
  background:rgba(123,48,123,.12);
  color:#7b307b;
  font-size:11px;
  font-weight:900;
}

.profile-box{
  display:flex;
  align-items:center;
  gap:18px;
}

.profile-avatar{
  width:84px;
  height:84px;
  object-fit:cover;
  border-radius:999px;
  border:3px solid rgba(123,48,123,.25);
}

.profile-avatar-placeholder{
  width:84px;
  height:84px;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(123,48,123,.12);
  color:#7b307b;
  font-size:34px;
  font-weight:900;
  border:3px solid rgba(123,48,123,.18);
}

/* Content Studio dropdown arrows */
.cg-card details > summary {
  list-style: none;
  position: relative;
}

.cg-card details > summary::-webkit-details-marker {
  display: none;
}

.cg-card details > summary::before {
  content: "▶";
  display: inline-block;
  margin-right: 8px;
  font-size: 12px;
  line-height: 1;
  transform: translateY(-1px);
}

.cg-card details[open] > summary::before {
  content: "▼";
}

/* ============================================================
   STARTDM GLOBAL DARK THEME
   ============================================================ */

html.startdm-dark,
body.startdm-dark {
  background: #0a0b13 !important;
  color: #e8edf5 !important;
}

body.startdm-dark main,
body.startdm-dark .main,
body.startdm-dark .content,
body.startdm-dark .page,
body.startdm-dark .cms-shell {
  background: #0a0b13 !important;
  color: #e8edf5 !important;
}

body.startdm-dark .card,
body.startdm-dark .project-card,
body.startdm-dark .cms-panel,
body.startdm-dark .cms-stat,
body.startdm-dark .cg-card,
body.startdm-dark .table-wrap,
body.startdm-dark .gallery-header,
body.startdm-dark .cms-table-wrap {
  background: #11131c !important;
  border-color: rgba(255,255,255,.08) !important;
  color: #e8edf5 !important;
  box-shadow: 0 18px 45px rgba(0,0,0,.28) !important;
}

body.startdm-dark h1,
body.startdm-dark h2,
body.startdm-dark h3,
body.startdm-dark h4,
body.startdm-dark strong,
body.startdm-dark label,
body.startdm-dark .cms-title-wrap h1,
body.startdm-dark .cms-panel-head h2,
body.startdm-dark .cms-stat-value,
body.startdm-dark .cms-article-title {
  color: #f8fafc !important;
}

body.startdm-dark p,
body.startdm-dark small,
body.startdm-dark span,
body.startdm-dark .gallery-subtitle,
body.startdm-dark .cms-title-wrap p,
body.startdm-dark .cms-stat-label,
body.startdm-dark .cms-stat-note,
body.startdm-dark .cms-meta-line,
body.startdm-dark .cms-empty,
body.startdm-dark .cms-empty p {
  color: #aab4c4 !important;
}

body.startdm-dark input,
body.startdm-dark textarea,
body.startdm-dark select,
body.startdm-dark .cms-search {
  background: #0f121b !important;
  border-color: rgba(255,255,255,.12) !important;
  color: #f8fafc !important;
}

body.startdm-dark input::placeholder,
body.startdm-dark textarea::placeholder {
  color: #717b8f !important;
}

body.startdm-dark table,
body.startdm-dark .cms-table,
body.startdm-dark .accounting-table {
  background: #11131c !important;
  color: #e8edf5 !important;
}

body.startdm-dark th,
body.startdm-dark .cms-table th,
body.startdm-dark .accounting-table th {
  background: #151824 !important;
  color: #9aa4b5 !important;
  border-color: rgba(255,255,255,.08) !important;
}

body.startdm-dark td,
body.startdm-dark .cms-table td,
body.startdm-dark .accounting-table td {
  background: #11131c !important;
  color: #e8edf5 !important;
  border-color: rgba(255,255,255,.07) !important;
}

body.startdm-dark tr:hover td,
body.startdm-dark .cms-table tr:hover td {
  background: #171a26 !important;
}

body.startdm-dark a {
  color: #d9b7ff;
}

body.startdm-dark .cms-btn,
body.startdm-dark .cms-action,
body.startdm-dark button,
body.startdm-dark .btn,
body.startdm-dark .project-actions a {
  background: #151824 !important;
  color: #f8fafc !important;
  border-color: rgba(255,255,255,.12) !important;
}

body.startdm-dark .cms-btn-primary,
body.startdm-dark .cms-action-dark,
body.startdm-dark button[type="submit"] {
  background: #7b307b !important;
  color: #ffffff !important;
  border-color: #7b307b !important;
}

body.startdm-dark .cms-pill {
  background: #1b2030 !important;
  color: #cbd5e1 !important;
}

body.startdm-dark .cms-pill-green {
  background: rgba(34,197,94,.12) !important;
  color: #86efac !important;
}

body.startdm-dark .cms-pill-purple {
  background: rgba(123,48,123,.28) !important;
  color: #f0c4ff !important;
}

body.startdm-dark iframe,
body.startdm-dark pre,
body.startdm-dark code {
  background: #0f121b !important;
  color: #e8edf5 !important;
  border-color: rgba(255,255,255,.1) !important;
}

body.startdm-dark .ai-loader-overlay {
  background: rgba(10, 11, 19, .36) !important;
  backdrop-filter: blur(12px) saturate(1.15) !important;
  -webkit-backdrop-filter: blur(12px) saturate(1.15) !important;
}

body.startdm-dark .ai-loader-title {
  color: #f8fafc !important;
}

body.startdm-dark .ai-loader-subtitle {
  color: rgba(248,250,252,.72) !important;
}


/* ============================================================
   STARTDM OPTIMIZED GLOBAL UI / LOADER / THEME FINAL
   ============================================================ */
:root{
  --sdm-card:#ffffff;
  --sdm-text:#0f172a;
  --sdm-muted:#64748b;
  --sdm-line:rgba(15,23,42,.10);
  --sdm-brand:#7b307b;
}
html[data-theme="light"] body.startdm-dark,
html[data-theme="light"] body{
  background:
    radial-gradient(circle at 85% 10%, rgba(123,48,123,.08), transparent 22rem),
    linear-gradient(135deg,#f8fafc 0%,#f4f6fb 100%) !important;
  color:var(--sdm-text) !important;
}
html[data-theme="light"] main{background:transparent!important;color:var(--sdm-text)!important;}
html[data-theme="dark"], html[data-theme="dark"] body{
  background:#0a0b13!important;
  color:#e8edf5!important;
}
html[data-theme="dark"] main{background:#0a0b13!important;color:#e8edf5!important;}
html[data-theme="dark"] .card,
html[data-theme="dark"] .project-card,
html[data-theme="dark"] .cms-panel,
html[data-theme="dark"] .cms-stat,
html[data-theme="dark"] .cg-card,
html[data-theme="dark"] .gallery-header,
html[data-theme="dark"] .table-wrap{
  background:#11131c!important;
  border-color:rgba(255,255,255,.08)!important;
  color:#e8edf5!important;
  box-shadow:0 18px 45px rgba(0,0,0,.28)!important;
}
html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] label,
html[data-theme="dark"] strong{color:#f8fafc!important;}
html[data-theme="dark"] p,
html[data-theme="dark"] small,
html[data-theme="dark"] .gallery-subtitle{color:#aab4c4!important;}
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select{
  background:#0f121b!important;
  border-color:rgba(255,255,255,.12)!important;
  color:#f8fafc!important;
}
html[data-theme="dark"] th{background:#151824!important;color:#9aa4b5!important;border-color:rgba(255,255,255,.08)!important;}
html[data-theme="dark"] td{background:#11131c!important;color:#e8edf5!important;border-color:rgba(255,255,255,.07)!important;}
html[data-theme="dark"] tr:hover td{background:#171a26!important;}

.startdm-ai-loader{
  position:fixed;
  inset:0;
  z-index:99999;
  display:none;
  align-items:center;
  justify-content:center;
  background:rgba(241,242,244,.34);
  backdrop-filter:blur(12px) saturate(1.15);
  -webkit-backdrop-filter:blur(12px) saturate(1.15);
}
.startdm-ai-loader.is-active{display:flex;}
.startdm-loader-core{pointer-events:none;text-align:center;color:#0a0b13;}
.particle-orbit{position:relative;width:150px;height:150px;margin:0 auto 22px;}
.particle-dot{position:absolute;width:9px;height:9px;border-radius:999px;background:#7b307b;box-shadow:0 0 24px rgba(123,48,123,.85);left:50%;top:50%;transform-origin:0 0;animation:particleSpin 1.8s linear infinite;}
.particle-dot:nth-child(2){animation-delay:0s;transform:rotate(0deg) translateX(58px);opacity:.95;}
.particle-dot:nth-child(3){animation-delay:-.18s;transform:rotate(40deg) translateX(66px);opacity:.85;}
.particle-dot:nth-child(4){animation-delay:-.36s;transform:rotate(80deg) translateX(52px);opacity:.75;}
.particle-dot:nth-child(5){animation-delay:-.54s;transform:rotate(120deg) translateX(70px);opacity:.65;}
.particle-dot:nth-child(6){animation-delay:-.72s;transform:rotate(160deg) translateX(48px);opacity:.95;}
.particle-dot:nth-child(7){animation-delay:-.90s;transform:rotate(200deg) translateX(64px);opacity:.72;}
.particle-dot:nth-child(8){animation-delay:-1.08s;transform:rotate(240deg) translateX(56px);opacity:.82;}
.particle-dot:nth-child(9){animation-delay:-1.26s;transform:rotate(280deg) translateX(72px);opacity:.68;}
.particle-dot:nth-child(10){animation-delay:-1.44s;transform:rotate(320deg) translateX(50px);opacity:.9;}
.particle-core{position:absolute;width:46px;height:46px;left:50%;top:50%;border-radius:999px;transform:translate(-50%,-50%);background:rgba(123,48,123,.95);box-shadow:0 0 54px rgba(123,48,123,.9);animation:corePulse 1.25s ease-in-out infinite;}
.ai-loader-title{font-size:18px;font-weight:900;letter-spacing:-.02em;text-shadow:0 1px 18px rgba(255,255,255,.65);}
.ai-loader-subtitle{margin-top:8px;color:rgba(10,11,19,.62);font-size:13px;text-shadow:0 1px 18px rgba(255,255,255,.55);}
html[data-theme="dark"] .startdm-ai-loader{background:rgba(10,11,19,.36);}
html[data-theme="dark"] .ai-loader-title{color:#f8fafc!important;}
html[data-theme="dark"] .ai-loader-subtitle{color:rgba(248,250,252,.72)!important;}
@keyframes particleSpin{from{rotate:0deg;}to{rotate:360deg;}}
@keyframes corePulse{0%,100%{transform:translate(-50%,-50%) scale(.88);opacity:.78;}50%{transform:translate(-50%,-50%) scale(1.12);opacity:1;}}

/* ============================================================
   FINAL FIX: CMS PREVIEW BUTTON TEXT
   ============================================================ */

a.cms-action-dark,
.cms-action-dark,
.cms-actions .cms-action-dark,
.cms-table .cms-action-dark,
.cms-panel .cms-action-dark {
  background: #0a0b13 !important;
  color: #ffffff !important;
  border-color: #0a0b13 !important;
  opacity: 1 !important;
  text-indent: 0 !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  line-height: 34px !important;
}

a.cms-action-dark:visited,
a.cms-action-dark:hover,
a.cms-action-dark:focus,
a.cms-action-dark:active {
  color: #ffffff !important;
}

body.startdm-dark a.cms-action-dark,
body.startdm-dark .cms-action-dark {
  background: #7b307b !important;
  color: #ffffff !important;
  border-color: #7b307b !important;
}

/* ============================================================
   CONTENT STUDIO APP SHELL — FINAL GLASS UI
   ============================================================ */
:root {
  --shell-bg: #eef2f8;
  --shell-card: rgba(255, 255, 255, .76);
  --shell-card-strong: rgba(255, 255, 255, .92);
  --shell-text: #172033;
  --shell-muted: #64748b;
  --shell-border: rgba(148, 163, 184, .20);
  --shell-sidebar: rgba(15, 23, 42, .92);
  --shell-accent: #7c3aed;
}

html[data-theme="dark"] {
  --shell-bg: #080b13;
  --shell-card: rgba(17, 24, 39, .72);
  --shell-card-strong: rgba(17, 24, 39, .92);
  --shell-text: #f8fafc;
  --shell-muted: #9aa8bc;
  --shell-border: rgba(255, 255, 255, .09);
  --shell-sidebar: rgba(5, 8, 16, .88);
}

html,
html[data-theme="light"],
html[data-theme="dark"] {
  background: var(--shell-bg) !important;
}

body,
html[data-theme="light"] body,
html[data-theme="dark"] body {
  min-height: 100vh;
  color: var(--shell-text) !important;
  background:
    radial-gradient(circle at 85% 8%, rgba(99, 102, 241, .15), transparent 27rem),
    radial-gradient(circle at 18% 90%, rgba(236, 72, 153, .10), transparent 25rem),
    var(--shell-bg) !important;
}

.app-sidebar,
aside.app-sidebar {
  position: fixed;
  inset: 14px auto 14px 14px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  width: 252px;
  min-height: calc(100vh - 28px);
  padding: 18px;
  overflow: hidden;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 25px;
  background:
    radial-gradient(circle at 15% 0%, rgba(124, 58, 237, .30), transparent 17rem),
    linear-gradient(165deg, var(--shell-sidebar), rgba(8, 11, 22, .96));
  box-shadow: 0 28px 75px rgba(15, 23, 42, .28);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
}

.brand-block {
  display: grid !important;
  gap: 7px !important;
  justify-items: start !important;
  padding: 4px 5px 18px;
  overflow: visible !important;
}

.brand-logo,
aside .brand-logo {
  width: 142px !important;
  height: 44px !important;
  max-height: 44px !important;
  object-fit: contain !important;
  object-position: left center;
  transition: filter .2s ease;
}

html[data-theme="dark"] .brand-logo {
  filter: brightness(0) invert(1) !important;
}

.brand-product {
  color: rgba(255, 255, 255, .55);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.sidebar-nav {
  display: grid;
  gap: 3px;
}

.sidebar-nav a,
.logout-link {
  display: flex;
  align-items: center;
  min-height: 42px;
  gap: 10px;
  margin: 0;
  padding: 9px 11px;
  color: rgba(255, 255, 255, .72) !important;
  border: 1px solid transparent;
  border-radius: 13px;
  font-size: 13px;
  font-weight: 700;
}

.sidebar-nav a:hover,
.sidebar-nav a[aria-current="page"],
.logout-link:hover {
  color: #fff !important;
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .08);
  transform: none;
}

.nav-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(255, 255, 255, .28);
}

.sidebar-nav a:hover .nav-dot {
  background: #c4b5fd;
  box-shadow: 0 0 12px rgba(196, 181, 253, .8);
}

.sidebar-footer {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.shell-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

button.icon-toggle {
  display: grid;
  place-items: center;
  width: 36px !important;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0 !important;
  color: rgba(255, 255, 255, .76) !important;
  border: 1px solid rgba(255, 255, 255, .11) !important;
  border-radius: 11px !important;
  background: rgba(255, 255, 255, .07) !important;
  box-shadow: none !important;
}

.theme-icon {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-icon-moon,
html[data-theme="dark"] .theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-moon { display: block; }

.language-switcher {
  display: flex;
  flex: 1;
  gap: 3px;
  height: 36px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 11px;
  background: rgba(255, 255, 255, .06);
}

.language-switcher button {
  min-width: 0;
  min-height: 28px;
  flex: 1;
  padding: 2px 5px !important;
  color: rgba(255, 255, 255, .55) !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 10px;
}

.language-switcher button.active {
  color: #fff !important;
  background: rgba(139, 92, 246, .70) !important;
}

.logout-link {
  min-height: 35px;
  justify-content: center;
  padding: 6px 10px;
  color: rgba(254, 202, 202, .78) !important;
  font-size: 11px;
}

.app-main,
main.app-main {
  width: auto;
  max-width: none;
  margin-left: 280px;
  padding: 28px 30px 50px;
  color: var(--shell-text);
  background: transparent !important;
}

.card,
.project-card,
.cms-panel,
.cms-stat,
.cg-card,
.gallery-card,
.translation-progress-card,
.kr-section-top,
.kr-filter-card,
.kr-sort-card,
.pillar-card,
.explorer-card {
  color: var(--shell-text) !important;
  border-color: var(--shell-border) !important;
  background: var(--shell-card) !important;
  box-shadow: 0 20px 55px rgba(15, 23, 42, .08) !important;
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .project-card,
html[data-theme="dark"] .cms-panel,
html[data-theme="dark"] .cms-stat,
html[data-theme="dark"] .cg-card,
html[data-theme="dark"] .gallery-card,
html[data-theme="dark"] .translation-progress-card,
html[data-theme="dark"] .kr-section-top,
html[data-theme="dark"] .kr-filter-card,
html[data-theme="dark"] .kr-sort-card,
html[data-theme="dark"] .pillar-card,
html[data-theme="dark"] .explorer-card {
  color: var(--shell-text) !important;
  border-color: var(--shell-border) !important;
  background: var(--shell-card) !important;
}

html[data-theme="dark"] .cg-step-glass {
  background: linear-gradient(145deg, rgba(22, 28, 42, .95), rgba(15, 20, 34, .86));
}

html[data-theme="dark"] .cg-step-title,
html[data-theme="dark"] .cg-step-percent b,
html[data-theme="dark"] .cg-step-footer strong {
  color: #f8fafc;
}

html[data-theme="dark"] .cg-workflow-card {
  background: linear-gradient(135deg, rgba(17, 24, 39, .88), rgba(11, 16, 28, .76));
}

@media (max-width: 860px) {
  .app-sidebar,
  aside.app-sidebar {
    position: relative;
    inset: auto;
    width: auto;
    min-height: auto;
    margin: 10px;
  }
  .app-main,
  main.app-main {
    margin-left: 0;
    padding: 14px;
  }
  .sidebar-footer {
    margin-top: 16px;
  }
}

html[dir="rtl"] .app-sidebar,
html[dir="rtl"] aside.app-sidebar {
  right: 14px;
  left: auto;
}

html[dir="rtl"] .app-main,
html[dir="rtl"] main.app-main {
  margin-right: 280px;
  margin-left: 0;
}

html[dir="rtl"] .brand-logo {
  object-position: right center;
}

@media (max-width: 860px) {
  html[dir="rtl"] .app-main,
  html[dir="rtl"] main.app-main {
    margin-right: 0;
  }
}

/* Light mode sidebar controls visibility fix */
html[data-theme="light"] .sidebar-footer {
  border-top-color: rgba(15, 23, 42, .16) !important;
}

html[data-theme="light"] button.icon-toggle {
  color: #334155 !important;
  background: rgba(15, 23, 42, .07) !important;
  border-color: rgba(15, 23, 42, .18) !important;
}

html[data-theme="light"] button.icon-toggle:hover {
  color: #111827 !important;
  background: rgba(15, 23, 42, .12) !important;
  border-color: rgba(15, 23, 42, .26) !important;
}

html[data-theme="light"] .language-switcher {
  background: rgba(15, 23, 42, .05) !important;
  border-color: rgba(15, 23, 42, .15) !important;
}

html[data-theme="light"] .language-switcher button {
  color: #475569 !important;
}

/* Light mode sidebar navigation contrast fix */
html[data-theme="light"] .sidebar-nav a,
html[data-theme="light"] .logout-link {
  color: #334155 !important;
}

html[data-theme="light"] .sidebar-nav a:hover,
html[data-theme="light"] .sidebar-nav a[aria-current="page"],
html[data-theme="light"] .logout-link:hover {
  color: #111827 !important;
  background: rgba(15, 23, 42, .07) !important;
  border-color: rgba(15, 23, 42, .10) !important;
}

html[data-theme="light"] .nav-dot {
  background: #94a3b8 !important;
}

html[data-theme="light"] .sidebar-nav a:hover .nav-dot,
html[data-theme="light"] .sidebar-nav a[aria-current="page"] .nav-dot {
  background: #7c3aed !important;
  box-shadow: 0 0 10px rgba(124, 58, 237, .35) !important;
}

html[data-theme="light"] .brand-product {
  color: #64748b !important;
}
