/* ==========================================================================
   Online Code Editor – Design System
   Dark is the default; `body.theme-light` switches to light (Theme button / Settings).
   Structure: 1 Tokens · 2 Basics · 3 Controls · 4 Login · 5 App-Shell · 6 Dashboard
           7 Social pages · 8 Editor · 9 Overlays · 10 Preview · 11 Toast · 12 Responsive
   ========================================================================== */

/* 1 · Tokens ------------------------------------------------------------- */
:root {
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
  --font-mono: 'Fira Code', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --topbar-h: 64px;
  --sidebar-w: 268px;

  --bg: #0a0d17;
  --bg-raised: #0f1322;
  --surface: #131829;
  --surface-2: #1a2037;
  --surface-3: #242b49;
  --editor: #0e1220;

  --line: rgba(150, 160, 255, 0.10);
  --line-strong: rgba(150, 160, 255, 0.20);

  --text: #e9ecf8;
  --text-2: #a4acc8;
  --text-3: #7480a3;

  --accent: #8793ff;
  --accent-strong: #5565f0;
  --accent-soft: rgba(135, 147, 255, 0.14);
  --accent-grad: linear-gradient(135deg, #5565f0 0%, #7a55ef 100%);

  --ok: #3fdc9a;
  --warn: #ffb757;
  --bad: #ff6f87;

  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;

  --shadow-pop: 0 28px 70px -14px rgba(2, 4, 16, 0.7), 0 0 0 1px var(--line-strong);
  --shadow-soft: 0 10px 30px -12px rgba(2, 4, 16, 0.55);
  --backdrop: rgba(5, 7, 16, 0.64);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  color-scheme: dark;
}

body.theme-light {
  --bg: #f2f4fb;
  --bg-raised: #ffffff;
  --surface: #ffffff;
  --surface-2: #eff1fa;
  --surface-3: #e2e6f6;
  --editor: #ffffff;

  --line: rgba(40, 52, 130, 0.10);
  --line-strong: rgba(40, 52, 130, 0.20);

  --text: #141a33;
  --text-2: #4b5578;
  --text-3: #727d9f;

  --accent: #4352e6;
  --accent-strong: #4352e6;
  --accent-soft: rgba(67, 82, 230, 0.10);

  --ok: #12a672;
  --warn: #c77a0a;
  --bad: #d63856;

  --shadow-pop: 0 28px 60px -16px rgba(30, 40, 110, 0.28), 0 0 0 1px var(--line-strong);
  --shadow-soft: 0 10px 28px -14px rgba(30, 40, 110, 0.25);
  --backdrop: rgba(20, 26, 51, 0.38);

  color-scheme: light;
}

/* 2 · Basis -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.05rem; }

a { color: inherit; text-decoration: none; }
b, strong { font-weight: 600; }
small { font-size: 12px; }

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.hidden { display: none !important; }

.muted { color: var(--text-2); font-size: 14px; }

.eyebrow {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0;
  text-transform: none;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

::selection { background: var(--accent-soft); color: var(--text); }

* { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; border: 2px solid transparent; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(14px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(36px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(63, 220, 154, 0.55); } 60% { box-shadow: 0 0 0 6px rgba(63, 220, 154, 0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* 3 · Bedienelemente ----------------------------------------------------- */
form { display: grid; gap: 12px; }

input, select, textarea {
  font: inherit;
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
input:hover, select:hover { border-color: var(--text-3); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
select { appearance: none; cursor: pointer; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%237480a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
select option { background: var(--surface); color: var(--text); }
input[type='checkbox'], input[type='radio'] { width: 17px; height: 17px; min-height: 0; padding: 0; accent-color: var(--accent); flex: none; }

button.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 20px;
  background: var(--accent-grad); color: #fff;
  font-weight: 600; font-size: 14px;
  border-radius: var(--r-md);
  box-shadow: 0 8px 20px -8px rgba(85, 101, 240, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: transform 0.15s var(--ease), box-shadow 0.15s, filter 0.15s;
}
button.primary:hover { filter: brightness(1.08); box-shadow: 0 12px 26px -8px rgba(85, 101, 240, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.22); }
button.primary:active { transform: translateY(1px); }
button.primary.small { min-height: 36px; padding: 0 14px; font-size: 13px; border-radius: var(--r-sm); }

button.outline, .outline {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 36px; padding: 0 14px;
  font-size: 13px; font-weight: 500; color: var(--text);
  background: transparent; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  transition: background-color 0.15s, border-color 0.15s;
}
button.outline:hover { background: var(--surface-2); border-color: var(--text-3); }

.run-button {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 36px; padding: 0 16px;
  background: var(--ok); color: #04170f;
  font-weight: 650; font-size: 13px; border-radius: var(--r-sm);
  transition: filter 0.15s, transform 0.15s var(--ease);
}
.run-button:hover { filter: brightness(1.1); }
.run-button:active { transform: translateY(1px); }

.avatar {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--accent-grad);
  color: #fff; font-weight: 700; font-size: 13px;
}

.empty-note { padding: 24px 12px; text-align: center; color: var(--text-3); font-size: 13px; }

/* 4 · Login -------------------------------------------------------------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  background: var(--bg);
}

.auth-art {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; justify-content: center;
  padding: 8vh clamp(32px, 8%, 96px);
  color: #eef0ff;
  background:
    radial-gradient(60% 50% at 15% 8%, rgba(110, 124, 255, 0.42), transparent 62%),
    radial-gradient(50% 45% at 95% 95%, rgba(150, 100, 250, 0.32), transparent 62%),
    #0a0d17;
}
.auth-art::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(rgba(170, 180, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(170, 180, 255, 0.07) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(75% 75% at 40% 45%, #000 20%, transparent 85%);
  mask-image: radial-gradient(75% 75% at 40% 45%, #000 20%, transparent 85%);
}
.auth-art .eyebrow { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; margin-bottom: 22px; padding: 6px 12px; color: #c9d0ff; font-size: 13px; border: 1px solid rgba(170, 180, 255, 0.28); border-radius: 999px; background: rgba(135, 147, 255, 0.10); }
.auth-art .eyebrow::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.auth-art h1 { font-size: clamp(2.7rem, 5.4vw, 4.6rem); line-height: 1.02; letter-spacing: -0.035em; font-weight: 700; color: #fff; }
.auth-art h1 em { font-style: normal; color: inherit; }
.auth-art p { margin-top: 20px; max-width: 420px; font-size: 16px; line-height: 1.6; color: #b6bdea; }

.mini-code {
  position: relative; margin-top: 44px; max-width: 460px;
  background: rgba(10, 13, 23, 0.72);
  border: 1px solid rgba(170, 180, 255, 0.22);
  border-radius: 16px; overflow: visible;
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  font-family: var(--font-mono); font-size: 13.5px; line-height: 2; color: #dfe3ff;
}
.mini-code-bar { display: flex; align-items: center; gap: 7px; padding: 12px 16px; border-bottom: 1px solid rgba(170, 180, 255, 0.14); font-size: 12px; color: #8f98cc; }
.mini-code-bar s { width: 10px; height: 10px; border-radius: 50%; background: #3a4166; text-decoration: none; }
.mini-code-bar s:nth-child(1) { background: #ff6f87; }
.mini-code-bar s:nth-child(2) { background: #ffb757; }
.mini-code-bar s:nth-child(3) { background: #3fdc9a; }
.mini-code-bar span { margin-left: 8px; }
.mini-code-body { position: relative; padding: 14px 18px 16px; }
.mini-code b { color: #9fabff; font-weight: 500; }
.mini-code i { color: #8ff0c0; font-style: normal; }
.mini-cursor { position: absolute; padding: 1px 8px; border-radius: 4px 4px 4px 0; font-family: var(--font-ui); font-size: 11px; font-weight: 600; line-height: 1.6; color: #0a0d17; }
.mini-cursor::before { content: ''; position: absolute; left: 0; top: 100%; width: 2px; height: 20px; background: inherit; }
.mini-cursor-a { right: 22px; top: 6px; background: #ffb757; }
.mini-cursor-b { right: 96px; top: 52px; background: #3fdc9a; }

.auth-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 32px; background: var(--bg);
}
.auth-card > * { width: min(100%, 400px); }
.auth-card .brand { margin-bottom: 40px; }
.auth-card h2 { font-size: 1.85rem; margin-bottom: 8px; }
.auth-card .muted { margin-bottom: 28px; }
.auth-card form { gap: 14px; }
.auth-card input { min-height: 48px; background: var(--surface); }
.auth-card button.primary { min-height: 48px; margin-top: 4px; width: 100%; }

.switch { margin-top: 24px; text-align: center; color: var(--text-2); font-size: 14px; }
.switch button { color: var(--accent); font-weight: 600; padding: 2px 6px; border-radius: 6px; }
.switch button:hover { background: var(--accent-soft); }

.brand { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-weight: 650; font-size: 1.1rem; letter-spacing: -0.01em; }
.brand-mark {
  width: 36px; height: 36px; display: grid; place-items: center; flex: none;
  border-radius: 11px; background: var(--accent-grad); color: #fff;
  font: 600 13px var(--font-mono);
  box-shadow: 0 8px 18px -6px rgba(85, 101, 240, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}


/* Brand identity: custom collaborative-code-editor icon */
.brand-logo { width: 42px; height: 42px; flex: none; object-fit: cover; border-radius: 12px; box-shadow: 0 8px 24px rgba(77, 92, 255, .24); transition: transform .22s ease, box-shadow .22s ease; }
.brand:hover .brand-logo { transform: translateY(-1px) scale(1.035); box-shadow: 0 10px 28px rgba(77, 92, 255, .38); }
.auth-card .brand-logo { width: 54px; height: 54px; border-radius: 15px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; color: #dfe3ff; font-size: 11px; font-weight: 700; letter-spacing: .19em; }
.auth-brand img { width: 64px; height: 64px; object-fit: cover; border-radius: 18px; box-shadow: 0 12px 34px rgba(74, 86, 255, .28); border: 1px solid rgba(160, 170, 255, .24); }
.auth-art .auth-brand { position: relative; z-index: 1; }
@media (max-width: 842px) { .auth-brand { margin-bottom: 20px; } .auth-brand img { width: 52px; height: 52px; border-radius: 14px; } }

/* 5 · App-Shell, Sidebar, Topbar ---------------------------------------- */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px;
  padding: 20px 16px 16px;
  background: var(--bg-raised);
  border-right: 1px solid var(--line);
}
.sidebar > * { flex-shrink: 0; }
.sidebar .brand { padding: 0 6px; }

.new-project {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  background: var(--accent-grad); color: #fff;
  font-weight: 600; font-size: 14px; border-radius: var(--r-md);
  box-shadow: 0 10px 22px -10px rgba(85, 101, 240, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: filter 0.15s, transform 0.15s var(--ease);
}
.new-project:hover { filter: brightness(1.1); }
.new-project:active { transform: translateY(1px); }
.plus-icon { font-size: 20px; font-weight: 500; line-height: 1; }

.side-nav { display: grid; gap: 2px; }
.side-link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  height: 40px; padding: 0 12px;
  color: var(--text-2); font-size: 14px; font-weight: 500; text-align: left;
  border-radius: 10px;
  transition: background-color 0.15s, color 0.15s;
}
.side-link svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.active { background: var(--accent-soft); color: var(--accent); }
.side-link.active::before { content: ''; position: absolute; left: -16px; top: 11px; width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--accent); }

.side-label { display: flex; align-items: center; justify-content: space-between; padding: 0 12px; margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: none; letter-spacing: 0; }
.side-label button { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; color: var(--text-3); font-size: 15px; }
.side-label button:hover { background: var(--surface-2); color: var(--text); }

.sidebar nav { display: flex; flex: none; flex-direction: column; gap: 1px; margin-top: -10px; max-height: 240px; overflow-y: auto; }
.sidebar nav .file-item {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 12px;
  color: var(--text-2); font-size: 13.5px; border-radius: 9px; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar nav .file-item::before { content: ''; width: 6px; height: 6px; flex: none; border-radius: 2px; background: var(--text-3); transition: background-color 0.15s; }
.sidebar nav .file-item:hover { background: var(--surface-2); color: var(--text); }
.sidebar nav .file-item:hover::before { background: var(--accent); }

.group-side-item, .chat-side-item, .group-chat-side-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 0 12px;
  color: var(--text-2); font-size: 13.5px; text-align: left; border-radius: 9px;
}
.group-side-item:hover, .chat-side-item:hover, .group-chat-side-item:hover { background: var(--surface-2); color: var(--text); }
.group-side-item small { margin-left: auto; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-3); font-size: 11px; }
.group-dot { width: 8px; height: 8px; flex: none; border-radius: 3px; background: var(--accent); }
.chat-avatar { width: 24px; height: 24px; border-radius: 8px; font-size: 11px; }
.chat-side-item i { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.group-chat-icon { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; }
.empty-side { padding: 4px 12px; font-size: 12.5px; color: var(--text-3); }

.side-bottom { margin-top: auto; flex-shrink: 0; padding-top: 14px; border-top: 1px solid var(--line); }
.profile-mini { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 10px; }
.profile-mini b { display: block; font-size: 13px; line-height: 1.2; }
.profile-mini small { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); }
.profile-mini small::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
#logout { width: 100%; margin-top: 8px; height: 36px; font-size: 13px; color: var(--text-3); border-radius: 9px; }
#logout:hover { background: rgba(255, 111, 135, 0.12); color: var(--bad); }

.main { min-width: 0; min-height: 100vh; background: var(--bg); }

.topbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 32px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4); backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.topbar > div:first-child { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.topbar .eyebrow { font-size: 12px; color: var(--text-3); }
.topbar h1 { font-size: 1.25rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.user-menu { display: flex; align-items: center; gap: 10px; }
.user-menu .avatar { width: 34px; height: 34px; }
#user-name { font-weight: 600; font-size: 13.5px; }

.notifications-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; margin-left: 4px;
  color: var(--text-2); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 11px;
  transition: background-color 0.15s, color 0.15s;
}
.notifications-btn:hover { background: var(--surface-2); color: var(--text); }
.notifications-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#notification-count {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 999px;
  background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; line-height: 1;
  border: 2px solid var(--bg);
}
#notification-count:empty, #notification-count[data-count='0'] { display: none; }

#top-logout { height: 38px; padding: 0 14px; font-size: 13px; color: var(--text-2); border: 1px solid var(--line-strong); border-radius: 11px; transition: background-color 0.15s, color 0.15s, border-color 0.15s; }
#top-logout:hover { background: rgba(255, 111, 135, 0.12); border-color: transparent; color: var(--bad); }

/* 6 · Dashboard ---------------------------------------------------------- */
.content { max-width: 1320px; margin: 0 auto; padding: 28px 32px 56px; }

.welcome-card {
  position: relative; overflow: hidden; isolation: isolate;
  display: flex; align-items: center; justify-content: space-between; gap: 32px;
  padding: 36px 40px; margin-bottom: 36px;
  background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-xl);
}
.welcome-card::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: linear-gradient(100deg, transparent 25%, #000 100%);
  mask-image: linear-gradient(100deg, transparent 25%, #000 100%);
}
.welcome-card::after {
  content: ''; position: absolute; z-index: -1; right: -80px; top: -120px; width: 380px; height: 380px;
  background: radial-gradient(closest-side, var(--accent-soft), transparent);
}
.welcome-card h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); letter-spacing: -0.03em; margin: 4px 0 10px; }
.welcome-card p { max-width: 460px; color: var(--text-2); font-size: 15px; }
.welcome-card button.primary { min-height: 48px; padding: 0 26px; flex: none; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; }
.section-head h3 { font-size: 1.15rem; }
#project-count { font-size: 13px; color: var(--text-3); }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; margin-bottom: 36px; }

.project-card {
  display: flex; flex-direction: column; gap: 6px;
  padding: 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  transition: border-color 0.18s, background-color 0.18s;
}
.project-card[data-open] { cursor: pointer; }
.project-card[data-open]:hover { border-color: var(--accent); background: var(--surface-2); }
.project-card h3 { font-size: 1.02rem; margin-top: 10px; }
.project-card p { flex: 1; color: var(--text-2); font-size: 13.5px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.project-icon {
  --lang: var(--accent);
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--lang) 16%, transparent);
  color: var(--lang);
  font: 600 13px var(--font-mono);
}
body.theme-light .project-icon { color: color-mix(in srgb, var(--lang) 62%, #000); }
.project-icon[data-lang='javascript'], .project-icon[data-lang='js'] { --lang: #f5c542; }
.project-icon[data-lang='python'], .project-icon[data-lang='py'] { --lang: #55a8f5; }
.project-icon[data-lang='html'] { --lang: #ff7a45; }
.project-icon[data-lang='css'] { --lang: #3cc9f0; }
.project-icon[data-lang='php'] { --lang: #9a8cff; }

.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-3); }
.card-foot span:last-child { padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 11.5px; }

.dashboard-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }

.info-card { padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-heading h3 { font-size: 1rem; }
.panel-heading button { height: 30px; padding: 0 12px; font-size: 12.5px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 8px; transition: filter 0.15s; }
.panel-heading button:hover { filter: brightness(1.25); }
.panel-heading > span:not(.live-label) { padding: 1px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 12px; }

.live-label { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--ok); text-transform: none; letter-spacing: 0; }
.live-label::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); animation: pulse 2.4s ease-out infinite; }

.friends-list, .activity-list { display: grid; gap: 2px; }
.friend-row, .activity-row, .request-row, .group-member-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  transition: background-color 0.15s;
}
.friend-row:hover, .activity-row:hover, .request-row:hover, .group-member-row:hover { background: var(--surface-2); }
.friend-row > div:nth-child(2), .activity-row > div:nth-child(2), .request-row > div:nth-child(2), .group-member-row > div:nth-child(2) { flex: 1; min-width: 0; }
.friend-row b, .activity-row b, .request-row b, .group-member-row b { display: block; font-size: 13.5px; }
.friend-row small, .activity-row small, .request-row small, .group-member-row small { display: block; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-avatar { width: 36px; height: 36px; }
.online-dot { width: 8px; height: 8px; margin-left: auto; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(63, 220, 154, 0.18); flex: none; }
.activity-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.activity-row time { margin-left: auto; flex: none; font-size: 12px; color: var(--text-3); }

.friend-action, .request-row button, .group-add-member, .settings-group-row button {
  height: 30px; padding: 0 12px; flex: none;
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px;
  transition: background-color 0.15s, color 0.15s;
}
.friend-action:hover, .request-row button:hover, .group-add-member:hover, .settings-group-row button:hover { background: var(--surface-3); color: var(--text); }
.chat-action, .request-row button[data-accept-notification] { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.friend-action.danger, .request-row button.reject, .settings-group-row button { color: var(--bad); }
.friend-action.danger:hover, .request-row button.reject:hover, .settings-group-row button:hover { background: rgba(255, 111, 135, 0.14); }

/* 7 · Social-Seiten ------------------------------------------------------ */
.page-view { max-width: 1320px; margin: 0 auto; padding: 28px 32px 56px; }
.page-view-head { margin-bottom: 24px; }
.page-view-head h2 { font-size: 1.9rem; letter-spacing: -0.03em; margin: 2px 0 6px; }
.page-view-head p { color: var(--text-2); }
.friends-page-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.friends-page-grid + .info-card, .page-view > .info-card { margin-top: 16px; }
.invite-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.invite-card p { color: var(--text-2); margin-bottom: 10px; }
.invite-icon { width: 46px; height: 46px; display: grid; place-items: center; margin-bottom: 8px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); font-size: 24px; font-weight: 400; }
.friend-search-input { margin-bottom: 12px; }
.activity-page-card .activity-list { gap: 4px; }

/* 8 · Editor ------------------------------------------------------------- */
.editor-view {
  display: flex; flex-direction: column; gap: 12px;
  height: calc(100vh - var(--topbar-h));
  padding: 16px 20px 20px;
}

.editor-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex: none; }
.editor-head > div:first-child { display: flex; align-items: center; gap: 14px; min-width: 0; }
.editor-head h2 { font-size: 1.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; font-size: 13px; font-weight: 500; color: var(--text-2); border: 1px solid var(--line-strong); border-radius: 9px; transition: background-color 0.15s, color 0.15s; }
.back:hover { background: var(--surface-2); color: var(--text); }
.editor-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.saved { display: inline-flex; align-items: center; margin-right: 6px; font-size: 12.5px; font-weight: 500; color: var(--ok); }
.saved.is-dirty { color: var(--warn); }

.ide-tools { display: flex; align-items: center; gap: 6px; flex: none; flex-wrap: wrap; }
.ide-tools button {
  height: 30px; padding: 0 12px; font-size: 12.5px; font-weight: 500; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.ide-tools button:hover { background: var(--surface-2); color: var(--text); border-color: var(--line-strong); }

.workspace {
  display: grid; grid-template-columns: 252px minmax(0, 1fr);
  flex: 1; min-height: 0;
  background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.files-panel { display: flex; flex-direction: column; min-height: 0; padding: 12px 8px 10px; background: var(--bg-raised); border-right: 1px solid var(--line); }
.panel-title { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 10px; font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: none; letter-spacing: 0; }
.panel-title button { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; color: var(--text-2); font-size: 16px; }
.panel-title button:hover { background: var(--surface-2); color: var(--text); }
.panel-title span { color: var(--ok); font-weight: 600; }
#file-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 2px; }

.file-item, .tree-folder {
  display: flex; align-items: center; gap: 8px;
  min-height: 30px; padding: 0 10px;
  color: var(--text-2); font-size: 13px; border-radius: 7px; cursor: pointer; user-select: none;
  transition: background-color 0.12s, color 0.12s;
}
.file-item:hover, .tree-folder:hover { background: var(--surface-2); color: var(--text); }
.file-item.active { background: var(--accent-soft); color: var(--text); }
.tree-folder b { font-weight: 550; color: var(--text); }
.tree-folder.selected-folder { background: var(--surface-2); }
.tree-folder.collapsed .tree-chevron { transform: rotate(-90deg); }
.tree-chevron { width: 12px; flex: none; font-size: 11px; color: var(--text-3); text-align: center; }
.folder-icon { flex: none; width: 16px; height: 13px; font-size: 0; background: var(--accent); opacity: 0.85;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 13'%3E%3Cpath d='M1.5 1h4.2l1.6 1.8h7.2c.6 0 1 .4 1 1V11c0 .6-.4 1-1 1H1.5c-.6 0-1-.4-1-1V2c0-.6.4-1 1-1z' fill='%23000'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 13'%3E%3Cpath d='M1.5 1h4.2l1.6 1.8h7.2c.6 0 1 .4 1 1V11c0 .6-.4 1-1 1H1.5c-.6 0-1-.4-1-1V2c0-.6.4-1 1-1z' fill='%23000'/%3E%3C/svg%3E") center / contain no-repeat; }
.tree-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-extension-icon {
  --ext: var(--text-3);
  min-width: 26px; padding: 1px 4px; flex: none; text-align: center;
  font: 700 9px/1.5 var(--font-mono); letter-spacing: 0.02em;
  color: var(--ext); background: color-mix(in srgb, var(--ext) 15%, transparent); border-radius: 5px;
}
.icon-js { --ext: #f5c542; } .icon-html { --ext: #ff7a45; } .icon-css { --ext: #3cc9f0; }
.icon-php { --ext: #9a8cff; } .icon-py { --ext: #55a8f5; } .icon-md { --ext: #3fdc9a; }
body.theme-light .file-extension-icon { color: color-mix(in srgb, var(--ext) 60%, #000); }
.unsaved-dot { margin-left: auto; font-size: 9px; color: var(--warn); }
.drop-target { background: var(--accent-soft) !important; outline: 1px dashed var(--accent); outline-offset: -1px; }

.collab { margin-top: 8px; padding: 10px 8px 4px; border-top: 1px solid var(--line); }
.collab .panel-title { padding-top: 0; }
.collab p { margin-top: 8px; font-size: 12px; color: var(--text-3); line-height: 1.45; }
.team-avatars { display: flex; align-items: center; gap: 8px; padding: 3px 0 3px 3px; }
.small-avatar { width: 28px; height: 28px; font-size: 11px; border-radius: 9px; border: 2px solid var(--bg-raised); }
.small-avatar.alt { background: var(--surface-2); color: var(--text-2); border: 1px dashed var(--line-strong); }
.realtime-user { background: var(--presence-color, var(--accent-strong)); box-shadow: 0 0 0 2px var(--bg-raised), 0 0 0 3.5px var(--presence-color, var(--accent)); }

.code-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--editor); }

.code-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: none; height: 36px; padding: 0 16px; background: var(--bg-raised); border-bottom: 1px solid var(--line); }
#active-file { font: 500 12.5px var(--font-mono); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.language-pill { padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 600; }

.tab-strip { display: flex; flex: none; overflow-x: auto; background: var(--bg-raised); border-bottom: 1px solid var(--line); }
.tab-strip:empty { display: none; }
.editor-tab {
  display: inline-flex; align-items: center; gap: 8px; flex: none;
  height: 38px; padding: 0 12px 0 16px; white-space: nowrap;
  font-size: 13px; font-weight: 500; color: var(--text-3);
  border-right: 1px solid var(--line); border-bottom: 2px solid transparent;
  transition: color 0.12s, background-color 0.12s;
}
.editor-tab:hover { color: var(--text); background: var(--surface); }
.editor-tab.active { color: var(--text); background: var(--editor); border-bottom-color: var(--accent); }
.editor-tab > span, .editor-tab > i { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; font-style: normal; font-size: 14px; line-height: 1; opacity: 0.55; }
.editor-tab > span:hover, .editor-tab > i:hover { opacity: 1; background: var(--surface-3); }

.editor-stack { display: flex; flex: 1; min-width: 0; min-height: 200px; }
.monaco-editor-host { flex: 1 1 0; min-width: 0; min-height: 200px; }
#monaco-split { display: none; border-left: 1px solid var(--line-strong); }
#monaco-diff { display: none; flex: 1 1 0; min-width: 0; flex-direction: column; }
#diff-caption { flex: none; padding: 7px 16px; font-size: 12px; color: var(--text-2); background: var(--bg-raised); border-bottom: 1px solid var(--line); }
#diff-host { flex: 1; min-height: 0; }
.editor-stack[data-mode='side'] #monaco-split { display: block; }
.editor-stack[data-mode='diff'] #monaco-editor, .editor-stack[data-mode='diff'] #monaco-split { display: none; }
.editor-stack[data-mode='diff'] #monaco-diff { display: flex; }
.ide-tools button.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

/* Gutter marker & tab status */
.oce-glyph-error, .oce-glyph-warn { margin-left: 4px; }
.oce-glyph-error::before, .oce-glyph-warn::before { content: ''; display: block; width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; }
.oce-glyph-error::before { background: var(--bad); box-shadow: 0 0 0 3px rgba(255, 111, 135, 0.2); }
.oce-glyph-warn::before { background: var(--warn); box-shadow: 0 0 0 3px rgba(255, 183, 87, 0.2); }
.dirty-indicator { width: 20px; height: 20px; display: grid; place-items: center; font-style: normal; font-size: 11px; color: var(--warn); }
.editor-tab:hover .dirty-indicator { display: none; }
.editor-tab .dirty-indicator ~ span { display: none; }
.editor-tab:hover .dirty-indicator ~ span { display: grid; }
.status-problems { padding: 0 8px; height: 100%; font: inherit; color: inherit; border-radius: 0; }
.status-problems:hover { background: rgba(255, 255, 255, 0.16); }
.status-problems[data-state='error'] { background: rgba(255, 111, 135, 0.35); }
.status-problems[data-state='warn'] { background: rgba(255, 183, 87, 0.28); }
#quick-file-results button.selected { background: var(--accent-soft); color: var(--text); }
#code-editor {
  flex: 1; min-height: 200px; resize: none; outline: none; border: 0; border-radius: 0;
  padding: 18px 20px; background: var(--editor); color: var(--text);
  font: 13px/1.7 var(--font-mono); box-shadow: none; tab-size: 2;
}
#code-editor:focus { box-shadow: none; }
#code-editor.has-errors { box-shadow: inset 3px 0 0 var(--bad); }
.legacy-editor-source { display: none !important; }

.run-panel { flex: none; max-height: 32%; overflow: auto; padding: 10px 16px 12px; background: var(--bg-raised); border-top: 1px solid var(--line-strong); }
.run-panel > div { display: flex; align-items: center; gap: 12px; }
.run-panel strong { font-size: 12px; font-weight: 600; color: var(--text); }
#run-status { font-size: 12px; color: var(--text-3); }
#run-output { margin-top: 8px; font: 12.5px/1.65 var(--font-mono); color: var(--text-2); white-space: pre-wrap; word-break: break-word; }

.editor-footer { display: none; }

.workspace-statusbar {
  display: flex; align-items: center; gap: 18px; flex: none; height: 26px; padding: 0 14px;
  background: var(--accent-strong); color: rgba(255, 255, 255, 0.92);
  font-size: 11.5px; font-weight: 500;
}
.status-spacer { flex: 1; }
.status-online { color: #c9ffe6; }

.lint-panel { padding: 8px 16px; font-size: 12.5px; border-top: 1px solid var(--line); }
.lint-error { color: var(--bad); }
.lint-ok { color: var(--ok); }
.smart-suggestions { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 16px; }
.smart-suggestions button { padding: 3px 10px; font: 12px var(--font-mono); color: var(--text-2); background: var(--surface-2); border-radius: 6px; }
.smart-suggestions button:hover { color: var(--text); background: var(--surface-3); }

/* 9 · Overlays & Dialoge ------------------------------------------------- */
.modal, .smart-overlay {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center; padding: 24px;
  background: var(--backdrop);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  animation: fade-in 0.18s ease-out;
}
.modal-card, .smart-card {
  position: relative; width: min(520px, 100%); max-height: min(88vh, 860px); overflow-y: auto;
  padding: 28px;
  background: var(--surface); border-radius: 20px;
  box-shadow: var(--shadow-pop);
  animation: pop-in 0.26s var(--ease);
}
.modal-card h2, .smart-card h2 { font-size: 1.4rem; margin-bottom: 6px; padding-right: 36px; }
.modal-card > p, .smart-card > p, .smart-card .muted { margin-bottom: 20px; color: var(--text-2); }
.modal-card form { margin-top: 20px; gap: 12px; }
.modal-card button.primary, .smart-card button.primary { width: 100%; margin-top: 6px; }

.close, .overlay-close, .search-close {
  position: absolute; top: 14px; right: 14px; width: 32px; height: 32px;
  display: grid; place-items: center; border-radius: 9px;
  color: var(--text-3); font-size: 20px; line-height: 1;
  transition: background-color 0.15s, color 0.15s;
}
.close:hover, .overlay-close:hover, .search-close:hover { background: var(--surface-2); color: var(--text); }

.smart-card h3 { font-size: 0.95rem; margin: 18px 0 8px; display: flex; align-items: center; gap: 8px; }
.smart-card h3 span { padding: 1px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 12px; font-family: var(--font-ui); font-weight: 600; }

/* Notifications as a sidebar */
#notifications-panel { place-items: stretch end; padding: 12px; }
#notifications-panel .smart-card { width: min(430px, 100%); max-height: none; animation: slide-in 0.3s var(--ease); }
.notification-section { margin-top: 18px; }
.notification-title { display: flex; align-items: center; justify-content: space-between; padding-bottom: 8px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.notification-title b { font-size: 13.5px; }
.notification-title span { min-width: 22px; padding: 1px 7px; text-align: center; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
.notification-activity { display: flex; gap: 10px; padding: 8px 4px; font-size: 13px; color: var(--text-2); }

/* Chat */
#chat-modal .smart-card { display: flex; flex-direction: column; width: min(520px, 100%); height: min(80vh, 700px); padding-bottom: 20px; }
.chat-messages { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; margin: 14px -8px; padding: 4px 8px; overflow-y: auto; }
.chat-message { display: flex; flex-direction: column; gap: 2px; align-self: flex-start; max-width: 80%; padding: 9px 13px; background: var(--surface-2); border-radius: 16px 16px 16px 5px; }
.chat-message b { font-size: 11.5px; color: var(--accent); }
.chat-message span { font-size: 13.5px; line-height: 1.45; word-break: break-word; }
.chat-message small { align-self: flex-end; font-size: 10.5px; color: var(--text-3); }
.chat-message.mine { align-self: flex-end; background: var(--accent-grad); color: #fff; border-radius: 16px 16px 5px 16px; }
.chat-message.mine b, .chat-message.mine small { color: rgba(255, 255, 255, 0.72); }
.shared-project { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 10px; font-size: 13px; font-weight: 600; text-align: left; color: inherit; background: rgba(255, 255, 255, 0.12); border-radius: 10px; }
.shared-project small { font-weight: 400; opacity: 0.75; }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; }
.chat-form button.primary { width: auto !important; margin-top: 0 !important; }
.chat-share-bar { display: flex; gap: 8px; margin-top: 10px; }
.chat-share-bar select { flex: 1; min-height: 36px; padding-top: 6px; padding-bottom: 6px; font-size: 13px; }
.chat-share-bar button { height: 36px; padding: 0 14px; font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: var(--r-sm); }

/* Friends, groups, sharing */
.friend-picker-list, .group-friend-select, .share-section, .settings-groups, .group-detail-section { display: grid; gap: 4px; }
.friend-picker-item, .share-target { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; text-align: left; border-radius: 12px; transition: background-color 0.15s; }
.friend-picker-item:hover, .share-target:hover { background: var(--surface-2); }
.friend-picker-item > span:nth-child(2) { flex: 1; min-width: 0; }
.friend-picker-item b { display: block; font-size: 13.5px; }
.friend-picker-item small { display: block; color: var(--text-3); }
.friend-picker-item strong, .share-target strong { margin-left: auto; padding: 4px 11px; font-size: 12px; color: var(--accent); background: var(--accent-soft); border-radius: 8px; }
.share-target { font-size: 14px; font-weight: 500; }
.share-section h3 { margin-top: 16px; }
.group-friend-select { padding: 12px; border: 1px solid var(--line-strong); border-radius: var(--r-md); max-height: 220px; overflow-y: auto; }
.group-friend-select > b { font-size: 12.5px; color: var(--text-2); margin-bottom: 4px; }
.group-friend-option { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.group-friend-option:hover { background: var(--surface-2); }
.group-friend-option .avatar { width: 28px; height: 28px; font-size: 11px; }
.group-name-label, .settings-form label { display: grid; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.settings-form { gap: 14px; }
.privacy-check { display: flex !important; align-items: center; gap: 10px; padding: 11px 14px; font-size: 13.5px !important; color: var(--text) !important; border: 1px solid var(--line-strong); border-radius: var(--r-md); cursor: pointer; }
.privacy-check:hover { background: var(--surface-2); }
.settings-groups { margin-top: 24px; padding-top: 4px; border-top: 1px solid var(--line); }
.settings-group-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13.5px; }
.role-select { width: auto; min-height: 30px; padding: 3px 30px 3px 10px; font-size: 12.5px; border-radius: 8px; }
.role-label { padding: 2px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.group-detail-section + .group-detail-section { margin-top: 8px; }

.rename-error { min-height: 16px; color: var(--bad); font-size: 12.5px; }
.rename-actions { display: flex; justify-content: flex-end; gap: 8px; }
.rename-actions button.primary { width: auto !important; margin-top: 0 !important; }

.dependency-list { display: grid; gap: 6px; }
.dep-edge { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--surface-2); border-radius: 10px; font: 12.5px var(--font-mono); }
.dep-edge b { font-weight: 500; }
.dep-edge span { color: var(--accent); }


/* Schnellsuche (Strg+P) */
.quick-file-palette { position: fixed; inset: 0; z-index: 400; display: grid; place-items: start center; padding-top: 14vh; background: var(--backdrop); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade-in 0.15s ease-out; }
.quick-file-card { width: min(580px, 92vw); overflow: hidden; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-pop); animation: pop-in 0.22s var(--ease); }
.quick-file-card input { min-height: 56px; padding: 0 20px; font-size: 15px; background: transparent; border: 0; border-bottom: 1px solid var(--line-strong); border-radius: 0; box-shadow: none !important; }
#quick-file-results { display: grid; max-height: 340px; padding: 8px; overflow-y: auto; }
#quick-file-results button { padding: 10px 12px; text-align: left; font: 13px var(--font-mono); color: var(--text-2); border-radius: 9px; }
#quick-file-results button:hover, #quick-file-results button:focus-visible { background: var(--accent-soft); color: var(--text); outline: none; }
#quick-file-results p { padding: 18px; text-align: center; color: var(--text-3); }

/* Search & replace */
#workspace-search { position: fixed; z-index: 350; top: calc(var(--topbar-h) + 12px); right: 20px; }
.search-card { position: relative; display: grid; gap: 8px; width: min(420px, 92vw); padding: 18px 16px 16px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-pop); animation: pop-in 0.2s var(--ease); }
.search-card .search-close { top: 8px; right: 8px; }
.search-card input { min-height: 38px; font-size: 13px; }
#replace-all { height: 34px; font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: var(--r-sm); }
#search-results { max-height: 300px; overflow-y: auto; font: 12px/1.6 var(--font-mono); color: var(--text-2); }

/* 10 · Preview ----------------------------------------------------------- */
.preview-workbench { position: fixed; inset: 0; z-index: 500; display: flex; flex-direction: column; background: var(--bg); animation: fade-in 0.18s ease-out; }
.preview-workbench-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex: none; padding: 12px 20px; background: var(--bg-raised); border-bottom: 1px solid var(--line); }
.preview-workbench-head > div:first-child { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.preview-workbench-head strong { font-family: var(--font-display); font-size: 1.05rem; }
.preview-workbench-head span { font: 12.5px var(--font-mono); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-workbench-actions { display: flex; align-items: center; gap: 6px; }
.preview-workbench-actions button { height: 32px; padding: 0 14px; font-size: 12.5px; font-weight: 500; color: var(--text-2); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.preview-workbench-actions button:hover { background: var(--surface-2); color: var(--text); }
.preview-workbench-actions button#close-preview-workbench { width: 32px; padding: 0; margin-left: 8px; font-size: 18px; }
.preview-workbench-stage { display: flex; justify-content: center; flex: 1; min-height: 0; padding: 20px; overflow: auto;
  background-color: var(--bg); background-image: radial-gradient(var(--line-strong) 1px, transparent 1px); background-size: 20px 20px; }
.preview-workbench-stage iframe, #live-preview { max-width: 100%; height: 100%; border: 0; background: #fff; border-radius: 12px; box-shadow: var(--shadow-pop); transition: width 0.3s var(--ease); }
.preview-workbench-console { flex: none; height: 168px; display: flex; flex-direction: column; background: #070a12; color: #b9c3f5; border-top: 1px solid var(--line-strong); }
.preview-console-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 20px; border-bottom: 1px solid rgba(150, 160, 255, 0.12); font-size: 12px; color: #9aa4d4; }
.preview-console-head button { padding: 3px 10px; font-size: 12px; color: #9aa4d4; border-radius: 6px; }
.preview-console-head button:hover { background: rgba(150, 160, 255, 0.14); color: #fff; }
#preview-workbench-output { flex: 1; overflow-y: auto; padding: 8px 20px; font: 12.5px/1.7 var(--font-mono); white-space: pre-wrap; }

#live-preview { height: 360px; border: 1px solid var(--line-strong); }
#viewport-switcher { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; font-size: 12.5px; color: var(--text-3); }
#viewport-switcher button { height: 28px; padding: 0 12px; font-size: 12px; color: var(--text-2); background: var(--surface-2); border-radius: 7px; }
#viewport-switcher button.active, #viewport-switcher button:hover { background: var(--accent-soft); color: var(--accent); }

/* 11 · Toast ------------------------------------------------------------- */
#toast {
  position: fixed; z-index: 1000; left: 50%; bottom: 28px;
  display: flex; align-items: center; gap: 10px; max-width: min(520px, 90vw);
  padding: 12px 18px 12px 16px;
  background: var(--surface-3); color: var(--text); font-size: 13.5px; font-weight: 500;
  border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow-pop);
  opacity: 0; pointer-events: none; transform: translate(-50%, 24px);
  transition: opacity 0.2s, transform 0.3s var(--ease);
}
#toast::before { content: ''; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--accent); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* 12 · Responsive -------------------------------------------------------- */
@media (max-width: 1100px) {
  #user-name { display: none; }
  .friends-page-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  :root { --topbar-h: 56px; }

  .auth-shell { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-card { min-height: 100vh; padding: 32px 22px; }

  .app-shell { grid-template-columns: 1fr; }
  .main { padding-bottom: 68px; }

  /* Sidebar becomes the bottom tab bar */
  .sidebar {
    position: fixed; z-index: 200; inset: auto 0 0 0; height: 64px; overflow: visible;
    flex-direction: row; gap: 0; padding: 6px 8px;
    border-right: 0; border-top: 1px solid var(--line-strong);
    background: color-mix(in srgb, var(--bg-raised) 92%, transparent);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  }
  .sidebar > :not(.side-nav):not(.new-project) { display: none; }
  .side-nav { display: flex; flex: 1; gap: 2px; }
  .side-link { flex: 1; flex-direction: column; justify-content: center; gap: 3px; height: auto; padding: 0; font-size: 11px; }
  .side-link.active::before { display: none; }
  .new-project { position: fixed; right: 16px; bottom: 80px; width: 54px; height: 54px; padding: 0; border-radius: 18px; box-shadow: 0 14px 30px -8px rgba(85, 101, 240, 0.8); }
  .new-project span:last-child { display: none; }

  .topbar { padding: 0 16px; }
  .topbar .eyebrow { display: none; }
  #top-logout { display: none; }

  .content, .page-view { padding: 18px 16px 40px; }
  .welcome-card { flex-direction: column; align-items: flex-start; padding: 26px 22px; gap: 20px; }
  .project-grid { grid-template-columns: 1fr; }
  .dashboard-panels { grid-template-columns: 1fr; }

  .editor-view { height: calc(100vh - var(--topbar-h) - 64px); padding: 10px 10px 12px; gap: 8px; }
  .editor-head { flex-wrap: wrap; }
  .editor-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .workspace { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .files-panel { max-height: 30vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .collab { display: none; }

  .modal, .smart-overlay { padding: 12px; place-items: end center; }
  .modal-card, .smart-card { padding: 22px 18px; border-radius: 20px 20px 14px 14px; }
  #notifications-panel { place-items: stretch; }
  .preview-workbench-head { flex-wrap: wrap; padding: 10px 14px; }
  .preview-workbench-stage { padding: 10px; }
  #workspace-search { right: 10px; left: 10px; }
  .search-card { width: 100%; }
}

/* Order in the editor panel independent of DOM insertion order */
.code-toolbar { order: 0; } .tab-strip { order: 1; } .editor-stack { order: 2; } .legacy-editor-source { order: 3; }
.run-panel { order: 5; } .workspace-statusbar { order: 6; }
/* Old textarea helpers – linting & suggestions are now handled by Monaco (gutter, squiggles, IntelliSense) */
.lint-panel, .smart-suggestions { display: none !important; }

/* ==========================================================================
   Team functions: presence, remote cursor, team panel, settings
   ========================================================================== */
.editor-actions { position: relative; }
.collab-bar { display: flex; align-items: center; gap: 4px; margin-right: 6px; }
.collab-status { display: inline-flex; align-items: center; gap: 6px; margin-right: 6px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.collab-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.collab-status[data-state="on"] i { background: var(--ok); box-shadow: 0 0 0 3px rgba(63, 220, 154, 0.18); }
.collab-status[data-state="ro"] i { background: var(--warn, #ffb757); }
.collab-avatar {
  --c: var(--accent); width: 28px; height: 28px; display: inline-grid; place-items: center; padding: 0;
  border-radius: 50%; font-size: 12px; font-weight: 700; color: #fff; background: var(--c);
  border: 2px solid var(--surface); box-shadow: 0 0 0 1.5px var(--c); margin-left: -4px; cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.collab-avatar:first-of-type { margin-left: 0; }
.collab-avatar:hover { transform: translateY(-2px); }
.collab-avatar.following { box-shadow: 0 0 0 2.5px var(--c), 0 0 0 5px color-mix(in srgb, var(--c) 30%, transparent); }
.collab-avatar.static { cursor: default; margin-left: 0; opacity: 0.45; }
.collab-avatar.static.on { opacity: 1; }
.collab-follow { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; font-size: 12px; color: var(--text-2); }
.collab-follow button { width: 20px; height: 20px; border-radius: 6px; color: var(--text-3); font-size: 11px; }
.collab-follow button:hover { background: var(--surface-2); color: var(--text); }

.team-toggle { position: relative; }
.team-toggle .badge {
  display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 5px; margin-left: 4px;
  border-radius: 999px; background: var(--accent-strong); color: #fff; font-size: 10.5px; font-weight: 700;
}
.team-toggle .badge[hidden] { display: none; }
.icon-btn { width: 34px; padding: 0 !important; display: inline-grid; place-items: center; font-size: 15px; }

.team-avatars .realtime-user { opacity: 0.5; box-shadow: 0 0 0 2px var(--presence-color, var(--accent)); }
.team-avatars .realtime-user.is-online { opacity: 1; }

.presence-dots { display: inline-flex; gap: 2px; margin-left: auto; padding-left: 6px; }
.presence-dots i { width: 7px; height: 7px; border-radius: 50%; }

/* Remote cursors in the Monaco editor (colors/names per user come from #oce-remote-styles) */
.monaco-editor .oce-rhead { position: absolute; height: 100%; box-sizing: border-box; border-left-width: 2px; border-left-style: solid; pointer-events: none; }
.monaco-editor .oce-rhead::before {
  position: absolute; top: -17px; left: -2px; padding: 1px 6px; border-radius: 4px 4px 4px 0;
  font: 600 10.5px/15px Inter, system-ui, sans-serif; white-space: nowrap; z-index: 30; opacity: 0; transition: opacity 0.25s ease;
}
.monaco-editor .oce-rhead.oce-rflash::before { opacity: 0.95; }
.monaco-editor .oce-rhead::after { content: ''; position: absolute; left: -4px; top: -3px; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Team panel */
.workspace.has-panel { grid-template-columns: 252px minmax(0, 1fr) 340px; }
.team-panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--bg-raised); border-left: 1px solid var(--line); }
.team-panel.hidden { display: none; }
.tp-tabs { display: flex; align-items: center; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); flex: none; }
.tp-tabs button[data-tab] { height: 34px; padding: 0 12px; font-size: 13px; font-weight: 500; color: var(--text-3); border-radius: 8px 8px 0 0; border-bottom: 2px solid transparent; }
.tp-tabs button[data-tab]:hover { color: var(--text); }
.tp-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tp-close { margin-left: auto; width: 28px; height: 28px; border-radius: 7px; color: var(--text-3); font-size: 18px; }
.tp-close:hover { background: var(--surface-2); color: var(--text); }
.tp-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

.chat-list { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 12px 6px; display: flex; flex-direction: column; gap: 4px; }
.chat-msg { display: flex; flex-direction: column; max-width: 92%; align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; align-items: flex-end; }
.chat-msg:not(.grouped) { margin-top: 8px; }
.chat-meta { display: flex; gap: 8px; align-items: baseline; margin-bottom: 3px; font-size: 12px; }
.chat-meta time { color: var(--text-3); font-size: 11px; }
.chat-bubble { padding: 8px 11px; border-radius: 12px; background: var(--surface-2); font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.chat-msg.mine .chat-bubble { background: var(--accent-soft); }
.chat-bubble code { padding: 1px 5px; border-radius: 5px; background: var(--surface-3); font: 12px 'Fira Code', ui-monospace, monospace; }
.chat-bubble a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.chat-code { margin: 4px 0; padding: 0; border-radius: 9px; background: var(--editor, #0e1220); border: 1px solid var(--line-strong); overflow: hidden; max-width: 100%; }
.chat-code-head { display: block; padding: 5px 10px; font: 11.5px 'Fira Code', ui-monospace, monospace; color: var(--text-3); border-bottom: 1px solid var(--line); }
.chat-code code { display: block; padding: 9px 10px; background: transparent; overflow-x: auto; white-space: pre; font: 12px/1.55 'Fira Code', ui-monospace, monospace; color: var(--text); }
.chat-form { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.chat-form textarea { resize: none; min-height: 52px; max-height: 140px; font-size: 13.5px; line-height: 1.45; }
.chat-actions { display: flex; align-items: center; justify-content: space-between; }
.chat-actions button:not(.primary) { height: 30px; padding: 0 10px; font-size: 12.5px; color: var(--text-2); border: 1px solid var(--line-strong); border-radius: 8px; }
.chat-actions button:not(.primary):hover { background: var(--surface-2); color: var(--text); }

.hist-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); flex: none; }
.hist-head > div { display: flex; flex-direction: column; min-width: 0; }
.hist-head b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-head small, .hist-item small { color: var(--text-3); font-size: 11.5px; }
.hist-list { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.hist-item { padding: 10px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); display: flex; flex-direction: column; gap: 3px; }
.hist-item:hover { border-color: var(--line-strong); }
.hist-top { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.hist-top b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-top time { color: var(--text-3); font-size: 11.5px; flex: none; }
.hist-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.hist-actions { display: flex; gap: 6px; margin-top: 6px; }
.hist-actions button { height: 26px; padding: 0 10px; font-size: 12px; color: var(--text-2); border: 1px solid var(--line-strong); border-radius: 7px; }
.hist-actions button:hover { background: var(--surface-2); color: var(--text); }

.team-list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.team-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.team-row:hover { background: var(--surface-2); }
.team-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.team-info b { font-size: 13.5px; }
.team-info small { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-member { border-radius: 10px; }
.team-member:hover { background: var(--surface-2); }
.team-member .team-row:hover { background: transparent; }
.team-role { flex: none; max-width: 112px; padding: 5px 8px; font-size: 12.5px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); cursor: pointer; }
.team-role:disabled { opacity: .5; cursor: progress; }
.team-manage { display: flex; gap: 14px; padding: 0 8px 8px 50px; }
.team-link { background: none; border: 0; padding: 0; font-size: 12px; color: var(--accent); cursor: pointer; }
.team-link:hover { text-decoration: underline; }
.team-link.danger { color: #ef4b5f; }
.team-link[hidden] { display: none; }
.team-sub { margin: 14px 8px 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.team-edit { margin: 0 8px 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.team-edit.hidden { display: none; }
.team-foot { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.team-foot small { color: var(--text-3); font-size: 12px; line-height: 1.5; }
.team-foot code { font: 11.5px 'Fira Code', monospace; }
button.small { height: 28px; padding: 0 10px; font-size: 12.5px; }

/* Settings */
.settings-pop {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; width: 290px; padding: 14px 16px 12px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: var(--shadow-pop);
}
.settings-pop h4 { margin-bottom: 8px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.settings-pop .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; font-size: 13.5px; color: var(--text); }
.settings-pop .row > span { display: inline-flex; align-items: center; gap: 8px; }
.settings-pop output { min-width: 34px; text-align: right; color: var(--text-3); font-size: 12px; }
.settings-pop input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent-strong); }
.settings-pop input[type="range"] { width: 100px; min-height: 0; padding: 0; accent-color: var(--accent-strong); }
.settings-pop select { width: auto; min-height: 32px; padding: 0 8px; font-size: 13px; }
.settings-pop .hint { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-3); }
.settings-pop kbd { padding: 1px 5px; border: 1px solid var(--line-strong); border-radius: 5px; font: 11px 'Fira Code', monospace; }

@media (max-width: 980px) {
  .workspace.has-panel { grid-template-columns: minmax(0, 1fr); }
  .team-panel { position: fixed; inset: auto 0 0 0; height: 62vh; z-index: 50; border-left: 0; border-top: 1px solid var(--line-strong); box-shadow: 0 -18px 50px -20px rgba(0, 0, 0, 0.6); }
  .collab-follow, .collab-status { display: none; }
}
@media (prefers-reduced-motion: reduce) { .collab-avatar { transition: none; } }

.workspace-statusbar { overflow: hidden; }
.workspace-statusbar > * { white-space: nowrap; flex: none; }
.settings-pop select { min-width: 96px; }

/* In the editor: title as a single line "Workspace Editor", the small label is omitted */
body:has(#editor-view:not(.hidden)) .topbar .eyebrow { display: none; }

/* ---- Invitations with approval & notification center ---- */
.invite-card{display:flex;gap:12px;align-items:flex-start;justify-content:space-between;padding:12px;border:1px solid rgba(127,127,127,.25);border-radius:12px;margin:8px 0}
.invite-card.is-pending{border-color:#60a5fa;background:rgba(96,165,250,.08)}
.invite-body{display:flex;flex-direction:column;gap:4px;min-width:0}
.invite-body small{opacity:.7}
.notif-actions{display:flex;gap:8px;margin-top:8px;flex-wrap:wrap}
.notif-state{font-size:12px;padding:3px 8px;border-radius:999px;background:rgba(127,127,127,.15);white-space:nowrap}
.notif-state.ok{background:rgba(34,197,94,.18)}
.notif-state.no{background:rgba(239,68,68,.18)}
.notification-activity.is-new b::after{content:" · new";color:#3b82f6;font-size:12px;font-weight:600}
.invite-card .notif-actions button{width:auto;min-width:120px;padding:9px 16px;border-radius:10px;font:inherit;font-weight:600;cursor:pointer;border:0;color:#fff;background:linear-gradient(135deg,#6366f1,#8b5cf6)}
.invite-card .notif-actions button.reject{background:rgba(127,127,127,.22);color:inherit}
.invite-card .notif-actions{flex-wrap:wrap}
.ntf-item[hidden], .notification-section[hidden] { display: none !important; }
.ntf-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 8px; }
.ntf-tab { border: 1px solid rgba(127,127,127,.3); background: transparent; color: inherit; border-radius: 999px; padding: 6px 12px; cursor: pointer; font: inherit; font-size: 13px; }
.ntf-tab.is-active { background: linear-gradient(135deg,#6366f1,#8b5cf6); color: #fff; border-color: transparent; }
.ntf-toolbar { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.ntf-markall { background: transparent; border: 0; color: #3b82f6; cursor: pointer; font: inherit; font-size: 13px; padding: 4px 0; }
.ntf-click { cursor: pointer; border-radius: 10px; }
.ntf-click:hover { background: rgba(127,127,127,.08); }

/* ===== Run PHP + database panel ===== */
.smart-card.dbp-card { width: min(1040px, 95vw); max-width: none; max-height: 90vh; overflow: auto; }
.dbp-card code, .dbp-help code { font-family: var(--font-mono); font-size: .9em; padding: 1px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.dbp-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; margin-top: 14px; align-items: start; }
.dbp-side { border: 1px solid var(--line-strong); border-radius: 12px; background: var(--bg-raised); padding: 10px; max-height: 52vh; overflow: auto; }
.dbp-side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 12px; color: var(--text-2); }
.dbp-side-head button { width: 26px; height: 26px; padding: 0; border-radius: 8px; border: 1px solid var(--line-strong); background: transparent; color: var(--text-2); cursor: pointer; }
.dbp-table { display: flex; gap: 4px; margin-bottom: 4px; }
.dbp-table button { border: 0; border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; font: 13px var(--font-mono); padding: 7px 9px; }
.dbp-table button:hover:not(:disabled) { background: var(--accent-soft); }
.dbp-table button:disabled { opacity: .55; cursor: default; }
.dbp-tname { flex: 1; display: flex; justify-content: space-between; gap: 8px; text-align: left; }
.dbp-tname small { color: var(--text-2); font-size: 11px; }
.dbp-tinfo { color: var(--text-2) !important; }
.dbp-main { min-width: 0; }
#dbp-sql { width: 100%; min-height: 110px; resize: vertical; box-sizing: border-box; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--bg-raised); color: var(--text); font: 13px/1.6 var(--font-mono); }
#dbp-sql:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.dbp-actions { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.smart-card .dbp-actions button.primary { width: auto; margin: 0; padding: 9px 16px; }
.dbp-actions button.primary small { opacity: .7; margin-left: 8px; font-size: 11px; }
.dbp-spacer { flex: 1; }
#dbp-meta { font-size: 12px; color: var(--text-2); }
.dbp-reset { border: 1px solid var(--line-strong); background: transparent; color: var(--bad); border-radius: 10px; padding: 8px 12px; cursor: pointer; }
.dbp-reset:hover { background: rgba(255, 111, 135, .14); }
.dbp-scroll { overflow: auto; max-height: 40vh; border: 1px solid var(--line-strong); border-radius: 12px; }
.dbp-tbl { border-collapse: collapse; width: 100%; font: 12.5px/1.5 var(--font-mono); }
.dbp-tbl th { position: sticky; top: 0; background: var(--surface-2); text-align: left; padding: 8px 12px; color: var(--text); white-space: nowrap; }
.dbp-tbl td { padding: 7px 12px; border-top: 1px solid var(--line); color: var(--text-2); white-space: pre-wrap; word-break: break-word; max-width: 360px; }
.dbp-null { font-style: italic; opacity: .6; }
.dbp-ok { color: var(--accent); }
.dbp-error { color: var(--bad); font-family: var(--font-mono); font-size: 12.5px; white-space: pre-wrap; }
.dbp-help { margin-top: 16px; color: var(--text-2); font-size: 13px; }
.dbp-help summary { cursor: pointer; }
.dbp-help pre { margin-top: 8px; padding: 12px 14px; border-radius: 12px; background: var(--bg-raised); border: 1px solid var(--line); font: 12.5px/1.6 var(--font-mono); overflow: auto; }
.php-html-frame { width: 100%; height: 60vh; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; }
@media (max-width: 760px) { .dbp-grid { grid-template-columns: 1fr; } }

/* 13 · Folder import ----------------------------------------------------- */
.welcome-actions { display: flex; flex-wrap: wrap; gap: 10px; flex: none; align-items: center; }
.welcome-actions button { min-height: 48px; padding: 0 22px; }
.imp-overlay {
  position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; padding: 20px;
  background: var(--backdrop); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: fade-in 0.18s ease-out;
}
.imp-card {
  position: relative; width: min(560px, 100%); max-height: min(92vh, 900px); overflow-y: auto; padding: 26px;
  background: var(--surface); color: var(--text); border-radius: 20px; box-shadow: var(--shadow-pop); animation: pop-in 0.26s var(--ease);
}
.imp-card.imp-wide { width: min(980px, 100%); }
.imp-card h2 { font-size: 1.35rem; margin: 0 36px 6px 0; }
.imp-lead { color: var(--text-2); margin: 0 0 16px; }
.imp-lead b { color: var(--text); }
.imp-x { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; border-radius: 9px; font-size: 20px; color: var(--text-2); }
.imp-x:hover { background: var(--surface-2); color: var(--text); }
.imp-error { margin: 0 0 14px; padding: 10px 12px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); font-size: 13.5px; }
.imp-note { margin: 8px 0 0; font-size: 12.5px; color: var(--warn); }
.imp-note:empty { display: none; }

.imp-drop {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 30px 18px; text-align: center;
  border: 2px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--surface-2); transition: border-color .15s, background .15s;
}
.imp-drop.over, .imp-drop:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.imp-drop-icon { font-size: 34px; line-height: 1; }
.imp-drop > span { color: var(--text-3); font-size: 13px; }
.imp-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.imp-hints { margin: 18px 0 0; padding-left: 18px; color: var(--text-2); font-size: 13.5px; display: grid; gap: 6px; }
.imp-hints b { color: var(--text); font-weight: 600; }

.imp-spin { display: flex; align-items: center; gap: 12px; margin-top: 14px; color: var(--text-2); }
.imp-spin i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: imp-rot .8s linear infinite; }
@keyframes imp-rot { to { transform: rotate(360deg); } }

.imp-cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(250px, 1fr); gap: 20px; align-items: start; }
.imp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-bottom: 8px; font-size: 12.5px; }
.imp-link { color: var(--accent); font-weight: 600; padding: 2px 0; }
.imp-link:hover { text-decoration: underline; }
.imp-total { margin-left: auto; color: var(--text-2); }
.imp-tree {
  height: min(42vh, 380px); overflow: auto; padding: 6px; border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--editor); font-size: 13px;
}
.imp-empty { padding: 20px; color: var(--text-3); text-align: center; }
.imp-row { display: flex; align-items: center; gap: 4px; min-height: 28px; padding: 0 6px 0 calc(var(--d, 0) * 18px + 2px); border-radius: 7px; }
.imp-row:hover { background: var(--surface-2); }
.imp-row label { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; cursor: pointer; }
.imp-row input[type="checkbox"] { accent-color: var(--accent-strong); width: 15px; height: 15px; flex: none; }
.imp-twist { width: 20px; height: 20px; flex: none; display: grid; place-items: center; color: var(--text-3); font-size: 12px; border-radius: 5px; }
button.imp-twist:hover { background: var(--surface-3); color: var(--text); }
.imp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); font-size: 12.5px; }
.imp-dir .imp-name { font-family: var(--font-ui); font-weight: 600; }
.imp-meta { flex: none; margin-left: auto; padding-left: 8px; color: var(--text-3); font-size: 11.5px; white-space: nowrap; }
.imp-badge { flex: none; font-size: 11px; padding: 1px 7px; border-radius: 99px; color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.imp-filters { display: grid; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--text-2); }
.imp-filters label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.imp-filters input { margin-top: 3px; accent-color: var(--accent-strong); }
.imp-filters small { color: var(--text-3); }
.imp-filters code { font-family: var(--font-mono); font-size: 12px; }
.imp-skipped { margin-top: 12px; font-size: 12.5px; color: var(--text-2); }
.imp-skipped summary { cursor: pointer; font-weight: 600; }
.imp-skipped h4 { margin: 10px 0 4px; font-size: 12px; color: var(--text); }
.imp-skipped h4 span { color: var(--text-3); font-weight: 500; }
.imp-skipped ul { margin: 0; padding-left: 18px; max-height: 140px; overflow: auto; font-family: var(--font-mono); font-size: 11.5px; }
.imp-skipped em { font-family: var(--font-ui); color: var(--text-3); }

.imp-target { border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: 12px 14px 14px; margin: 0; display: grid; gap: 10px; }
.imp-target legend { padding: 0 6px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.imp-radio { display: flex; gap: 8px; align-items: center; font-weight: 600; cursor: pointer; }
.imp-radio input { accent-color: var(--accent-strong); }
.imp-sub { display: grid; gap: 10px; padding-left: 24px; }
.imp-sub[hidden] { display: none; }
.imp-sub label { display: grid; gap: 4px; font-size: 12.5px; color: var(--text-2); }
.imp-sub small { color: var(--text-3); }

.imp-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.imp-foot button { min-height: 42px; padding: 0 18px; }
.imp-card button.primary:disabled { opacity: .5; cursor: not-allowed; }

.imp-progress { height: 10px; margin: 18px 0 12px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.imp-progress i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent-grad); transition: width .25s var(--ease); }
.imp-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; padding: 0; }
.imp-chip { padding: 6px 12px; border-radius: 99px; background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.imp-chip b { color: var(--text); }
.imp-chip.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); }
.imp-chip.bad { background: color-mix(in srgb, var(--bad) 15%, transparent); }

.imp-draghint {
  position: fixed; left: 50%; top: 18px; transform: translateX(-50%); z-index: 399; pointer-events: none;
  padding: 12px 20px; border-radius: 99px; background: var(--accent-grad); color: #fff; font-weight: 600; box-shadow: var(--shadow-pop);
}
@media (max-width: 760px) {
  .imp-cols { grid-template-columns: 1fr; }
  .imp-card { padding: 20px 16px; }
  .imp-tree { height: 34vh; }
  .imp-foot button { flex: 1; }
  .welcome-actions { width: 100%; }
  .welcome-actions button { flex: 1; }
}

/* Runtimes overview */
.lang-card{max-width:760px;width:calc(100vw - 32px)}
.lang-table{width:100%;border-collapse:collapse;margin:12px 0;font-size:14px}
.lang-table td{padding:7px 10px;border-bottom:1px solid rgba(128,128,128,.25);vertical-align:top;word-break:break-word}
.lang-table .lang-ok td:first-child{color:#2e9d5b}
.lang-table .lang-missing td:first-child{color:#c0392b}
.lang-table code{font-size:12.5px}

/* Go support + output convenience */
.go-tools{display:inline-flex;gap:6px;align-items:center;margin-right:6px}
.go-tools[hidden]{display:none}
.go-tools .go-toggle{opacity:.75}
.go-tools .go-toggle.on{opacity:1;border-color:var(--accent);color:var(--accent)}
.oce-loc{color:var(--accent);text-decoration:underline dotted;cursor:pointer}
.oce-loc:hover{text-decoration:underline}
.run-stdin{margin-top:8px;font-size:12px;color:var(--text-2)}
.run-stdin summary{cursor:pointer;user-select:none}
.run-stdin textarea{display:block;width:100%;margin-top:6px;padding:8px 10px;box-sizing:border-box;font:12.5px/1.5 var(--font-mono);color:var(--text);background:var(--bg);border:1px solid var(--line-strong);border-radius:8px;resize:vertical}

/* ---------- Terminal in the style of Windows Terminal (assets/terminal.js) ---------- */
#term-toggle.active{background:var(--accent-soft);border-color:var(--accent);color:var(--accent)}
.code-panel > .term-panel{--term-fs:13px;order:5;flex:none;position:relative;display:flex;flex-direction:column;height:320px;min-height:140px;max-height:85vh;background:#0c0c0c;color:#cccccc;border-top:1px solid #2b2b2b;font:var(--term-fs)/1.45 "Cascadia Mono","Cascadia Code",Consolas,"Lucida Console",var(--font-mono),monospace}
.term-panel.hidden{display:none}
.term-panel.max{height:72vh !important}
.term-resize{position:absolute;left:0;right:0;top:-4px;height:8px;cursor:ns-resize;z-index:5;touch-action:none}
.term-resize:hover{background:var(--accent-soft)}
.term-bar{display:flex;align-items:flex-end;gap:6px;padding:4px 6px 0;background:#1f1f1f;flex:none;min-height:34px}
.term-tabs{display:flex;align-items:flex-end;gap:2px;min-width:0;overflow-x:auto;scrollbar-width:none}
.term-tabs::-webkit-scrollbar{display:none}
.term-spacer{flex:1}
.term-tab{display:flex;align-items:center;gap:7px;flex:none;max-width:200px;height:30px;padding:0 6px 0 11px;border-radius:8px 8px 0 0;color:#a8a8a8;font:12px/1 "Segoe UI Variable","Segoe UI",system-ui,sans-serif;cursor:default;user-select:none;border:1px solid transparent;border-bottom:0}
.term-tab:hover{background:#2c2c2c;color:#e6e6e6}
.term-tab.active{background:#0c0c0c;color:#fff;border-color:#2b2b2b}
.term-tab-ic{font:600 11px "Cascadia Mono",Consolas,monospace;color:#6ea0ff}
.term-tab.running .term-tab-ic{color:#f9f1a5;animation:termpulse 1s ease-in-out infinite}
.term-tab.failed .term-tab-ic{color:#ff6b78}
.term-tab-t{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.term-tab-x{width:20px;height:20px;margin:0;padding:0;border:0;border-radius:5px;background:transparent;color:inherit;font-size:14px;line-height:1;opacity:0;cursor:pointer}
.term-tab:hover .term-tab-x,.term-tab.active .term-tab-x{opacity:.8}
.term-tab-x:hover{background:rgba(255,255,255,.14);opacity:1}
.term-tabbtn{flex:none;width:28px;height:28px;margin:0 0 1px;padding:0;border:0;border-radius:6px;background:transparent;color:#cfcfcf;font-size:15px;line-height:1;cursor:pointer}
.term-tabbtn:hover{background:#333}
@keyframes termpulse{50%{opacity:.35}}
.term-btn{width:auto;height:26px;margin:0 0 2px;background:transparent;color:#c9c9c9;border:1px solid transparent;border-radius:6px;padding:0 9px;font:12px "Segoe UI Variable","Segoe UI",system-ui,sans-serif;cursor:pointer}
.term-btn:hover:not(:disabled){background:#333}
.term-btn:disabled{opacity:.35;cursor:default}
#term-stop:not(:disabled){color:#ff8a8a;border-color:#7a2d35}
.term-find{display:flex;align-items:center;gap:4px;padding:4px 8px;background:#1f1f1f;border-top:1px solid #2b2b2b;flex:none}
.term-find.hidden{display:none}
.term-find input{flex:1;min-width:0;height:26px;margin:0;padding:0 8px;background:#0c0c0c;color:#fff;border:1px solid #3a3a3a;border-radius:6px;font:12px "Segoe UI Variable","Segoe UI",system-ui,sans-serif}
.term-find-n{color:#8c8c8c;font:12px "Segoe UI",system-ui,sans-serif;min-width:34px;text-align:center}
.term-body{position:relative;flex:1;min-height:0;display:flex;flex-direction:column}
.term-screen{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;padding:6px 12px 10px;outline:0;scrollbar-width:thin;scrollbar-color:#4a4a4a #0c0c0c}
.term-screen.hidden{display:none}
.term-screen ::selection{background:#264f78;color:#fff}
.term-out{white-space:pre-wrap;word-break:break-word;tab-size:8}
.term-line{min-height:1.45em}
.term-cmd{color:#f2f2f2}
.term-ps{color:#16c60c}
.term-exit{font-size:.88em;margin:2px 0 8px;opacity:.9}
.term-exit.ok{color:#16c60c}.term-exit.bad{color:#ff6b78}
.term-sync{color:#6ea0ff;font-size:.88em}
.term-note,.term-dim{color:#8c8c8c}
.term-err{color:#ff6b78}
.term-echo{color:#f9f1a5}
.term-link{color:#6ea0ff;text-decoration:underline;cursor:pointer}
.term-hit{background:rgba(249,241,165,.12)}
.term-hit-cur{background:rgba(249,241,165,.32)}
.term-chips{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin:4px 0}
.term-chip{width:auto;height:auto;margin:0;padding:1px 9px;background:#1f1f1f;color:#cfd8ff;border:1px solid #3a3a3a;border-radius:12px;font:inherit;font-size:.9em;cursor:pointer}
.term-chip:hover{background:#2b3350;border-color:#4a86ff}
.term-keyrow{display:flex;flex-wrap:wrap;gap:6px;align-items:center;margin:4px 0}
.term-keyrow input{flex:1 1 220px;min-width:160px;width:auto;height:auto;margin:0;background:#111;color:#e6e6e6;border:1px solid #3a3a3a;border-radius:6px;padding:2px 8px;font:inherit}
.term-keyrow input:focus{outline:none;border-color:#4a86ff}
.term-chip:disabled{opacity:.5;cursor:default}
.term-inrow{display:flex;align-items:baseline;gap:8px;margin-top:2px}
.term-prompt{flex:none;max-width:60%;color:#16c60c;white-space:pre-wrap;word-break:break-all}
.term-screen.running .term-prompt{color:#f9f1a5}
.term-panel.classic .term-ps,.term-panel.classic .term-prompt{color:#cccccc}
.term-panel.classic .term-screen.running .term-prompt{color:#cccccc}
.term-inwrap{position:relative;flex:1;min-width:0;display:block}
.term-ghost{position:absolute;inset:0;pointer-events:none;white-space:pre;overflow:hidden;color:#6b6b6b;font:inherit;padding:0}
.term-panel .term-input{position:relative;display:block;width:100%;height:auto;min-height:0;margin:0;padding:0;background:transparent !important;border:0 !important;outline:0 !important;box-shadow:none !important;color:#f2f2f2;caret-color:#fff;caret-shape:block;font:inherit;border-radius:0}
.term-input::placeholder{color:#6b6b6b}
.term-status{display:flex;align-items:center;gap:14px;padding:2px 12px;background:#1f1f1f;color:#8c8c8c;font:11.5px/1.7 "Segoe UI Variable","Segoe UI",system-ui,sans-serif;flex:none;white-space:nowrap;overflow:hidden}
.term-status .st-cwd{overflow:hidden;text-overflow:ellipsis}
.term-status .st-exit.ok{color:#16c60c}.term-status .st-exit.bad{color:#ff6b78}.term-status .st-exit.run{color:#f9f1a5}
.term-menu{position:absolute;z-index:20;min-width:260px;max-width:min(420px,92%);overflow-y:auto;padding:4px;background:#2b2b2b;border:1px solid #454545;border-radius:8px;box-shadow:0 8px 28px rgba(0,0,0,.55);font:12.5px "Segoe UI Variable","Segoe UI",system-ui,sans-serif}
.term-mi{display:flex;justify-content:space-between;gap:18px;width:100%;height:auto;margin:0;padding:6px 10px;border:0;border-radius:5px;background:transparent;color:#e8e8e8;text-align:left;cursor:pointer;font:inherit}
.term-mi:hover:not(:disabled){background:#3d3d3d}
.term-mi:disabled{opacity:.4;cursor:default}
.term-mi kbd{color:#8c8c8c;font:11px "Cascadia Mono",Consolas,monospace;white-space:nowrap}
.term-msep{padding:8px 10px 3px;color:#8c8c8c;font-size:11px;text-transform:uppercase;letter-spacing:.04em;border-top:1px solid #3a3a3a;margin-top:4px}
.term-msep:empty{display:none}
.term-histpop{position:absolute;left:12px;bottom:30px;z-index:20;width:min(460px,90%);max-height:260px;overflow-y:auto;background:#1f1f1f;border:1px solid #6ea0ff;border-radius:6px;box-shadow:0 8px 28px rgba(0,0,0,.55);font:inherit}
.term-histhead{padding:4px 10px;color:#8c8c8c;font:11px "Segoe UI",system-ui,sans-serif;border-bottom:1px solid #333;position:sticky;top:0;background:#1f1f1f}
.term-histrow{padding:2px 10px;white-space:pre;overflow:hidden;text-overflow:ellipsis;cursor:pointer}
.term-histrow.sel{background:#264f78;color:#fff}
@media (max-width:760px){.term-status .st-cwd,.term-status .st-fs{display:none}.term-tab{max-width:130px}}

/* ===== AI assistant at the editor (v5.9.7) ===== */
.code-panel > .ai-dock { order: 4; flex: none; position: relative; display: flex; flex-direction: column; gap: 10px; padding: 12px 16px 10px; background: var(--bg-raised, #0f1322); border-top: 1px solid var(--line-strong, rgba(150,160,255,.2)); }
.ai-dock::before { content: ''; position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: var(--accent-grad, linear-gradient(135deg,#5565f0,#7a55ef)); opacity: .85; }
.ai-dock.hidden { display: none; }
.ai-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; min-width: 0; }
.ai-title { display: inline-flex; align-items: center; gap: 7px; font: 700 13.5px var(--font-display, inherit); letter-spacing: .01em; color: var(--text, #e9ecf8); }
.ai-spark { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: var(--accent-grad, #5565f0); color: #fff; font-size: 12px; box-shadow: 0 4px 14px -4px var(--accent-strong, #5565f0); }
.ai-dock.is-busy .ai-spark { animation: ai-pulse 1.1s ease-in-out infinite; }
@keyframes ai-pulse { 50% { transform: scale(1.18); box-shadow: 0 0 0 6px var(--accent-soft, rgba(135,147,255,.14)); } }
.ai-ctx { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--text-3, #7480a3); }
.ai-ctx b { color: var(--text-2, #a4acc8); font: 500 12px var(--font-mono, monospace); }
.ai-spacer { flex: 1 1 auto; }
.ai-seg { display: inline-flex; padding: 2px; gap: 2px; background: var(--surface, #131829); border: 1px solid var(--line, rgba(150,160,255,.1)); border-radius: 10px; }
.ai-seg button { width: auto; height: auto; min-height: 0; margin: 0; padding: 4px 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2, #a4acc8); font: 600 12px var(--font-ui, inherit); cursor: pointer; transition: background-color .15s, color .15s; }
.ai-seg button:hover { color: var(--text, #e9ecf8); }
.ai-seg button.on { background: var(--accent-soft, rgba(135,147,255,.14)); color: var(--accent, #8793ff); box-shadow: inset 0 0 0 1px var(--line-strong, rgba(150,160,255,.2)); }
.ai-x { width: 28px; height: 28px; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--text-3, #7480a3); font-size: 18px; line-height: 1; cursor: pointer; }
.ai-x:hover { background: var(--surface-2, #1a2037); color: var(--text, #e9ecf8); }
.ai-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.ai-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; width: auto; height: auto; min-height: 0; margin: 0; padding: 5px 12px; border: 1px solid var(--line-strong, rgba(150,160,255,.2)); border-radius: 999px; background: var(--surface, #131829); color: var(--text-2, #a4acc8); font: 600 12px var(--font-ui, inherit); cursor: pointer; transition: transform .15s, border-color .15s, color .15s, background-color .15s; }
.ai-chip:hover { transform: translateY(-1px); border-color: var(--accent, #8793ff); color: var(--text, #e9ecf8); background: var(--accent-soft, rgba(135,147,255,.14)); }
.ai-composer { position: relative; display: flex; align-items: flex-end; gap: 10px; padding: 8px 8px 8px 14px; background: var(--surface, #131829); border: 1px solid var(--line-strong, rgba(150,160,255,.2)); border-radius: 14px; transition: border-color .15s, box-shadow .15s; }
.ai-composer:focus-within { border-color: var(--accent, #8793ff); box-shadow: 0 0 0 4px var(--accent-soft, rgba(135,147,255,.14)); }
.ai-composer textarea { flex: 1 1 auto; min-width: 0; width: auto; height: 46px; min-height: 46px; max-height: 160px; margin: 0; padding: 6px 0; border: 0 !important; outline: 0 !important; box-shadow: none !important; background: transparent !important; color: var(--text, #e9ecf8); font: 400 14px/1.5 var(--font-ui, inherit); resize: none; }
.ai-composer textarea.ro { font-style: italic; }
.ai-send { flex: none; display: inline-flex; align-items: center; gap: 8px; width: auto; height: 38px; min-height: 0; margin: 0; padding: 0 16px; border: 0; border-radius: 10px; background: var(--accent-grad, #5565f0); color: #fff; font: 700 13px var(--font-ui, inherit); cursor: pointer; box-shadow: 0 8px 20px -8px var(--accent-strong, #5565f0); transition: transform .15s, filter .15s, opacity .15s; }
.ai-send:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.1); }
.ai-send:disabled { opacity: .55; cursor: progress; box-shadow: none; }
.ai-foot { display: flex; align-items: center; gap: 12px; font-size: 11.5px; color: var(--text-3, #7480a3); min-height: 16px; }
@media (max-width: 760px) {
  .code-panel > .ai-dock { padding: 10px 12px; }
  .ai-hint, .ai-ctx, .ai-head .ai-spacer { display: none; }
  .ai-title { flex: 1 1 auto; }
  .ai-x { order: 1; }
  .ai-seg { order: 2; }
  .ai-seg button { padding: 4px 8px; font-size: 11.5px; }
  .ai-send-l { display: none; }
  .ai-send { padding: 0 14px; }
}
@media (prefers-reduced-motion: reduce) { .ai-dock.is-busy .ai-spark { animation: none; } .ai-chip, .ai-send { transition: none; } }
#ai-toggle.active { border-color: var(--accent, #8793ff); color: var(--accent, #8793ff); background: var(--accent-soft, rgba(135,147,255,.14)); }
#ai-toggle span { margin-right: 4px; }

/* ---- Listensuche (assets/list-search.js) ---- */
.ls-hide { display: none !important; }
.ls-box { display: block; margin: 0 0 8px; }
.ls-box .ls-input { width: 100%; min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: var(--r-sm); }
.ls-box .ls-input::-webkit-search-cancel-button { cursor: pointer; }
.ls-box .ls-none { padding: 14px 8px; }
.ls-box.ls-side { margin: 0 0 6px; padding: 0 4px; }
.ls-box.ls-side .ls-input { min-height: 28px; font-size: 12px; padding: 0 10px; }
.ls-box.ls-wide { max-width: 360px; margin-bottom: 14px; }
.ls-file-results { display: flex; flex-direction: column; gap: 1px; margin-top: 6px; max-height: 60vh; overflow-y: auto; }
.ls-file-hit { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; padding: 6px 10px; text-align: left; border-radius: var(--r-xs); color: var(--text-2); }
.ls-file-hit:hover, .ls-file-hit.active { background: var(--surface-2); color: var(--text); }
.ls-file-hit small { color: var(--text-3); font-size: 11px; }
.tp-body > .ls-box { margin: 8px 8px 0; }

/* ---- Project password (assets/project-password.js) ---- */
.pw-overlay { z-index: 420; }
.pw-card { width: min(460px, 100%); text-align: left; }
.pw-lock-icon { width: 52px; height: 52px; display: grid; place-items: center; margin: 0 0 14px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); }
.pw-lock-icon.on { background: rgba(63, 220, 154, 0.14); color: var(--ok); }
.pw-lock-icon svg, .pw-btn svg, .pw-badge svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pw-card h2 { margin-bottom: 6px; }
.pw-card .pw-state { margin-bottom: 12px; }
.pw-facts { margin: 0 0 16px; padding: 0 0 0 18px; display: grid; gap: 5px; color: var(--text-2); font-size: 12.5px; line-height: 1.5; }
.pw-label { display: block; margin: 14px 0 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.pw-label small { font-weight: 400; color: var(--text-3); }
.pw-field { position: relative; display: flex; align-items: center; gap: 0; margin-bottom: 10px; }
.pw-field input { padding-right: 46px; }
.pw-field:has(.pw-icon-btn) input { padding-right: 86px; }
.pw-eye, .pw-icon-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; color: var(--text-3); font-size: 11px; }
.pw-icon-btn { right: 42px; }
.pw-eye:hover, .pw-icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.pw-eye svg, .pw-icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#project-pw-field { margin-top: 10px; margin-bottom: 4px; }
.pw-hint { margin: 0 0 10px; font-size: 12px; color: var(--text-3); line-height: 1.45; }
.pw-meter { height: 5px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin: 2px 0 4px; }
.pw-meter i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--bad); transition: width 0.25s var(--ease), background-color 0.25s; }
.pw-meter.warn i { background: var(--warn); }
.pw-meter.good i { background: var(--ok); }
.pw-meter-label { min-height: 16px; font-size: 12px; color: var(--text-3); }
.pw-msg { min-height: 20px; margin: 4px 0 8px; font-size: 13px; color: var(--bad); }
.pw-msg.ok { color: var(--ok); }
.pw-caps { margin: -2px 0 6px; font-size: 12px; color: var(--warn); }
.pw-fine { margin: 14px 0 0 !important; font-size: 12px; color: var(--text-3) !important; text-align: center; }
.pw-cancel { width: 100%; margin-top: 8px; }
.pw-remove { width: 100%; margin-top: 10px; }
.pw-card form .primary:disabled { opacity: 0.6; cursor: not-allowed; filter: none; box-shadow: none; }
.pw-shake { animation: pw-shake 0.36s var(--ease); }
@keyframes pw-shake { 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
.pw-btn { display: inline-flex; align-items: center; gap: 7px; }
.pw-btn svg { width: 16px; height: 16px; }
.pw-btn.on { color: var(--ok); border-color: rgba(63, 220, 154, 0.4); }
.pw-badge { display: inline-grid; place-items: center; color: var(--text-3); }
.pw-badge svg { width: 15px; height: 15px; }
.project-card { position: relative; }
.project-card > .pw-badge { position: absolute; top: 16px; right: 16px; width: 30px; height: 30px; border-radius: 9px; background: var(--surface-2); }
.project-card.pw-locked > .pw-badge { color: var(--warn); }
.project-card.pw-protected:not(.pw-locked) > .pw-badge { color: var(--ok); }
.sidebar nav .file-item > .pw-badge { margin-left: auto; }
.sidebar nav .file-item.pw-locked > .pw-badge { color: var(--warn); }
@media (prefers-reduced-motion: reduce) { .pw-shake { animation: none; } }

/* ---- Start the whole project (assets/app-runner.js) ---- */
.app-run-btn { display: inline-flex; align-items: center; gap: 7px; }
.app-run-btn svg { width: 14px; height: 14px; fill: currentColor; stroke: none; }
.app-run-btn .ar-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 0 currentColor; animation: ar-pulse 1.4s ease-out infinite; }
.app-run-btn.s-running { color: var(--ok); border-color: rgba(63, 220, 154, 0.45); }
.app-run-btn.s-running .ar-dot { background: var(--ok); animation: none; }
.app-run-btn.s-failed { color: var(--bad); border-color: rgba(255, 111, 135, 0.45); }
@keyframes ar-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 183, 87, 0.55); } 100% { box-shadow: 0 0 0 8px rgba(255, 183, 87, 0); } }
.ar-overlay { position: fixed; inset: 0; z-index: 380; display: grid; place-items: center; padding: 3vh 3vw; background: var(--backdrop); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: fade-in 0.18s ease-out; }
.ar-win { width: min(1500px, 100%); height: 100%; max-height: 94vh; display: flex; flex-direction: column; background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-pop); overflow: hidden; }
.ar-head { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex: none; }
.ar-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ar-title b { font-family: var(--font-display); font-size: 1.1rem; }
.ar-title span { color: var(--text-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ar-chip { padding: 4px 11px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); }
.ar-chip.s-running { background: rgba(63, 220, 154, 0.14); color: var(--ok); }
.ar-chip.s-installing, .ar-chip.s-starting { background: rgba(255, 183, 87, 0.14); color: var(--warn); }
.ar-chip.s-failed { background: rgba(255, 111, 135, 0.14); color: var(--bad); }
.ar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.ar-actions button { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 14px; }
.ar-actions button svg { width: 14px; height: 14px; fill: currentColor; stroke: currentColor; stroke-width: 0; }
.ar-actions #ar-start svg { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ar-actions #ar-start:has(path[d^="M7 4.5"]) svg { fill: currentColor; stroke-width: 0; }
.ar-actions button:disabled { opacity: 0.5; cursor: not-allowed; }
.ar-x { width: 36px; padding: 0 !important; justify-content: center; font-size: 20px; color: var(--text-2); border-radius: 10px; }
.ar-x:hover { background: var(--surface-2); color: var(--text); }
.ar-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 330px minmax(0, 1fr); }
.ar-side { overflow-y: auto; padding: 14px 16px 20px; border-right: 1px solid var(--line); background: var(--bg-raised); font-size: 13px; }
.ar-side h4 { margin: 14px 0 6px; font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); }
.ar-side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ar-side li { display: flex; align-items: flex-start; gap: 8px; color: var(--text-2); line-height: 1.4; }
.ar-side li i { font-style: normal; width: 14px; text-align: center; color: var(--accent); flex: none; }
.ar-side li.skip { color: var(--text-3); } .ar-side li.skip i { color: var(--ok); }
.ar-svcs li { flex-wrap: wrap; } .ar-svcs label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; flex: 1 1 100%; }
.ar-svcs label span { display: grid; min-width: 0; } .ar-svcs small { color: var(--text-3); font-family: var(--font-mono); font-size: 11px; word-break: break-all; }
.ar-svcs input[type=checkbox], .ar-opts input[type=checkbox] { margin-top: 2px; }
.ar-tag { font-style: normal; margin-left: 22px; font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.ar-tag.s-running { color: var(--ok); } .ar-tag.s-failed { color: var(--bad); } .ar-tag.s-installing, .ar-tag.s-starting { color: var(--warn); }
.ar-small { color: var(--text-3); font-size: 12px; line-height: 1.5; margin: 4px 0; }
.ar-side code { font-family: var(--font-mono); font-size: 11.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; word-break: break-all; }
.ar-warn { color: var(--warn); font-size: 12.5px; line-height: 1.45; margin: 8px 0; } .ar-err { color: var(--bad); }
.ar-muted { color: var(--text-3); }
.ar-side details { margin-top: 12px; } .ar-side summary { cursor: pointer; color: var(--text-2); font-weight: 600; font-size: 12.5px; }
.ar-opts label { display: flex; gap: 8px; align-items: center; margin-top: 7px; color: var(--text-2); cursor: pointer; }
.ar-notes ul { margin-top: 6px; padding-left: 16px; list-style: disc; display: grid; gap: 5px; color: var(--text-3); font-size: 12px; }
.ar-notes li { display: list-item; }
.ar-mount { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.ar-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.ar-tabs { display: flex; align-items: center; gap: 4px; padding: 8px 12px 0; border-bottom: 1px solid var(--line); flex: none; }
.ar-tabs button { padding: 8px 14px; border-radius: 9px 9px 0 0; color: var(--text-3); font-weight: 600; font-size: 13px; border-bottom: 2px solid transparent; }
.ar-tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.ar-sp { flex: 1; } .ar-tabs select { width: auto; min-height: 30px; padding: 0 30px 0 10px; font-size: 12.5px; }
.ar-pane { display: none; flex: 1; min-height: 0; flex-direction: column; } .ar-pane.on { display: flex; }
.ar-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; flex: none; }
.ar-bar input[readonly] { flex: 1; min-height: 32px; padding: 0 12px; font-family: var(--font-mono); font-size: 12px; }
.ar-bar button { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; color: var(--text-2); } .ar-bar button:hover:not(:disabled) { background: var(--surface-2); color: var(--text); } .ar-bar button:disabled { opacity: 0.4; }
.ar-bar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ar-auto { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); white-space: nowrap; cursor: pointer; } .ar-auto input { width: 15px; height: 15px; min-height: 0; }
.ar-frame { position: relative; flex: 1; min-height: 0; margin: 0 12px 12px; border-radius: 12px; overflow: hidden; background: #fff; border: 1px solid var(--line); }
.ar-frame iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.ar-empty { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 6px; background: var(--editor); color: var(--text-2); line-height: 1.5; } .ar-empty small { color: var(--text-3); }
.ar-log { flex: 1; min-height: 0; margin: 12px 12px 8px; padding: 12px 14px; overflow: auto; border-radius: 12px; background: var(--editor); border: 1px solid var(--line); color: var(--text); font: 12.5px/1.55 var(--font-mono); white-space: pre-wrap; word-break: break-word; }
.ar-logbar { display: flex; gap: 8px; padding: 0 12px 12px; flex: none; } .ar-logbar button { min-height: 30px; padding: 0 12px; font-size: 12px; }
@media (max-width: 900px) { .ar-body { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); } .ar-side { max-height: 32vh; border-right: 0; border-bottom: 1px solid var(--line); } .ar-title span { display: none; } }

.auth-card .switch.forgot { margin-top: 10px; text-align: center; }
.auth-card #forgot-result { margin-top: 16px; line-height: 1.5; }
.auth-card #forgot-result a { color: var(--accent, #7c5cff); font-weight: 600; }

/* Welcome video after registration */

/* Watch-video-again button in the header */
.replay-video-btn{display:inline-flex;align-items:center;gap:6px;font:inherit;font-size:13px;cursor:pointer;padding:6px 12px;border-radius:999px;border:1px solid var(--line,rgba(255,255,255,.18));background:transparent;color:inherit}
.replay-video-btn svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.8}
.replay-video-btn:hover{background:rgba(127,127,160,.16)}
@media (max-width:700px){.replay-video-btn span{display:none}.replay-video-btn{padding:6px}}

/* RTL (Arabic) mode: code, diffs and program output always stay left-to-right */
html[dir="rtl"] #code-editor,
html[dir="rtl"] .monaco-editor,
html[dir="rtl"] .monaco-editor textarea,
html[dir="rtl"] .monaco-editor input,
html[dir="rtl"] #run-output,
html[dir="rtl"] .term-body,
html[dir="rtl"] .term-line,
html[dir="rtl"] .term-out,
html[dir="rtl"] .term-input,
html[dir="rtl"] .term-prompt,
html[dir="rtl"] .xterm,
html[dir="rtl"] pre,
html[dir="rtl"] code {
  direction: ltr;
  text-align: left;
}

/* ---- Loading skeletons ---- */
.sk { display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: sk-shimmer 1.4s infinite; }
@keyframes sk-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.sk-icon { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.sk-line { flex: 1; min-width: 0; }
.w40 { width: 40%; } .w60 { width: 60%; } .w70 { width: 70%; } .w80 { width: 80%; } .w90 { width: 90%; }
.skeleton-card { pointer-events: none; }
.skeleton-card .sk-line { margin-top: 10px; }
.skeleton-row { pointer-events: none; min-height: 30px; align-items: center; }
.skeleton-row .sk { width: 100%; }

/* ---- Rendering performance: skip off-screen cards/lists ---- */
.project-card { content-visibility: auto; contain-intrinsic-size: auto 170px; }
.activity-row, .friend-row, .request-row { content-visibility: auto; contain-intrinsic-size: auto 44px; }
.file-item, .tree-folder { content-visibility: auto; contain-intrinsic-size: auto 30px; }

/* ---- RTL (Arabic) polish ---- */
html[dir="rtl"] #notification-count { right: auto; left: -6px; }
html[dir="rtl"] .notifications-btn { margin-left: 0; margin-right: 4px; }
html[dir="rtl"] .sidebar nav .file-item > .pw-badge { margin-left: 0; margin-right: auto; }
html[dir="rtl"] .replay-video-btn { flex-direction: row-reverse; }
html[dir="rtl"] .term-find input { direction: ltr; text-align: left; }

/* ===== Layout fixes: editor toolbar ===================================================
   Desktop: the toolbar had flex:none, so it never wrapped – on a 1440px screen "Run" and
   "+ File" were pushed off-screen and the project title was squeezed to 0px width.
   Phones: ~20 buttons in wrapped rows left only ~100px for the code; now each toolbar is one
   swipeable row and the most important actions (Run, + File) come first. */
@media (min-width: 901px) {
  .editor-head { align-items: flex-start; }
  .editor-head > div:first-child { flex: 0 1 auto; min-width: 160px; max-width: 34%; padding-top: 1px; }
  .editor-head > div:first-child .back { flex: none; }
  .editor-actions { flex: 1 1 0; min-width: 0; flex-wrap: wrap; justify-content: flex-end; row-gap: 8px; }
}
@media (max-width: 760px) {
  .editor-actions, .ide-tools.workspace-tools {
    flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; overscroll-behavior-x: contain;
    scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
            mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
  }
  .editor-actions::-webkit-scrollbar, .ide-tools.workspace-tools::-webkit-scrollbar { display: none; }
  .editor-actions > *, .ide-tools.workspace-tools > * { flex: none; white-space: nowrap; }
  .editor-actions #run-btn { order: -2; }
  .editor-actions #add-file { order: -1; }
}
/* The floating "New project" button (phones) covered the editor's status bar – it is not needed inside a project. */
body:has(#editor-view:not(.hidden)) .new-project { display: none; }
/* v5.79 – Continue with Google / Facebook */
.auth-or { display: flex; align-items: center; gap: 12px; margin: 20px 0 14px; color: var(--text-2); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-social { display: grid; gap: 10px; }
.auth-social-btn { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; text-decoration: none; transition: border-color .15s, background .15s; }
.auth-social-btn:hover { border-color: var(--accent); }
.auth-social-btn svg { width: 20px; height: 20px; flex: none; }
.auth-social-note { margin: 16px 0 0 !important; font-size: 12px; text-align: center; }
