:root {
  --bg: #07050f;
  --bg2: #0b0718;
  --surface: rgba(18, 11, 36, 0.78);
  --surface-strong: #1a1132;
  --surface-soft: rgba(255, 255, 255, 0.045);
  --panel-bg: rgba(18, 11, 36, 0.82);
  --panel-bg-soft: rgba(167, 139, 250, 0.075);
  --panel-elevated: #1a1132;
  --chip-bg: rgba(255, 255, 255, 0.045);
  --border: rgba(147, 112, 219, 0.22);
  --border-strong: rgba(167, 139, 250, 0.46);
  --accent: #a78bfa;
  --accent-2: #9370db;
  --accent-3: #22d3ee;
  --text: #f7f3ff;
  --text-dim: #d4c4ea;
  --danger: #ff6b6b;
  --success: #37c871;
  --warning: #ffb648;
  --gap: 16px;
  --cols: 4;
  --tile-min: 150px;
  --fav-size: 46px;
  --fav-font: 15px;
  --tile-font: 13px;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.36);
  --shadow-soft: 0 16px 36px rgba(0, 0, 0, 0.24);
  --shadow-card: 0 24px 64px rgba(0, 0, 0, 0.34);
  --ambient-1: rgba(147, 112, 219, 0.18);
  --ambient-2: rgba(34, 211, 238, 0.075);
  --grid-line: rgba(184, 160, 216, 0.04);
  --grid-opacity: 0.18;
  --field-bg: rgba(255, 255, 255, 0.06);
  --field-bg-hover: rgba(255, 255, 255, 0.075);
  --field-bg-focus: rgba(255, 255, 255, 0.068);
  --field-border: rgba(167, 139, 250, 0.32);
  --field-border-hover: rgba(167, 139, 250, 0.44);
  --field-border-focus: rgba(34, 211, 238, 0.72);
  --field-placeholder: #b8a0d8;
  --field-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 10px 26px rgba(0, 0, 0, 0.08);
  --field-shadow-focus: 0 0 0 3px rgba(34, 211, 238, 0.14), 0 12px 28px rgba(0, 0, 0, 0.16);
  --field-error-bg: rgba(255, 107, 107, 0.06);
  --field-error-border: rgba(255, 120, 120, 0.78);
  --field-error-ring: rgba(255, 120, 120, 0.14);
  --control-bg: rgba(255, 255, 255, 0.045);
  --control-hover: rgba(167, 139, 250, 0.13);
  --control-active: rgba(147, 112, 219, 0.18);
  --control-border: var(--border);
  --control-shadow: none;
  --card-bg: linear-gradient(180deg, rgba(18, 11, 36, 0.82), rgba(26, 17, 50, 0.58));
  --card-hover: linear-gradient(180deg, rgba(26, 17, 50, 0.88), rgba(43, 28, 75, 0.62));
  --card-border: var(--border);
  --favorite-chip-bg: rgba(167, 139, 250, 0.1);
  --favorite-chip-hover-bg: rgba(167, 139, 250, 0.16);
  --favorite-chip-border: rgba(167, 139, 250, 0.26);
  --favorite-chip-hover-border: rgba(34, 211, 238, 0.34);
  --favorite-chip-icon-bg: rgba(167, 139, 250, 0.18);
  --favorite-chip-icon-color: #f0eaf8;
  --favicon-bg: linear-gradient(135deg, rgba(167, 139, 250, 0.22), rgba(34, 211, 238, 0.1));
  --favicon-color: var(--text);
  --drawer-head-bg: linear-gradient(180deg, rgba(26, 17, 50, 0.96), rgba(18, 11, 36, 0.86));
  --drawer-section-alt-bg: rgba(167, 139, 250, 0.055);
  --drawer-shadow: -18px 0 42px rgba(0, 0, 0, 0.34);
  --overlay-bg: rgba(7, 5, 15, 0.62);
  --logo-bg:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.16), transparent 36%),
    linear-gradient(135deg, rgba(26, 17, 50, 0.96), rgba(7, 5, 15, 0.98));
  --logo-border: rgba(167, 139, 250, 0.36);
  --logo-folder-bg:
    radial-gradient(circle at 34% 22%, rgba(255, 255, 255, 0.34), transparent 36%),
    linear-gradient(135deg, rgba(167, 139, 250, 0.94), rgba(34, 211, 238, 0.72));
  --logo-folder-back-bg: linear-gradient(135deg, rgba(147, 112, 219, 0.38), rgba(34, 211, 238, 0.18));
  --logo-folder-border: rgba(240, 234, 248, 0.58);
  --logo-folder-line: rgba(11, 7, 24, 0.74);
  --logo-shadow: 0 10px 24px rgba(0, 0, 0, 0.3), 0 0 20px rgba(167, 139, 250, 0.18);
}

body[data-theme='dark'] {
  --logo-bg:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.16), transparent 36%),
    linear-gradient(135deg, rgba(19, 30, 44, 0.96), rgba(10, 17, 27, 0.98));
  --logo-border: rgba(125, 247, 212, 0.28);
  --logo-folder-bg:
    radial-gradient(circle at 34% 22%, rgba(255, 255, 255, 0.32), transparent 36%),
    linear-gradient(135deg, rgba(126, 247, 216, 0.92), rgba(67, 169, 255, 0.84));
  --logo-folder-back-bg: linear-gradient(135deg, rgba(89, 166, 255, 0.34), rgba(123, 240, 200, 0.22));
  --logo-folder-border: rgba(207, 255, 246, 0.58);
  --logo-folder-line: rgba(7, 24, 35, 0.7);
  --logo-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 8px 18px rgba(12, 18, 29, 0.16);
}

body[data-theme='light'] {
  --logo-bg:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.16), transparent 36%),
    linear-gradient(135deg, rgba(19, 30, 44, 0.96), rgba(10, 17, 27, 0.98));
  --logo-border: rgba(125, 247, 212, 0.28);
  --logo-folder-bg:
    radial-gradient(circle at 34% 22%, rgba(255, 255, 255, 0.7), transparent 38%),
    linear-gradient(135deg, #a9fff0, #62b8ff);
  --logo-folder-back-bg: linear-gradient(135deg, rgba(74, 125, 255, 0.22), rgba(89, 214, 194, 0.22));
  --logo-folder-border: rgba(52, 127, 165, 0.48);
  --logo-folder-line: rgba(14, 49, 71, 0.7);
  --logo-shadow: 0 7px 16px rgba(77, 112, 158, 0.18), 0 0 16px rgba(88, 204, 218, 0.12);
}

body[data-theme='amethyst'] {
  --logo-bg:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.16), transparent 36%),
    linear-gradient(135deg, rgba(26, 17, 50, 0.96), rgba(7, 5, 15, 0.98));
  --logo-border: rgba(167, 139, 250, 0.36);
  --logo-folder-bg:
    radial-gradient(circle at 34% 22%, rgba(255, 255, 255, 0.34), transparent 36%),
    linear-gradient(135deg, rgba(167, 139, 250, 0.94), rgba(34, 211, 238, 0.72));
  --logo-folder-back-bg: linear-gradient(135deg, rgba(147, 112, 219, 0.38), rgba(34, 211, 238, 0.18));
  --logo-folder-border: rgba(240, 234, 248, 0.58);
  --logo-folder-line: rgba(11, 7, 24, 0.74);
  --logo-shadow: inset 0 1px 0 rgba(247, 243, 255, 0.14), 0 8px 18px rgba(7, 5, 15, 0.22), 0 0 18px rgba(167, 139, 250, 0.16);
}

body[data-theme='dracula'] {
  --logo-bg:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.16), transparent 36%),
    linear-gradient(135deg, rgba(19, 30, 44, 0.96), rgba(10, 17, 27, 0.98));
  --logo-border: rgba(125, 247, 212, 0.28);
  --logo-folder-bg:
    radial-gradient(circle at 34% 22%, rgba(255, 255, 255, 0.32), transparent 36%),
    linear-gradient(135deg, rgba(126, 247, 216, 0.88), rgba(127, 155, 255, 0.82));
  --logo-folder-back-bg: linear-gradient(135deg, rgba(127, 155, 255, 0.32), rgba(255, 121, 198, 0.16));
  --logo-folder-border: rgba(207, 255, 246, 0.54);
  --logo-folder-line: rgba(21, 18, 32, 0.66);
  --logo-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.13), 0 8px 18px rgba(7, 5, 14, 0.22);
}

body[data-theme='cocoa'] {
  --logo-bg:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.16), transparent 36%),
    linear-gradient(135deg, rgba(19, 30, 44, 0.96), rgba(10, 17, 27, 0.98));
  --logo-border: rgba(125, 247, 212, 0.28);
  --logo-folder-bg:
    radial-gradient(circle at 34% 22%, rgba(255, 255, 255, 0.28), transparent 36%),
    linear-gradient(135deg, rgba(126, 247, 216, 0.88), rgba(86, 176, 255, 0.78));
  --logo-folder-back-bg: linear-gradient(135deg, rgba(255, 182, 72, 0.18), rgba(123, 240, 200, 0.22));
  --logo-folder-border: rgba(224, 255, 236, 0.5);
  --logo-folder-line: rgba(42, 23, 10, 0.66);
  --logo-shadow: inset 0 1px 0 rgba(255, 238, 210, 0.14), 0 8px 18px rgba(8, 5, 3, 0.22);
}

body[data-theme='rose'] {
  --logo-bg:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.16), transparent 36%),
    linear-gradient(135deg, rgba(19, 30, 44, 0.96), rgba(10, 17, 27, 0.98));
  --logo-border: rgba(125, 247, 212, 0.28);
  --logo-folder-bg:
    radial-gradient(circle at 34% 22%, rgba(255, 255, 255, 0.3), transparent 36%),
    linear-gradient(135deg, rgba(126, 247, 216, 0.88), rgba(101, 186, 255, 0.8));
  --logo-folder-back-bg: linear-gradient(135deg, rgba(255, 140, 194, 0.18), rgba(123, 240, 200, 0.22));
  --logo-folder-border: rgba(224, 255, 247, 0.52);
  --logo-folder-line: rgba(38, 19, 34, 0.66);
  --logo-shadow: inset 0 1px 0 rgba(255, 240, 247, 0.14), 0 8px 18px rgba(10, 5, 10, 0.22);
}

body[data-theme='forest'] {
  --logo-bg:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.16), transparent 36%),
    linear-gradient(135deg, rgba(19, 30, 44, 0.96), rgba(10, 17, 27, 0.98));
  --logo-border: rgba(125, 247, 212, 0.28);
  --logo-folder-bg:
    radial-gradient(circle at 34% 22%, rgba(255, 255, 255, 0.3), transparent 36%),
    linear-gradient(135deg, rgba(126, 247, 216, 0.92), rgba(69, 181, 231, 0.78));
  --logo-folder-back-bg: linear-gradient(135deg, rgba(61, 214, 132, 0.26), rgba(123, 240, 200, 0.2));
  --logo-folder-border: rgba(207, 255, 229, 0.56);
  --logo-folder-line: rgba(7, 33, 19, 0.68);
  --logo-shadow: inset 0 1px 0 rgba(236, 255, 242, 0.13), 0 8px 18px rgba(3, 8, 5, 0.22);
}

body[data-theme='ocean'] {
  --logo-bg:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.16), transparent 36%),
    linear-gradient(135deg, rgba(19, 30, 44, 0.96), rgba(10, 17, 27, 0.98));
  --logo-border: rgba(125, 247, 212, 0.28);
  --logo-folder-bg:
    radial-gradient(circle at 34% 22%, rgba(255, 255, 255, 0.3), transparent 36%),
    linear-gradient(135deg, rgba(126, 247, 216, 0.92), rgba(76, 186, 255, 0.84));
  --logo-folder-back-bg: linear-gradient(135deg, rgba(76, 186, 255, 0.3), rgba(123, 240, 200, 0.2));
  --logo-folder-border: rgba(207, 255, 246, 0.56);
  --logo-folder-line: rgba(5, 31, 45, 0.68);
  --logo-shadow: inset 0 1px 0 rgba(232, 250, 255, 0.13), 0 8px 18px rgba(2, 8, 14, 0.22);
}

body[data-theme='sand'] {
  --logo-bg:
    radial-gradient(circle at 28% 20%, rgba(255, 255, 255, 0.16), transparent 36%),
    linear-gradient(135deg, rgba(19, 30, 44, 0.96), rgba(10, 17, 27, 0.98));
  --logo-border: rgba(125, 247, 212, 0.28);
  --logo-folder-bg:
    radial-gradient(circle at 34% 22%, rgba(255, 255, 255, 0.64), transparent 38%),
    linear-gradient(135deg, #aaf8e6, #68b9f4);
  --logo-folder-back-bg: linear-gradient(135deg, rgba(74, 125, 255, 0.18), rgba(205, 174, 92, 0.18));
  --logo-folder-border: rgba(68, 128, 150, 0.44);
  --logo-folder-line: rgba(59, 44, 22, 0.64);
  --logo-shadow: 0 7px 16px rgba(124, 96, 61, 0.16), 0 0 16px rgba(83, 190, 204, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html {
  width: 100%;
  max-width: 100%;
  background: var(--bg);
  scrollbar-width: thin;
  scrollbar-color: rgba(144, 168, 206, 0.22) transparent;
  overflow-x: hidden;
}

body {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  color-scheme: dark;
  color: var(--text);
  background:
    radial-gradient(circle at top left, var(--ambient-1), transparent 24%),
    radial-gradient(circle at top right, var(--ambient-2), transparent 20%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  transition: background 0.25s ease, color 0.25s ease;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 12px;
  z-index: 9999;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--accent, #59a6ff);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  transition: top 160ms ease-out;
}

.skip-link:focus-visible {
  top: 12px;
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at center, black 38%, transparent 88%);
  pointer-events: none;
  opacity: var(--grid-opacity);
}

body.light {
  color-scheme: light;
  background:
    radial-gradient(circle at top left, var(--ambient-1), transparent 28%),
    radial-gradient(circle at top right, var(--ambient-2), transparent 22%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg2) 55%, var(--surface) 100%);
}

body.light::before {
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: none;
  opacity: var(--grid-opacity);
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

.landing-page {
  width: 100%;
  max-width: 100%;
  display: grid;
  place-items: center;
  padding-inline: 14px;
}

.landing-page::before {
  opacity: 0.15;
}

.landing-shell {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  max-width: 1120px;
  margin-inline: auto;
  padding: clamp(20px, 4vw, 32px) 0 clamp(40px, 6vw, 56px);
  display: grid;
  gap: clamp(18px, 2.4vw, 28px);
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: clamp(24px, 3vw, 48px);
  min-height: min(82vh, 760px);
  padding: clamp(32px, 3.6vw, 52px) clamp(28px, 3.2vw, 48px);
  border-radius: 34px;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at top left, rgba(123, 240, 200, 0.12), transparent 30%),
    linear-gradient(135deg, rgba(89, 166, 255, 0.16), rgba(142, 124, 255, 0.08)),
    var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.landing-copy {
  min-width: 0;
  max-width: 560px;
}

.landing-eyebrow,
.eyebrow {
  margin-bottom: 10px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.landing-hero h1 {
  max-width: 14ch;
  font-size: clamp(36px, 5.6vw, 66px);
  line-height: 1.1;
  letter-spacing: -0.036em;
  font-weight: 800;
  text-wrap: balance;
}

.landing-text,
.hero-text {
  margin-top: 16px;
  max-width: 56ch;
  color: var(--text-dim);
  font-size: clamp(15px, 1.3vw, 16px);
  line-height: 1.72;
}

.landing-status {
  margin-top: 18px;
  display: inline-flex;
  align-items: center;
  max-width: 34ch;
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--field-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.45;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.landing-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(135deg, #59a6ff, #7bf0c8);
  color: #071520;
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.01em;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease, opacity 0.2s ease;
  box-shadow:
    0 12px 32px rgba(89, 166, 255, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.landing-btn:hover {
  transform: translateY(-3px);
  box-shadow:
    0 20px 44px rgba(89, 166, 255, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  filter: brightness(1.05);
}

.landing-btn:active {
  transform: translateY(-1px);
  filter: brightness(0.97);
}

.landing-btn:focus-visible {
  outline: 2px solid rgba(123, 240, 200, 0.8);
  outline-offset: 4px;
}

.landing-visual {
  position: relative;
  min-width: 0;
  width: 100%;
  min-height: 380px;
  display: grid;
  place-items: center;
  overflow: hidden;
  contain: layout paint;
}

.landing-mark {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 520px);
  max-width: 520px;
  padding: clamp(18px, 3vw, 30px);
  border-radius: 32px;
  border: 1px solid rgba(220, 231, 248, 0.18);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.96), rgba(240, 246, 255, 0.92)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(221, 232, 248, 0.76));
  box-shadow:
    0 26px 54px rgba(7, 12, 20, 0.24),
    0 18px 40px rgba(89, 166, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

.landing-orbit {
  position: absolute;
  inset: auto;
  max-width: 100%;
  max-height: 100%;
  border-radius: 999px;
  border: 1px solid rgba(144, 168, 206, 0.22);
}

.landing-orbit-a {
  inset: 12% 8%;
  animation: spin 18s linear infinite;
}

.landing-orbit-b {
  inset: 4% 16%;
  animation: spin 26s linear infinite reverse;
}

.landing-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 24px);
  padding: clamp(18px, 2.6vw, 28px) clamp(22px, 2.8vw, 32px);
  border-radius: 30px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.landing-value {
  min-width: 0;
  padding-right: clamp(2px, 1vw, 10px);
}

.landing-value h2 {
  max-width: 16ch;
  font-size: clamp(20px, 2vw, 24px);
  line-height: 1.18;
  letter-spacing: -0.03em;
}

.landing-value p {
  margin-top: 12px;
  max-width: 34ch;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.68;
}

.landing-positioning {
  padding: 0 clamp(8px, 1.2vw, 12px);
}

.landing-positioning p {
  max-width: 62ch;
  color: var(--text);
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.5;
  letter-spacing: -0.024em;
}

.landing-lead {
  margin-top: 14px;
  max-width: 62ch;
  color: var(--text);
  font-size: 15px;
  line-height: 1.75;
}

.landing-panel {
  padding: clamp(22px, 2.8vw, 32px);
  border-radius: 30px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02)),
    var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.landing-section-head {
  max-width: 58ch;
  margin-bottom: 18px;
}

.landing-kicker {
  margin-bottom: 10px;
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.landing-section-head h2 {
  font-size: clamp(24px, 3.2vw, 34px);
  line-height: 1.12;
  letter-spacing: -0.038em;
}

.landing-section-head p {
  margin-top: 10px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.7;
}

.landing-feature-grid,
.landing-steps,
.landing-local-grid,
.landing-split-grid,
.landing-usecases,
.landing-faq-grid {
  display: grid;
  gap: 14px;
}

.landing-feature-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.landing-feature-card,
.landing-step,
.landing-split-card,
.landing-usecase,
.landing-cta-panel {
  position: relative;
  overflow: hidden;
  padding: 18px 18px 16px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02)),
    rgba(10, 16, 25, 0.34);
}

.landing-feature-card h3,
.landing-step h3,
.landing-split-card h3,
.landing-usecase h3,
.landing-cta-panel h2 {
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.landing-feature-card p,
.landing-step p,
.landing-split-card p,
.landing-usecase p,
.landing-cta-text {
  margin-top: 10px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.68;
}

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

.landing-step {
  display: grid;
  gap: 10px;
}

.landing-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(89, 166, 255, 0.14);
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.landing-panel-split {
  display: grid;
  gap: 18px;
}

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

.landing-local-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.landing-usecases {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.landing-faq-item {
  padding: 18px 18px 16px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02)),
    rgba(10, 16, 25, 0.34);
}

.landing-faq-item h3 {
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.landing-faq-item p {
  margin-top: 10px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.68;
}

.landing-cta-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.landing-cta-panel .landing-actions {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin-top: 0;
}

.landing-btn-secondary {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  box-shadow: none;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.landing-btn-secondary:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.07);
}

.landing-feedback {
  width: 100%;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02)),
    rgba(10, 16, 25, 0.34);
}

.landing-feedback-text {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.68;
}

.landing-email {
  display: inline-flex;
  margin-top: 12px;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
  word-break: break-word;
}

.landing-email:hover {
  color: var(--accent-2);
}

.landing-email:focus-visible {
  outline: 2px solid rgba(123, 240, 200, 0.8);
  outline-offset: 4px;
}

.landing-trust-content {
  display: grid;
  gap: 16px;
  max-width: 72ch;
}

.landing-trust-content p {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.7;
  margin: 0;
}

.landing-trust-content strong {
  color: var(--text);
  font-weight: 700;
}

.landing-footer {
  width: min(1240px, calc(100% - 28px));
  margin: 18px auto 42px;
  padding: 0 4px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.7;
}

.landing-footer-line {
  margin: 0;
}

.landing-footer-email {
  display: inline-flex;
  margin-top: 4px;
  color: var(--text-dim);
  text-decoration: none;
}

.landing-footer-email:hover {
  color: var(--text);
}

.landing-footer-email:focus-visible {
  outline: 2px solid rgba(123, 240, 200, 0.8);
  outline-offset: 4px;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 48px;
}



.workspace-card {
  position: relative;
  overflow: hidden;
  padding: 20px 22px 22px;
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015)),
    var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.workspace-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 120px;
  background: linear-gradient(180deg, rgba(89, 166, 255, 0.08), transparent 78%);
  pointer-events: none;
}

.runtime-loading {
  position: relative;
  z-index: 1;
  display: none;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  min-height: 42px;
  margin-top: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.runtime-loading::before {
  content: '';
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(89, 166, 255, 0.12);
}

.runtime-loading[hidden] {
  display: none;
}

body.runtime-hydrating .runtime-loading:not([hidden]) {
  display: inline-flex;
}

body.runtime-hydrating .app-header-actions,
body.runtime-hydrating #topbar,
body.runtime-hydrating #trust-bar,
body.runtime-hydrating #favorites-panel,
body.runtime-hydrating .tabs-frame,
body.runtime-hydrating .workspace-head,
body.runtime-hydrating #clock,
body.runtime-hydrating .grid-wrap {
  display: none;
}

.runtime-recovery-state {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 14px;
  border: 1px solid rgba(255, 193, 111, 0.38);
  border-radius: 16px;
  background: rgba(255, 193, 111, 0.1);
  color: var(--text);
  max-width: 760px;
}

.runtime-recovery-state[hidden] {
  display: none;
}

.runtime-recovery-state strong {
  font-size: 14px;
}

.runtime-recovery-state p {
  margin: 0;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.45;
}

.app-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.runtime-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 0 1 auto;
  color: var(--text);
  text-decoration: none;
}

.runtime-brand:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 72%, transparent);
  outline-offset: 4px;
  border-radius: 14px;
}

.tabsly-logo {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 40px;
  min-width: 48px;
  flex: 0 0 auto;
  overflow: visible;
  transition: transform 180ms ease-out, filter 180ms ease-out;
}

.runtime-brand:hover .tabsly-logo {
  transform: translateY(-1px) scale(1.03);
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 18%, transparent));
}

.runtime-brand:focus-visible .tabsly-logo {
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 34%, transparent));
}

@media (prefers-reduced-motion: reduce) {
  .tabsly-logo {
    transition: none;
  }
  .runtime-brand:hover .tabsly-logo {
    transform: none;
  }
  .skip-link {
    transition: none;
  }
}

.tabsly-logo__folder {
  position: absolute;
  display: block;
  border: 2px solid var(--logo-folder-border);
  border-radius: 8px;
  box-shadow: var(--logo-shadow);
  box-sizing: border-box;
}

.tabsly-logo__folder::before {
  content: '';
  position: absolute;
  left: 5px;
  top: -8px;
  width: 18px;
  height: 10px;
  border: 2px solid var(--logo-folder-border);
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  background: inherit;
  box-sizing: border-box;
}

.tabsly-logo__folder--back {
  top: 6px;
  left: 10px;
  z-index: 1;
  width: 34px;
  height: 24px;
  border-color: color-mix(in srgb, var(--logo-folder-border) 68%, transparent);
  background: var(--logo-folder-back-bg);
  opacity: 0.72;
  box-shadow: none;
}

.tabsly-logo__folder--back::before {
  top: -7px;
  left: 5px;
  width: 15px;
  height: 9px;
  border-color: color-mix(in srgb, var(--logo-folder-border) 68%, transparent);
}

.tabsly-logo__folder--front {
  top: 13px;
  left: 2px;
  z-index: 2;
  width: 38px;
  height: 25px;
  background: var(--logo-folder-bg);
}

.tabsly-logo__folder--front::before {
  top: -8px;
  left: 5px;
  width: 18px;
  height: 10px;
}

.tabsly-logo__line {
  position: absolute;
  left: 8px;
  display: block;
  height: 3px;
  border-radius: 999px;
  background: var(--logo-folder-line);
  opacity: 0.72;
}

.tabsly-logo__line:first-child {
  top: 8px;
  width: 21px;
}

.tabsly-logo__line:last-child {
  top: 15px;
  width: 15px;
}

.runtime-brand-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.runtime-brand-name {
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  white-space: nowrap;
  color: var(--text);
}

.runtime-brand-subtitle {
  color: color-mix(in srgb, var(--text-dim) 78%, var(--text) 22%);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.005em;
  white-space: nowrap;
}

.app-brand-copy {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.app-brand-name {
  font-size: clamp(24px, 3.2vw, 30px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.045em;
}

.app-brand-subtitle {
  max-width: 28ch;
  margin: 0;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  opacity: 0.62;
}

.app-header-actions {
  flex-shrink: 0;
  justify-content: flex-end;
}

/* ── Compact status strip ── */
.status-strip {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  padding: 5px 7px;
  border-radius: 12px;
  border: 1px solid rgba(220, 231, 248, 0.045);
  background:
    linear-gradient(135deg, rgba(123, 240, 200, 0.018), rgba(89, 166, 255, 0.012)),
    rgba(9, 15, 24, 0.1);
  box-shadow: none;
  flex-wrap: nowrap;
  max-width: 100%;
  overflow: hidden;
}

.status-strip.hidden {
  display: none;
}

.status-strip.in-drawer {
  margin-top: 12px;
  margin-bottom: 14px;
}

.status-strip-main {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.status-strip-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  flex-wrap: nowrap;
}

.status-strip-summary {
  min-width: 0;
  color: var(--text-dim);
  overflow: hidden;
  font-size: 11px;
  font-weight: 620;
  line-height: 1.35;
  opacity: 0.82;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-strip-secondary {
  display: flex;
  align-items: center;
  gap: 4px 10px;
  min-width: 0;
  overflow: hidden;
  flex-wrap: nowrap;
}

.status-strip-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
  justify-content: flex-end;
  align-items: center;
  padding: 0;
  border-radius: 0;
  border: 0;
  background: transparent;
}

.status-strip-action-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.status-strip-action-buttons {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: nowrap;
}

.status-strip-actions > .status-strip-action-buttons {
  gap: 6px;
}

.status-strip-file-setup {
  flex: 1 1 100%;
  padding-left: 2px;
}

.status-strip-connected-actions {
  margin-left: 2px;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
  max-width: 340px;
}

.status-strip-action-label {
  color: var(--text-dim);
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  opacity: 0.72;
  white-space: nowrap;
}

.status-strip-action-label::after {
  content: ':';
  margin-left: 1px;
}

.status-strip-action-buttons .icon-btn {
  min-height: 28px;
  padding: 5px 8px;
  border-radius: 10px;
  font-size: 10.5px;
  line-height: 1;
}

.status-strip-action-buttons .icon-btn:first-child {
  border-color: rgba(123, 240, 200, 0.16);
  background: rgba(123, 240, 200, 0.038);
}

.strip-stats {
  display: flex;
  align-items: center;
  gap: 10px;
}

.strip-data-item {
  min-width: 0;
  overflow: hidden;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-dim);
  line-height: 1.25;
  opacity: 0.56;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.strip-data-item + .strip-data-item::before {
  content: '·';
  margin-right: 8px;
  color: rgba(157, 172, 204, 0.36);
}

.strip-data-item:empty {
  display: none;
}

/* Keep label/diag styles shared with drawer */
.sync-diag-label,
.group-kicker,
.sync-choice-label {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Legacy selectors kept so old JS-set classes don't break anything */
.trust-item strong {
  font-size: 15px;
  line-height: 1.45;
  font-weight: 800;
}

.trust-item small {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.55;
}

.trust-label {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.trust-state {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 1 auto;
  min-width: 0;
  width: auto;
  max-width: min(100%, 360px);
  overflow: hidden;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trust-state-label {
  flex: 0 0 auto;
}

.trust-state-file-name {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trust-state.ok {
  background: rgba(55, 200, 113, 0.12);
  border-color: rgba(55, 200, 113, 0.3);
  color: #9bf2bd;
}

.trust-state.warn {
  background: rgba(255, 182, 72, 0.12);
  border-color: rgba(255, 182, 72, 0.3);
  color: #ffd18b;
}

.trust-state.off {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.topbar.hidden {
  display: none;
}

.favorites-panel {
  display: block;
  width: 100%;
  max-width: 100%;
  clear: both;
  margin-bottom: 10px;
}

.home-section-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.home-favorites-title {
  display: none;
}

.favorites-strip {
  display: none;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  max-height: calc(var(--fav-rows, 2) * 46px + (var(--fav-rows, 2) - 1) * 10px);
  margin-bottom: 0;
  padding: 4px 2px 0;
}

.favorites-strip.visible {
  display: flex;
}

#favorites-toggle-row {
  margin-top: 8px;
  padding-top: 0;
}

.favorite-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 14px;
  border: 1px solid var(--favorite-chip-border);
  background: var(--favorite-chip-bg);
  text-decoration: none;
  color: var(--text);
  opacity: 0.82;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.favorite-chip:hover {
  transform: translateY(-1px);
  border-color: var(--favorite-chip-hover-border);
  background: var(--favorite-chip-hover-bg);
  opacity: 1;
}

.favorite-chip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 10px;
  background: var(--favorite-chip-icon-bg);
  color: var(--favorite-chip-icon-color);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  flex-shrink: 0;
}

.favorite-chip-icon img {
  width: 60%;
  height: 60%;
  object-fit: contain;
}

.favorite-chip-copy {
  min-width: 0;
}

.favorite-chip-name {
  font-size: 11px;
  font-weight: 800;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.favorite-chip-meta {
  margin-top: 2px;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 700;
  opacity: 0.72;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.favorites-empty-hint {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  opacity: 0.72;
  white-space: nowrap;
}

.favorite-chip.dragging {
  opacity: 0.35;
  cursor: grabbing;
}

.favorite-chip.fav-drag-over {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 12px;
}

.group-favorite-chip {
  max-width: min(220px, 100%);
  padding: 6px 9px;
  border-radius: 13px;
  opacity: 0.78;
}

.group-favorite-chip .favorite-chip-icon {
  width: 24px;
  height: 24px;
  border-radius: 9px;
}

.search-wrap {
  flex: 1;
  display: none;
}

.search-wrap.visible {
  display: grid;
  gap: 8px;
}

.search-control {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.search-input,
.modal input:not([type='checkbox']),
.modal textarea,
.modal select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--field-border);
  border-radius: 16px;
  background: var(--field-bg);
  color: var(--text);
  outline: none;
  box-shadow: var(--field-shadow);
  transition: border-color 0.16s ease, transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.site-edit-modal input:not([type='checkbox']):hover:not(:disabled),
.site-edit-modal textarea:hover:not(:disabled),
.site-edit-modal select:hover:not(:disabled) {
  border-color: var(--field-border-hover);
  background: var(--field-bg-hover);
}

.search-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 15px 18px;
  border-color: var(--field-border);
  border-radius: 18px;
  background: var(--field-bg);
  box-shadow: var(--field-shadow);
}

.search-submit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 16px;
  border: 1px solid var(--field-border);
  border-radius: 18px;
  background: var(--control-bg);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: var(--field-shadow);
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
  flex-shrink: 0;
}

.search-submit-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.search-submit-btn:hover:not(:disabled) {
  border-color: var(--field-border-focus);
  transform: translateY(-1px);
  background: var(--field-bg-focus);
  box-shadow: var(--field-shadow-focus);
}

.search-submit-btn:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--field-shadow);
}

.search-input:focus,
.modal input:not([type='checkbox']):focus,
.modal textarea:focus,
.modal select:focus {
  border-color: var(--field-border-focus);
  transform: translateY(-1px);
  background: var(--field-bg-focus);
  box-shadow: var(--field-shadow-focus);
}

.search-input:focus-visible,
.modal input:not([type='checkbox']):focus-visible,
.modal textarea:focus-visible,
.modal select:focus-visible {
  outline: none;
}

.search-input::placeholder,
.modal input:not([type='checkbox'])::placeholder,
.modal textarea::placeholder {
  color: var(--field-placeholder);
  opacity: 1;
  text-overflow: ellipsis;
}

.search-helper {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.45;
  opacity: 0.66;
  padding-inline: 2px;
}

.modal input:not([type='checkbox']),
.modal textarea,
.modal select {
  margin-top: 10px;
}

.modal textarea {
  min-height: 160px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}

.modal input:not([type='checkbox']):disabled,
.modal textarea:disabled,
.modal select:disabled {
  border-color: rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.035);
  color: color-mix(in srgb, var(--text-dim) 72%, transparent);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.68;
}

.modal-field {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.modal-field > span,
.modal-field > label,
.group-modal-label {
  color: color-mix(in srgb, var(--text) 88%, var(--text-dim));
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.modal .modal-field input,
.modal .modal-field textarea,
.modal .modal-field select {
  margin-top: 0;
}

.site-preview-field {
  gap: 10px;
}

.site-card-preview {
  display: flex;
  justify-content: flex-start;
}

.site-card-preview-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(220px, 100%);
  min-height: 112px;
  padding: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
}

.site-card-preview-tile {
  width: min(220px, 100%);
  --tile-card-height: 150px;
  --tile-caption-height: 48px;
  opacity: 1;
  transform: none;
  pointer-events: none;
}

.site-card-preview-tile:hover {
  transform: none;
  box-shadow: var(--shadow-soft);
}

.site-card-advanced {
  margin-top: 12px;
}

.btn-card-settings {
  width: 100%;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  min-height: 40px;
}

.btn-card-settings.active {
  background: color-mix(in srgb, var(--accent, #3b82f6) 18%, var(--surface));
}

.site-card-advanced-panel {
  margin-top: 8px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 64%, transparent);
  overflow: hidden;
  padding-top: 12px;
}

.site-card-advanced-panel .modal-field {
  margin: 0 14px 12px;
}

.site-edit-modal {
  width: min(720px, calc(100vw - 32px));
  max-width: 720px;
  --field-bg: rgba(255, 255, 255, 0.075);
  --field-bg-hover: rgba(255, 255, 255, 0.088);
  --field-bg-focus: rgba(255, 255, 255, 0.095);
  --field-border: rgba(255, 255, 255, 0.12);
  --field-border-hover: rgba(255, 255, 255, 0.18);
  --field-border-focus: rgba(108, 99, 255, 0.72);
  --field-placeholder: #85858f;
  --field-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 10px 24px rgba(0, 0, 0, 0.08);
  --field-shadow-focus: 0 0 0 3px rgba(108, 99, 255, 0.18), 0 12px 28px rgba(0, 0, 0, 0.16);
}

.site-edit-modal .modal-body {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.026)),
    rgba(8, 13, 22, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.site-edit-modal .modal-body > .modal-field:first-child {
  margin-top: 0;
}

.site-url-field {
  gap: 8px;
}

.site-url-suggestions {
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-strong, #151b27) 92%, transparent);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
}

.site-url-suggestions[hidden] {
  display: none;
}

.site-url-suggestions-title {
  padding: 2px 4px 4px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.site-url-suggestion-item {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 42px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.site-url-suggestion-item:hover,
.site-url-suggestion-item.is-active {
  border-color: color-mix(in srgb, var(--accent, #3b82f6) 34%, transparent);
  background: color-mix(in srgb, var(--accent, #3b82f6) 14%, transparent);
}

.site-url-suggestion-item:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent, #3b82f6) 72%, white);
  outline-offset: 2px;
}

.site-url-suggestion-title {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-url-suggestion-url {
  overflow: hidden;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-url-suggestion-item.is-add-action .site-url-suggestion-title {
  color: color-mix(in srgb, var(--accent, #3b82f6) 78%, var(--text));
}

.site-url-duplicate-status {
  display: block;
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, #ffcf66 34%, transparent);
  background: color-mix(in srgb, #ffcf66 12%, transparent);
  color: color-mix(in srgb, #ffdf8b 88%, var(--text));
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}

.site-url-duplicate-status[hidden] {
  display: none;
}

.note-field textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.4;
}

.note-field textarea:hover {
  border-color: color-mix(in srgb, var(--accent, #3b82f6) 42%, var(--border));
}

.note-helper-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}

.note-counter {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.note-counter.warn {
  color: color-mix(in srgb, #ffcf66 72%, var(--text) 28%);
}

.note-counter.error {
  color: #ff8f8f;
}

.note-error {
  display: none;
  margin-top: 4px;
  color: #ff8f8f;
  font-size: 11px;
  font-weight: 700;
}

.note-error.show {
  display: block;
}

.field-error {
  display: none;
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 107, 107, 0.24);
  background: rgba(255, 107, 107, 0.10);
  color: #ffd7d7;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

.field-error.show {
  display: block;
}

.modal input.error:not([type='checkbox']),
.modal textarea.error,
.modal select.error {
  border-color: var(--field-error-border);
  background: var(--field-error-bg);
  box-shadow: 0 0 0 3px var(--field-error-ring);
}

.modal input.error:not([type='checkbox']):focus,
.modal textarea.error:focus,
.modal select.error:focus {
  border-color: var(--field-error-border);
  background: var(--field-error-bg);
  box-shadow: 0 0 0 3px var(--field-error-ring), 0 12px 28px rgba(0, 0, 0, 0.14);
}

.note-field textarea.error {
  border-color: rgba(255, 120, 120, 0.75);
  box-shadow: 0 0 0 3px rgba(255, 120, 120, 0.16);
}

.tile-color-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.color-preset-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: border-color 0.14s, background 0.14s;
  min-height: 28px;
}

.color-preset-btn:hover {
  border-color: var(--text-dim);
}

.color-preset-btn.selected {
  border-color: var(--preset-color, var(--text-dim));
  background: color-mix(in srgb, var(--preset-color, var(--text-dim)) 18%, transparent);
}

.color-preset-auto.selected {
  border-color: var(--text-dim);
  background: color-mix(in srgb, var(--text-dim) 14%, transparent);
}

.color-preset-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--preset-color, transparent);
  border: 1.5px solid color-mix(in srgb, var(--border) 80%, transparent);
  flex-shrink: 0;
}

.color-preset-auto .color-preset-dot {
  background: conic-gradient(#3b82f6 0deg 120deg, #10b981 120deg 240deg, #f97316 240deg 360deg);
  border: none;
}

.color-preset-label {
  white-space: nowrap;
}

.paste-json-error {
  margin-top: 8px;
  font-size: 13px;
  color: var(--danger-text, #ffd7d7);
}

.modal option {
  background: var(--surface-strong);
  color: var(--text);
}

.toolbar-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-btn,
.step-btn,
.btn,
.tab,
.tab-add-btn,
.toggle,
.menu-item {
  -webkit-tap-highlight-color: transparent;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--control-border);
  border-radius: 14px;
  background: var(--control-bg);
  color: var(--text);
  box-shadow: var(--control-shadow);
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.icon-btn:disabled,
.btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.icon-btn:hover,
.step-btn:hover,
.tab:hover,
.tab-add-btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: var(--control-hover);
}

.icon-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  border-color: transparent;
  color: #fff;
}

.icon-btn-soft {
  background: var(--control-bg);
}

.icon-btn.danger {
  color: var(--danger);
}

.tabs-frame {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 10px 8px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  background: rgba(255, 255, 255, 0.022);
}

.home-view {
  display: none;
  margin-bottom: 14px;
}

.home-groups-grid {
  display: grid;
  grid-template-columns: repeat(var(--group-card-cols, 4), minmax(0, 1fr));
  grid-auto-rows: 1fr;
  align-items: stretch;
  gap: var(--group-card-gap, var(--gap, 12px));
  width: 100%;
  max-width: 100%;
}

body[data-group-card-density="compact"] {
  --group-card-gap: 9px;
  --group-card-padding: 9px;
  --group-card-min-height: 112px;
  --group-card-radius: 14px;
  --group-card-inner-gap: 8px;
  --group-card-name-font: 13px;
  --group-card-count-font: 10px;
  --group-card-favicon-size: 36px;
  --group-card-shelf-pad: 5px;
  --group-card-shelf-radius: 11px;
  --group-card-shelf-gap: 5px;
}

body[data-group-card-density="normal"] {
  --group-card-gap: var(--gap, 12px);
  --group-card-padding: 12px;
  --group-card-min-height: 132px;
  --group-card-radius: 16px;
  --group-card-inner-gap: 10px;
  --group-card-name-font: 14px;
  --group-card-count-font: 11px;
  --group-card-favicon-size: 40px;
  --group-card-shelf-pad: 6px;
  --group-card-shelf-radius: 13px;
  --group-card-shelf-gap: 6px;
}

body[data-group-card-density="large"] {
  --group-card-gap: 14px;
  --group-card-padding: 15px;
  --group-card-min-height: 152px;
  --group-card-radius: 18px;
  --group-card-inner-gap: 12px;
  --group-card-name-font: 15px;
  --group-card-count-font: 12px;
  --group-card-favicon-size: 44px;
  --group-card-shelf-pad: 7px;
  --group-card-shelf-radius: 14px;
  --group-card-shelf-gap: 7px;
}

body[data-group-card-density="xl"] {
  --group-card-gap: 16px;
  --group-card-padding: 18px;
  --group-card-min-height: 172px;
  --group-card-radius: 20px;
  --group-card-inner-gap: 14px;
  --group-card-name-font: 16px;
  --group-card-count-font: 13px;
  --group-card-favicon-size: 48px;
  --group-card-shelf-pad: 8px;
  --group-card-shelf-radius: 15px;
  --group-card-shelf-gap: 8px;
}

.home-empty {
  margin: 6px 0 0;
  color: var(--text-dim);
  font-size: 13px;
}

.group-card {
  --group-card-bg: rgba(255, 255, 255, 0.035);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 100%;
  min-height: var(--group-card-min-height, 132px);
  padding: var(--group-card-padding, 12px);
  border-radius: var(--group-card-radius, 16px);
  border: 1px solid color-mix(in srgb, var(--group-border, var(--border)) 86%, transparent);
  border-left: 3px solid color-mix(in srgb, var(--group-color, var(--accent)) 78%, transparent);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--group-tint, rgba(255, 255, 255, 0.04)) 82%, transparent) 0%,
    var(--group-card-bg) 100%
  );
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
  justify-content: flex-start;
}

.group-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--group-active-border, var(--border-strong)) 88%, transparent);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--group-tint, rgba(255, 255, 255, 0.06)) 88%, transparent) 0%,
    rgba(255, 255, 255, 0.065) 100%
  );
}

.group-card:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--group-color, var(--accent)) 42%, transparent),
    0 8px 20px rgba(0, 0, 0, 0.12);
}

.group-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.group-card-main {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.group-card-marker {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-top: 4px;
  flex-shrink: 0;
  background: var(--group-color, var(--accent));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--group-color, var(--accent)) 25%, transparent);
}

.group-card-icon {
  width: 18px;
  height: 18px;
  color: var(--group-accent, var(--text));
  flex-shrink: 0;
}

.group-card-name-wrap {
  display: block;
  min-width: 0;
  max-width: 100%;
}

.group-card-name {
  display: block;
  font-size: var(--group-card-name-font, 14px);
  font-weight: 800;
  line-height: 1.25;
  white-space: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.group-card-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  padding: 0 9px;
  border: 1px solid color-mix(in srgb, var(--group-color, var(--accent)) 36%, rgba(255, 255, 255, 0.2));
  border-radius: 999px;
  background: rgba(5, 5, 14, 0.62);
  color: var(--text);
  font-size: var(--group-card-count-font, 11px);
  font-weight: 800;
  line-height: 1;
}

.group-card-count::before {
  content: none;
}

.group-card-head-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 0 0 auto;
  margin-top: -1px;
}

.group-card-pinned {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: color-mix(in srgb, var(--group-color, var(--accent)) 72%, var(--text));
  opacity: 0.85;
}

.group-card-edit {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
}

.group-card-previews {
  display: flex;
  align-self: stretch;
  justify-content: flex-start;
  align-items: flex-start;
  align-content: flex-start;
  flex-wrap: wrap;
  gap: var(--group-card-shelf-gap, 6px);
  padding: var(--group-card-shelf-pad, 6px);
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin-top: 9px;
  min-height: calc(var(--group-card-favicon-size, 40px) * 2 + var(--group-card-shelf-gap, 6px) + var(--group-card-shelf-pad, 6px) * 2);
  border-radius: var(--group-card-shelf-radius, 13px);
  background: color-mix(in srgb, var(--group-tint, rgba(255, 255, 255, 0.04)) 38%, rgba(255, 255, 255, 0.02));
  border: 1px solid color-mix(in srgb, var(--border) 32%, transparent);
  overflow: hidden;
}

/* count modifier classes (1..8) are present as CSS hooks via JS;
 * shared alignment comes from .group-card-previews base rule above. */

body.light .group-card-previews {
  background: color-mix(in srgb, var(--group-tint, rgba(15, 23, 42, 0.04)) 20%, rgba(15, 23, 42, 0.03));
  border-color: color-mix(in srgb, var(--border) 60%, transparent);
}

.group-card-previews.is-empty {
  align-items: center;
  min-height: calc(var(--group-card-favicon-size, 40px) + var(--group-card-shelf-pad, 6px) * 2);
}

.group-card-preview-empty {
  display: inline-flex;
  align-items: center;
  min-height: var(--group-card-favicon-size, 40px);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
}

.group-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  margin: auto calc(var(--group-card-padding, 12px) * -1) calc(var(--group-card-padding, 12px) * -1);
  padding: 9px var(--group-card-padding, 12px);
  border-top: 1px solid color-mix(in srgb, var(--group-color, var(--accent)) 36%, transparent);
  border-radius: 0 0 calc(var(--group-card-radius, 16px) - 1px) calc(var(--group-card-radius, 16px) - 1px);
  background: rgba(2, 2, 10, 0.54);
}

.group-card-footer-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: color-mix(in srgb, var(--text) 80%, var(--text-dim));
  font-size: 12px;
  font-weight: 650;
}

.group-card-footer-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  color: color-mix(in srgb, var(--group-color, var(--accent)) 55%, var(--text));
  font-weight: 900;
  line-height: 1;
}

.group-card-footer-arrow {
  color: currentColor;
  opacity: 0.78;
  font-size: 13px;
}

/* TB-052: home section header (title + add-group action) and action menus. */
.home-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 10px;
}

.home-section-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.home-section-header .home-section-title {
  margin: 0;
}

.home-section-stats {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  min-width: 0;
  opacity: 0.62;
}

.home-stat-item {
  white-space: nowrap;
}

.home-stat-divider {
  opacity: 0.4;
}

.home-section-action {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.14s ease;
}

.home-section-action:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong, var(--border));
  transform: translateY(-1px);
}

.home-section-action:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #4aa9ff) 60%, transparent);
}

.card-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, opacity 0.14s ease, transform 0.14s ease;
}

.card-menu-btn svg {
  width: 16px;
  height: 16px;
}

.card-menu-btn:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: var(--border-strong, var(--border));
}

.card-menu-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #4aa9ff) 60%, transparent);
}

.group-card-menu-btn {
  flex-shrink: 0;
}

/* Site tile menu button — desktop fades in on hover/focus, mobile stays
 * accessible at low opacity without depending on hover. */
.tile-menu-btn {
  position: absolute;
  z-index: 4;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  opacity: 0;
  transform: translateY(-2px);
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.tile-note-btn {
  position: absolute;
  z-index: 4;
  top: 8px;
  right: 40px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--border) 72%, rgba(255, 255, 255, 0.2));
  background: rgba(7, 13, 24, 0.62);
  color: color-mix(in srgb, #ffffff 92%, var(--text) 8%);
  opacity: 0.82;
  transform: translateY(0);
  pointer-events: auto;
  transition: opacity 0.14s ease, transform 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

.tile-note-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.tile:hover .tile-menu-btn,
.tile:focus-within .tile-menu-btn,
.tile-menu-btn:focus-visible,
.tile-note-btn:focus-visible,
.tile.edit-mode .tile-menu-btn {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.tile.edit-mode .tile-note-btn {
  opacity: 0.9;
}

.tile-note-btn:hover,
.tile-note-btn:focus-visible {
  background: rgba(7, 13, 24, 0.8);
  border-color: var(--border-strong, var(--border));
}

@media (hover: none), (max-width: 480px) {
  .tile-menu-btn {
    opacity: 0.7;
    transform: translateY(0);
    pointer-events: auto;
  }
  .tile-note-btn {
    opacity: 0.82;
    transform: translateY(0);
    pointer-events: auto;
  }
  .tile-menu-btn:active,
  .tile-menu-btn:focus-visible,
  .tile-note-btn:active,
  .tile-note-btn:focus-visible {
    opacity: 1;
  }
}

/* Shared popover for `⋯` menus. Anchored via inline top/left from JS. */
.context-menu {
  position: fixed;
  z-index: 1000;
  min-width: 200px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--border-strong, var(--border)) 78%, rgba(255, 255, 255, 0.18));
  background: color-mix(in srgb, var(--panel-bg, var(--surface)) 94%, transparent);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.context-menu-item {
  appearance: none;
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}


.context-menu-item + .context-menu-item {
  border-top: 1px solid color-mix(in srgb, var(--border) 68%, transparent);
}

.context-menu-item:hover,
.context-menu-item:focus-visible {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
}

.context-menu-item.danger {
  color: var(--danger, #ff6f7a);
}

.context-menu-item.danger:hover,
.context-menu-item.danger:focus-visible {
  background: rgba(255, 111, 122, 0.16);
}

body.light .context-menu {
  background: color-mix(in srgb, var(--panel-bg, var(--surface)) 96%, transparent);
  border-color: color-mix(in srgb, var(--border-strong, var(--border)) 84%, rgba(255, 255, 255, 0.08));
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

body.light .context-menu-item + .context-menu-item {
  border-top: 1px solid color-mix(in srgb, var(--border) 64%, transparent);
}

body.light .context-menu-item:hover,
body.light .context-menu-item:focus-visible {
  background: rgba(15, 23, 42, 0.06);
}

@media (max-width: 640px) {
  .context-menu {
    background: color-mix(in srgb, var(--panel-bg, var(--surface)) 96%, transparent);
  }
}

.empty-state-simple-home {
  /* Reuse existing onboarding empty-state styles; this class is a hook for
   * future polish (TB-053/054). */
}

.group-card-preview-item {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--group-card-favicon-size, 40px);
  height: var(--group-card-favicon-size, 40px);
  border-radius: 10px;
  background: color-mix(in srgb, var(--group-tint, rgba(255, 255, 255, 0.08)) 35%, rgba(255, 255, 255, 0.08));
  border: 1px solid color-mix(in srgb, var(--group-color, var(--accent)) 18%, rgba(255, 255, 255, 0.08));
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

.group-card-preview-favicon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80%;
  height: 80%;
  overflow: hidden;
  pointer-events: none;
}

.group-card-preview-favicon img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.group-card-preview-monogram {
  font-size: calc(var(--group-card-favicon-size, 40px) * 0.5);
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  letter-spacing: 0;
  pointer-events: none;
}

.group-card-preview-more {
  font-size: calc(var(--group-card-favicon-size, 40px) * 0.38);
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  letter-spacing: 0;
  padding: 0 6px;
  min-width: var(--group-card-favicon-size, 40px);
  width: auto;
  background: color-mix(in srgb, var(--group-color, var(--accent)) 28%, rgba(255, 255, 255, 0.08));
  border-color: color-mix(in srgb, var(--group-color, var(--accent)) 42%, rgba(255, 255, 255, 0.16));
}

body.light .group-card-preview-item {
  background: rgba(15, 23, 42, 0.06);
}

body.light .group-card-preview-more {
  background: rgba(15, 23, 42, 0.035);
}

.tabs-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: visible;
  padding: 2px 2px 4px;
}

.groups-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.groups-section-title {
  margin: 0;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.groups-section-list {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
}

.tab-shell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.tab-shell.is-pinned .tab {
  border-color: var(--group-active-border, var(--group-border, var(--border)));
}

.tab-shell.dragging-group {
  opacity: 0.5;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 11px 15px;
  border-radius: 999px;
  border: 1px solid var(--group-border, var(--border));
  background:
    linear-gradient(180deg, var(--group-tint, rgba(255, 255, 255, 0.035)), rgba(255, 255, 255, 0.025)),
    rgba(255, 255, 255, 0.04);
  color: rgba(232, 238, 251, 0.86);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.tab.active {
  color: #fff;
  border-color: var(--group-active-border, transparent);
  background: var(--group-active-bg, linear-gradient(135deg, rgba(89, 166, 255, 0.88), rgba(142, 124, 255, 0.78)));
  box-shadow: var(--group-glow, 0 14px 28px rgba(20, 29, 47, 0.2));
}

.tab.drop-target,
.tab-shell.drop-target .tab {
  color: #fff;
  border-color: rgba(123, 240, 200, 0.72);
  background: linear-gradient(135deg, rgba(89, 166, 255, 0.4), rgba(123, 240, 200, 0.34));
}

.tab-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.tab-name {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-icon,
.group-title-icon-mark,
.group-icon-option-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tab-icon {
  width: 16px;
  height: 16px;
  color: var(--group-accent, currentColor);
}

.tab-icon svg,
.group-title-icon-mark svg,
.group-icon-option-mark svg,
.group-tab-edit svg,
.group-tab-pin svg,
.tab-pinned-badge svg {
  width: 100%;
  height: 100%;
}

.tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding-inline: 8px;
  border-radius: 999px;
  background: var(--group-count-bg, rgba(255, 255, 255, 0.12));
  font-size: 11px;
}

.tab-pinned-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  color: var(--group-accent, currentColor);
  opacity: 0.78;
}

.tab.active .tab-count {
  background: var(--group-count-active-bg, rgba(255, 255, 255, 0.14));
}

.group-tab-edit,
.group-tab-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--group-active-border, var(--border));
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--group-accent, var(--text));
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.group-tab-edit:hover,
.group-tab-pin:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--group-accent, var(--border-strong));
}

.group-tab-pin.active {
  border-color: var(--group-active-border, var(--group-border, var(--border-strong)));
  background:
    linear-gradient(180deg, var(--group-tint, rgba(255, 255, 255, 0.08)), rgba(255, 255, 255, 0.06)),
    rgba(255, 255, 255, 0.06);
  color: var(--group-accent, var(--text));
}

.group-tab-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px dashed var(--group-border, var(--border));
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--group-accent, var(--text-dim));
  cursor: grab;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.group-tab-handle:hover {
  transform: translateY(-1px);
  border-color: var(--group-active-border, var(--border-strong));
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.group-tab-handle:active {
  cursor: grabbing;
}

.group-tab-handle svg {
  width: 15px;
  height: 15px;
}

.tab-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  min-height: 42px;
  height: 42px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.tab-add-btn span[aria-hidden="true"] {
  font-size: 20px;
  line-height: 1;
}

.section-toggle-row {
  display: flex;
  align-items: center;
  padding: 0 2px 2px;
}

.section-toggle-btn {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.section-toggle-btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.workspace-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.group-back-row {
  display: none;
  width: 100%;
}

.group-back-btn {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.group-back-btn:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.08);
}

.workspace-head-copy {
  min-width: 0;
}

.group-kicker {
  margin-bottom: 8px;
}

.group-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.group-color-dot,
.group-title-icon {
  flex-shrink: 0;
}

.group-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--accent);
}

.group-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 12px;
  border: 1px solid var(--group-border, var(--border));
  background:
    linear-gradient(180deg, var(--group-tint, rgba(255, 255, 255, 0.04)), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.03);
  color: var(--group-accent, var(--text));
}

.group-title-icon[hidden] {
  display: none;
}

.group-title-icon-mark {
  width: 18px;
  height: 18px;
}

.group-title {
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.group-title-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-dim);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.group-title-edit svg {
  width: 16px;
  height: 16px;
}

.group-title-edit:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.group-title-edit[hidden] {
  display: none;
}

.workspace-head-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.group-edit-mode-btn {
  min-height: 40px;
  padding: 10px 14px;
}

.group-add-btn {
  min-height: 40px;
  padding: 10px 14px;
}

.group-sort-btn {
  min-height: 40px;
  padding: 10px 14px;
}

.open-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.open-all-btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.10);
}

.open-all-btn:active {
  transform: translateY(0);
}

.open-all-btn svg {
  width: 14px;
  height: 14px;
}

.open-all-btn[hidden] {
  display: none;
}

#m-open-all[hidden],
#row-reliable-bulk-open[hidden] {
  display: none;
}

.session-pack-modal {
  max-width: 520px;
}

.session-pack-hint {
  margin: 4px 0 12px;
  font-size: 13px;
  color: var(--text-dim);
}

.session-pack-list-heading {
  margin: 10px 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.session-pack-list {
  list-style: none;
  margin: 0;
  padding: 8px 10px;
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
}

.session-pack-list li {
  padding: 4px 0;
  word-break: break-all;
}

.session-pack-list a {
  color: var(--text);
  text-decoration: none;
}

.session-pack-list a:hover {
  text-decoration: underline;
}

.group-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  font-weight: 800;
}

/* ── Settings drawer ── */
.settings-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: 320px;
  max-width: 100vw;
  z-index: 900;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--drawer-shadow);
  overflow: hidden;
}

.settings-drawer.open {
  transform: translateX(0);
}

.drawer-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 899;
  background: var(--overlay-bg);
  backdrop-filter: blur(2px);
}

.drawer-backdrop.active {
  display: block;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--drawer-head-bg);
  flex-shrink: 0;
}

.drawer-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.drawer-close {
  width: 32px;
  height: 32px;
  border: 1px solid var(--control-border);
  border-radius: 9px;
  background: var(--control-bg);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.drawer-close:hover {
  background: var(--control-hover);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.settings-tabs {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-strong) 88%, transparent);
  backdrop-filter: blur(8px);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.settings-tabs::-webkit-scrollbar {
  display: none;
}

.settings-tab {
  flex: 0 0 auto;
  border: 1px solid var(--control-border);
  border-radius: 999px;
  background: var(--control-bg);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 800;
  padding: 7px 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.settings-tab:hover {
  background: var(--control-hover);
  color: var(--text);
}

.settings-tab.is-active {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface-strong));
  border-color: color-mix(in srgb, var(--accent) 46%, var(--control-border));
  color: var(--text);
}

.settings-tab.settings-tab-danger {
  color: color-mix(in srgb, var(--danger) 80%, var(--text-dim));
}

.settings-tab.settings-tab-danger.is-active {
  background: rgba(255, 107, 107, 0.16);
  border-color: rgba(255, 107, 107, 0.3);
  color: var(--danger);
}

.drawer-section {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.drawer-section:last-child {
  border-bottom: none;
}

.settings-section[hidden] {
  display: none;
}

.settings-section-danger .drawer-section-title {
  color: color-mix(in srgb, var(--danger) 72%, var(--field-placeholder));
}

.drawer-section-title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--field-placeholder);
  margin-bottom: 8px;
}

.drawer-section-title--spaced {
  margin-top: 18px;
}

.drawer-section-title-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.drawer-section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--text-dim);
}

.drawer-section-icon svg {
  width: 100%;
  height: 100%;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.setting-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.setting-label {
  min-width: 0;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
}

.setting-copy {
  display: grid;
  flex: 1 1 0;
  min-width: 0;
  gap: 4px;
}

.setting-row > .setting-label {
  flex: 1 1 0;
}

.setting-control {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
}

.setting-row > .toggle {
  margin-left: auto;
}

.setting-select {
  width: min(180px, 52vw);
  min-height: 36px;
  padding: 8px 34px 8px 12px;
  border: 1px solid var(--field-border);
  border-radius: 12px;
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.setting-select:focus {
  outline: none;
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.setting-select option {
  background: var(--surface-strong);
  color: var(--text);
}

.search-engine-list,
.search-engine-custom-list {
  display: flex;
  flex-direction: column;
}

.search-engine-list {
  margin-top: 10px;
}

.search-engine-row {
  align-items: flex-start;
}

.search-engine-row-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-engine-row-meta {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}

.search-engine-custom-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  margin-bottom: 10px;
}

.search-engine-custom-copy {
  min-width: 0;
}

.search-engine-custom-title {
  font-size: 12px;
  font-weight: 800;
}

.search-engine-inline-hint {
  margin-top: 4px;
}

.search-engine-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.search-engine-card-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.search-engine-card:first-child {
  border-top: 1px solid var(--border);
}

.search-engine-card-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.search-engine-card-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.search-engine-card-copy strong {
  font-size: 13px;
  font-weight: 800;
}

.search-engine-card-copy code {
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.55;
  word-break: break-all;
  white-space: normal;
}

.search-engine-card-actions {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 8px;
}

.search-engine-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--text);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.search-engine-empty {
  padding: 4px 0 0;
}

.step-readout {
  display: grid;
  justify-items: center;
  min-width: 72px;
  gap: 2px;
}

.step-caption {
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Trust detail rows in drawer */
.trust-detail-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.trust-detail-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.trust-detail-row strong {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

.trust-detail-row small {
  font-size: 11px;
  color: var(--text-dim);
}

/* Sync panel inside drawer: vertical layout */
.settings-drawer .sync-panel {
  flex-direction: column;
  align-items: stretch;
  margin-top: 12px;
  padding-top: 12px;
}

.settings-drawer .sync-actions {
  flex-direction: column;
  justify-content: stretch;
  margin-top: 10px;
}

.settings-drawer .sync-actions.compact {
  margin-top: 0;
  margin-bottom: 12px;
}

.settings-drawer .sync-actions .icon-btn {
  width: 100%;
  justify-content: center;
  white-space: normal;
  text-align: center;
  line-height: 1.3;
}

.data-drawer-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.data-drawer-actions .icon-btn {
  width: 100%;
  justify-content: center;
  white-space: normal;
  text-align: center;
  line-height: 1.3;
}

.data-file-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.data-file-label {
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.data-file-card strong,
.data-file-card small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.data-file-card strong {
  font-size: 13px;
  font-weight: 800;
}

.data-file-card small {
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.45;
}

.settings-advanced-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 10px 12px;
}

.settings-advanced-block summary {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  cursor: pointer;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  list-style-position: outside;
}

.settings-advanced-block .setting-hint {
  margin-top: 8px;
}

.step-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}

.step-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
}

.step-btn:disabled:hover {
  border-color: var(--border);
  background: var(--surface-soft);
  transform: none;
}

.step-val {
  min-width: 32px;
  text-align: center;
  font-size: 13px;
  font-weight: 800;
}

.step-meta {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

.step-meta.is-adaptive {
  color: #cfe6ff;
}

#settings-section-view .setting-row:has(.step-btn) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px 124px 36px;
  align-items: center;
  gap: 10px;
}

#settings-section-view .setting-row:has(.step-btn) .setting-copy,
#settings-section-view .setting-row:has(.step-btn) > .setting-label {
  min-width: 0;
}

#settings-section-view .setting-row:has(.step-btn) .setting-control {
  display: contents;
}

#settings-section-view .setting-row:has(.step-btn) .step-btn {
  width: 36px;
  min-width: 36px;
  height: 36px;
}

#settings-section-view .setting-row:has(.step-btn) .step-readout {
  width: 100%;
  min-width: 0;
}

#settings-section-view .setting-row:has(.step-btn) .step-meta {
  font-size: 10px;
  white-space: nowrap;
}

#settings-section-view .setting-row:has(> .toggle) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  gap: 12px;
}

#settings-section-view .setting-row:has(> .toggle) > .setting-label {
  min-width: 0;
}

#settings-section-view .setting-row:has(> .toggle) > .toggle {
  margin-left: 0;
  justify-self: end;
}

.layout-safety-note {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.toggle {
  display: block;
  appearance: none;
  position: relative;
  flex: 0 0 44px;
  width: 44px;
  height: 26px;
  min-width: 44px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--border-strong) 58%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-strong) 82%, #000 18%);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.toggle::before {
  content: '';
  position: absolute;
  inset: -9px -4px;
}

.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.24);
  transition: transform 0.18s ease;
}

.toggle:hover {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border-strong));
  background: color-mix(in srgb, var(--surface-strong) 74%, var(--accent) 10%);
}

.toggle:focus-visible {
  outline: none;
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.22),
    0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent);
}

.toggle.on {
  border-color: color-mix(in srgb, var(--accent) 54%, transparent);
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
}

.toggle.on::after {
  transform: translateX(18px);
}

.toggle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.toggle:disabled::before {
  cursor: not-allowed;
}

.sync-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.sync-panel-copy {
  max-width: 640px;
}

.sync-panel-title {
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 800;
}

.setting-hint,
.modal-help,
.sync-choice-text,
.sync-diag-note {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.6;
}

.layout-safety-note {
  margin-top: 10px;
}

.layout-safety-note.is-adaptive {
  color: #cfe6ff;
}

.settings-subsection-title {
  margin: 14px 0 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.drawer-section-title + .settings-subsection-title {
  margin-top: 8px;
}

.settings-section-opening {
  margin-top: 14px;
}

@media (max-width: 520px) {
  .settings-section-opening {
    margin-top: 10px;
  }
}

.sync-diagnostics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.sync-diag-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sync-diag-row strong {
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.sync-diag-note {
  grid-column: 1 / -1;
}

.sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.clock {
  display: none;
  margin-top: 2px;
  max-width: 100%;
  min-width: 0;
  white-space: nowrap;
}

.clock.visible {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.clock-time {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
  color: color-mix(in srgb, var(--text) 88%, var(--text-dim));
}

.clock-date {
  color: color-mix(in srgb, var(--text-dim) 90%, transparent);
  font-size: 11px;
  font-weight: 560;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clock-date::before {
  content: '·';
  display: inline-block;
  margin-right: 6px;
  color: color-mix(in srgb, var(--text-dim) 70%, transparent);
}

.grid-wrap {
  position: relative;
}

body.runtime-view-home #tabs-bar,
body.runtime-view-home .tabs-frame .section-toggle-row,
body.runtime-view-home .workspace-head,
body.runtime-view-home .grid-wrap {
  display: none;
}

body.runtime-view-home #home-view {
  display: block;
}

body.runtime-view-home #favorites-panel:not([hidden]) .home-favorites-title {
  display: block;
}

body.runtime-view-home.runtime-search-active .grid-wrap {
  display: block;
}

body.runtime-view-home.runtime-search-active #home-view {
  display: none;
}

/* TB-052: simple home mode — render the lone default group's sites grid in
 * place of group cards. */
body.runtime-view-home.runtime-mode-simple .grid-wrap {
  display: block;
}

body.runtime-view-home.runtime-mode-simple #home-view {
  display: none;
}

body.runtime-view-home.runtime-mode-simple.runtime-simple-has-sites:not(.runtime-search-active) .workspace-head {
  display: flex;
}

body.runtime-view-home.runtime-mode-simple.runtime-simple-has-sites:not(.runtime-search-active) .group-back-row,
body.runtime-view-home.runtime-mode-simple.runtime-simple-has-sites:not(.runtime-search-active) .group-sort-btn,
body.runtime-view-home.runtime-mode-simple.runtime-simple-has-sites:not(.runtime-search-active) .group-edit-mode-btn {
  display: none;
}

body.runtime-view-group #tabs-bar,
body.runtime-view-group .tabs-frame .section-toggle-row,
body.runtime-view-group #home-view {
  display: none;
}

body.runtime-view-group #favorites-panel:not([hidden]) .home-favorites-title {
  display: block;
}

body.runtime-view-group #favorites-panel:not([hidden]) {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-bottom: 18px;
}

body.runtime-view-group .workspace-head,
body.runtime-view-group .grid-wrap {
  display: block;
}

body.runtime-view-group .workspace-head {
  display: flex;
}

body.runtime-view-group .group-back-row {
  display: block;
}

.tabs-frame:has(#tabs-bar:empty):has(#groups-toggle-row[hidden]) {
  display: none;
}

.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  align-items: stretch;
  gap: var(--gap);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.grid > * {
  min-width: 0;
}

.grid.fading {
  opacity: 0;
  transform: translateY(6px);
}

.tile {
  --tile-accent: var(--accent);
  --tile-caption-height: 52px;
  --tile-card-height: clamp(144px, var(--tile-min), 176px);
  height: var(--tile-card-height);
  min-height: 0;
  max-height: var(--tile-card-height);
  border-radius: 22px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.tile.has-preview {
  height: var(--tile-card-height);
  min-height: 0;
  max-height: var(--tile-card-height);
}

.tile.no-preview {
  height: var(--tile-card-height);
  min-height: 0;
  max-height: var(--tile-card-height);
  justify-content: flex-start;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  gap: 0;
  padding: 0;
  text-decoration: none;
  color: inherit;
  opacity: 0;
  transform: translateY(12px) scale(0.985);
  transition:
    transform 0.18s ease,
    opacity 0.22s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.tile.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.tile.favorite {
  border-color: var(--favorite-chip-hover-border);
  box-shadow:
    0 0 0 1px var(--favorite-chip-border),
    var(--shadow);
}

.tile-favorite-badge {
  z-index: 2;
}

.tile:hover {
  border-color: var(--border-strong);
  background: var(--card-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-card);
}

.tile.edit-mode {
  cursor: default;
}

.tile.dragging {
  opacity: 0.35;
}

.tile.drag-over {
  border-color: var(--accent);
}

.tile-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 calc(var(--tile-card-height) - var(--tile-caption-height));
  min-height: 0;
  height: calc(var(--tile-card-height) - var(--tile-caption-height));
  padding: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.22), transparent 42%),
    linear-gradient(135deg, color-mix(in srgb, var(--tile-accent) 88%, #ffffff), color-mix(in srgb, var(--tile-accent) 68%, #050713));
  overflow: hidden;
}

.tile-visual-fallback::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 52%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent 58%);
  pointer-events: none;
}

.tile-preview-image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: color-mix(in srgb, var(--tile-accent) 18%, var(--surface));
}

.tile-visual-logo {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(66px, 48%);
  aspect-ratio: 1;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  color: color-mix(in srgb, var(--tile-accent) 54%, #111827);
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 900;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.58),
    0 18px 34px rgba(0, 0, 0, 0.26);
  overflow: hidden;
}

.tile-visual-logo img {
  width: 70%;
  height: 70%;
  object-fit: contain;
}

.tile-note-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 13, 24, 0.62);
  border: 1px solid color-mix(in srgb, var(--border) 70%, rgba(255, 255, 255, 0.35));
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(2px);
  pointer-events: none;
}

.tile-note-indicator svg {
  width: 12px;
  height: 12px;
  stroke: color-mix(in srgb, #ffffff 92%, var(--text) 8%);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  opacity: 0.96;
}

.tile-caption {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 var(--tile-caption-height);
  height: var(--tile-caption-height);
  min-width: 0;
  padding: 0 13px;
  border-top: 1px solid color-mix(in srgb, var(--tile-accent) 16%, var(--border));
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--tile-accent) 10%, transparent), transparent 34%),
    color-mix(in srgb, var(--surface) 78%, transparent);
}

.tile-caption-favicon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--favicon-bg);
  color: var(--favicon-color);
  font-size: 10px;
  font-weight: 900;
  overflow: hidden;
}

.tile-caption-favicon img {
  width: 70%;
  height: 70%;
  object-fit: contain;
}

.tile-caption-name {
  overflow: hidden;
  min-width: 0;
  color: var(--text);
  font-size: var(--tile-font);
  font-weight: 850;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-fallback-identity {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  gap: 12px;
}

.tile-fallback-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
  align-content: start;
}

.tile-fallback-title {
  overflow: hidden;
  color: var(--text);
  font-size: var(--tile-font);
  font-weight: 850;
  line-height: 1.28;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-fallback-host {
  overflow: hidden;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-description {
  display: -webkit-box;
  overflow: hidden;
  max-width: 100%;
  margin-top: 2px;
  color: color-mix(in srgb, var(--text-dim) 86%, var(--text));
  font-size: 11px;
  font-weight: 650;
  line-height: 1.36;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.tile-body {
  position: relative;
  display: grid;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  padding: 12px 14px 13px;
}

.tile-body-preview {
  flex: 0 0 64px;
  height: 64px;
  gap: 8px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--tile-accent) 12%, transparent), transparent 32%),
    color-mix(in srgb, var(--surface) 72%, transparent);
  border-top: 1px solid color-mix(in srgb, var(--tile-accent) 16%, var(--border));
}

.tile-body-fallback {
  height: 100%;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 9px;
  padding: 13px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--tile-accent) 10%, transparent), transparent 48%),
    transparent;
}

.tile.no-preview .tile-body-fallback {
  min-height: 0;
}

.favicon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--fav-size) + 20px);
  height: calc(var(--fav-size) + 20px);
  border-radius: 18px;
  background: var(--favicon-bg);
  color: var(--favicon-color);
  font-size: var(--fav-font);
  font-weight: 800;
  flex-shrink: 0;
  overflow: visible;
}

.tile-fallback-favicon {
  width: calc(var(--fav-size) + 16px);
  height: calc(var(--fav-size) + 16px);
  border-radius: 18px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 10px 24px color-mix(in srgb, var(--tile-accent) 18%, transparent);
}

.tile-favorite-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(255, 208, 107, 0.42);
  background: linear-gradient(135deg, rgba(255, 212, 122, 0.98), rgba(255, 170, 74, 0.96));
  color: #2a1c00;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(255, 178, 68, 0.28);
}

.favicon img {
  width: 62%;
  height: 62%;
  object-fit: contain;
}

.tile-small-favicon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: var(--favicon-bg);
  color: var(--favicon-color);
  font-size: 9px;
  font-weight: 850;
  overflow: hidden;
}

.tile-small-favicon img {
  width: 68%;
  height: 68%;
  object-fit: contain;
}

.menu-item-mobile { display: none; }
.menu-sep-mobile  { display: none; }

.tile-actions {
  position: absolute;
  z-index: 3;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.tile.edit-mode .tile-actions {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.tile-action-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
}

.tile-action-btn.active {
  border-color: rgba(255, 193, 92, 0.42);
  background: rgba(255, 193, 92, 0.14);
  color: #ffd777;
}

.tile-copy {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.tile-title-row {
  min-width: 0;
}

.tile-name {
  overflow: hidden;
  min-width: 0;
  font-size: var(--tile-font);
  font-weight: 800;
  line-height: 1.28;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-host {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  word-break: break-all;
}

.tile-search-group {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(89, 166, 255, 0.28);
  background: rgba(89, 166, 255, 0.1);
  color: #cfe6ff;
  font-size: 11px;
  font-weight: 800;
}

.hide-names .tile-name,
.hide-names .tile-host,
.hide-names .tile-fallback-title,
.hide-names .tile-fallback-host,
.hide-names .tile-description,
.hide-names .tile-caption-name {
  display: none;
}

.tile-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 650;
  opacity: 0.74;
  min-width: 0;
  white-space: nowrap;
}

.tile-footer > span:last-child {
  flex: 0 0 auto;
  opacity: 0.58;
  font-weight: 600;
  white-space: nowrap;
}

.tile-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.tile-label::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  opacity: 0.72;
}

.tile-add {
  height: var(--tile-card-height);
  min-height: 0;
  max-height: var(--tile-card-height);
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  border: 1px dashed var(--border-strong);
  background: rgba(255, 255, 255, 0.02);
}

.tile-add:hover {
  border-color: rgba(123, 240, 200, 0.7);
}

.tile-add .plus {
  font-size: 42px;
  font-weight: 400;
  line-height: 1;
}

.tile-add .add-label {
  margin-top: 8px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 800;
}

.tile.tile-new {
  animation: pop-in 0.22s ease forwards;
}

.empty-state {
  grid-column: 1 / -1;
  min-height: var(--tile-min);
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
}

.empty-state-onboarding {
  background:
    linear-gradient(135deg, rgba(89, 166, 255, 0.12), rgba(123, 240, 200, 0.08)),
    var(--surface-strong);
  border-color: rgba(89, 166, 255, 0.18);
}

.empty-state h3 {
  font-size: 18px;
  font-weight: 800;
}

.empty-state p {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.65;
}

.empty-note {
  display: block;
  margin-top: 10px;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.6;
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.empty-action {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.empty-action:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.09);
}

.empty-action.primary {
  background: linear-gradient(135deg, rgba(89, 166, 255, 0.92), rgba(123, 240, 200, 0.86));
  border-color: transparent;
  color: #07111d;
}

.drag-ghost {
  position: fixed;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(89, 166, 255, 0.5);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.overlay,
.menu-overlay {
  position: fixed;
  inset: 0;
}

.overlay {
  display: none;
  z-index: 1010;
  align-items: flex-end;
  justify-content: center;
  padding: 20px;
  background: rgba(6, 10, 18, 0.60);
  backdrop-filter: blur(6px);
}

.overlay.open {
  display: flex;
}

.modal {
  width: min(480px, 100%);
  max-height: 90dvh;
  padding: 22px;
  border-radius: 24px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation: slide-up 0.18s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(144, 168, 206, 0.22) transparent;
}

.modal h2 {
  margin-bottom: 14px;
  font-size: 18px;
  font-weight: 800;
  flex-shrink: 0;
}

.sync-choice-modal {
  width: min(760px, 100%);
}

.import-mode-modal {
  width: min(560px, 100%);
}

.search-engine-modal {
  width: min(560px, 100%);
}

.bookmark-import-modal {
  width: min(640px, 100%);
}

.bookmark-import-help-link {
  border: none;
  padding: 0;
  margin-top: 6px;
  background: none;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.bookmark-import-help-link:hover {
  color: var(--text);
}

.bookmark-import-help {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.bookmark-import-help-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
}

.bookmark-import-error {
  margin-top: 12px;
  color: #ff9a9a;
  font-size: 12px;
  line-height: 1.5;
}

.bookmark-import-preview {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.bookmark-import-file {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
}

.bookmark-import-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.operation-result {
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(89, 166, 255, 0.22);
  border-radius: 12px;
  background: rgba(89, 166, 255, 0.08);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.operation-result[hidden] {
  display: none;
}

.bookmark-import-stat,
.bookmark-import-section {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.bookmark-import-stat {
  display: grid;
  gap: 6px;
}

.bookmark-import-stat strong {
  font-size: 22px;
  line-height: 1;
}

.bookmark-import-stat-label,
.bookmark-import-section-title {
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.bookmark-import-section-head {
  margin-bottom: 8px;
}

.bookmark-import-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  font-size: 13px;
  line-height: 1.5;
}

.bookmark-import-empty {
  margin: 0;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
}

.sync-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.sync-choice-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
}

.sync-choice-card.cloud {
  background:
    linear-gradient(135deg, rgba(89, 166, 255, 0.12), rgba(123, 240, 200, 0.08)),
    rgba(255, 255, 255, 0.05);
}

.sync-choice-card strong {
  font-size: 15px;
  line-height: 1.5;
  font-weight: 800;
}

.sync-choice-card small {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.6;
}

.sync-choice-actions,
.modal-btns {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-shrink: 0;
}

.sort-options {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.sort-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.sort-option:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.08);
}

.sort-option strong {
  font-size: 13px;
  font-weight: 800;
}

.sort-option span {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
}

.modal-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  min-height: 44px;
  padding: 4px 0;
  line-height: 1.4;
  overflow: visible;
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.modal-check input {
  flex-shrink: 0;
  display: block;
  align-self: center;
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
  margin: 0;
  transform: none;
  overflow: visible;
  appearance: auto;
  -webkit-appearance: checkbox;
  accent-color: #ffc15c;
}

.modal-check span {
  display: block;
  line-height: 1.4;
}

.btn {
  flex: 1;
  border: 0;
  border-radius: 16px;
  padding: 14px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.btn-cancel {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.btn-save {
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  color: #fff;
}

.site-edit-modal .btn {
  border: 1px solid transparent;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.site-edit-modal .btn-cancel {
  border-color: rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.065);
}

.site-edit-modal .btn-save {
  background: linear-gradient(135deg, #5b54e8, #2f6fc9);
  box-shadow: 0 14px 26px rgba(47, 111, 201, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.site-edit-modal .btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.site-edit-modal .btn:active:not(:disabled) {
  transform: translateY(0);
}

.site-edit-modal .btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.24);
}

.site-edit-modal .btn-cancel:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.105);
}

.site-edit-modal .btn-cancel:active:not(:disabled) {
  background: rgba(255, 255, 255, 0.13);
}

.site-edit-modal .btn-save:hover:not(:disabled) {
  background: linear-gradient(135deg, #675ff0, #377bd7);
  box-shadow: 0 16px 30px rgba(47, 111, 201, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.site-edit-modal .btn-save:active:not(:disabled) {
  background: linear-gradient(135deg, #514bd3, #2b63b8);
  box-shadow: 0 10px 20px rgba(47, 111, 201, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.btn-danger-soft {
  background: rgba(255, 107, 107, 0.14);
  color: #ffd7d7;
}

.btn-secondary-soft {
  background: rgba(89, 166, 255, 0.16);
  color: #dcecff;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: transform 0.14s ease, border-color 0.14s ease, background 0.14s ease, color 0.14s ease;
}

.menu-item:hover {
  transform: translateY(-1px);
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.06);
}

.menu-item.danger {
  color: var(--danger);
}

.menu-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: currentColor;
  font-size: 12px;
  font-weight: 800;
}

.menu-item-icon svg {
  width: 100%;
  height: 100%;
}

.menu-item + .menu-item {
  margin-top: 8px;
}

.menu-item:focus-visible,
.drawer-close:focus-visible {
  outline: 2px solid rgba(121, 183, 255, 0.55);
  outline-offset: 2px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(calc(100% - 24px), 720px);
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  transform: translateX(-50%) translateY(16px);
  opacity: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
  box-shadow: var(--shadow);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-text {
  min-width: 0;
  line-height: 1.45;
}

.toast-action {
  flex-shrink: 0;
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  background: rgba(89, 166, 255, 0.16);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease;
}

.toast-action:hover {
  transform: translateY(-1px);
  background: rgba(89, 166, 255, 0.24);
}

#trust-dirty-row {
  display: inline-flex;
  align-items: center;
  color: var(--text-dim);
  font-size: 11px;
}

#trust-dirty-row[hidden] {
  display: none;
}

#trust-dirty.is-dirty {
  color: #ffd18b;
  font-weight: 700;
}

.pwa-install-hint {
  position: fixed;
  right: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(360px, calc(100vw - 28px));
  padding: 7px 10px;
  background: rgba(23, 31, 49, 0.96);
  border: 1px solid rgba(89, 166, 255, 0.24);
  border-radius: 12px;
  font-size: 11px;
  line-height: 1.35;
  z-index: 200;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.24);
  opacity: 0.88;
}

.pwa-install-hint .icon-btn {
  min-height: 30px;
  padding: 7px 9px;
  font-size: 11px;
}

.pwa-install-hint[hidden] {
  display: none;
}

.group-modal-section + .group-modal-section {
  margin-top: 18px;
}

.group-modal-label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
}

.group-modal-section > input {
  margin-top: 0;
}

.group-color-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.group-color-option,
.group-icon-option {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.group-color-option:hover,
.group-icon-option:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.06);
}

.group-color-option.selected,
.group-icon-option.selected {
  border-color: var(--group-active-border, rgba(89, 166, 255, 0.46));
  background:
    linear-gradient(180deg, var(--group-tint, rgba(255, 255, 255, 0.06)), rgba(255, 255, 255, 0.04)),
    rgba(255, 255, 255, 0.055);
  box-shadow: var(--group-glow, 0 10px 22px rgba(0, 0, 0, 0.18));
}

.group-color-swatch {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--group-accent, var(--accent));
  box-shadow: 0 0 0 1px var(--group-border, var(--border));
  flex-shrink: 0;
}

.group-color-name,
.group-icon-option-text {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.group-icon-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.group-icon-option {
  min-height: 58px;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  gap: 8px;
}

.group-icon-option.is-none {
  justify-content: center;
}

.group-pin-toggle {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.group-pin-toggle:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.06);
}

.group-pin-toggle.active {
  border-color: var(--group-active-border, var(--border-strong));
  background:
    linear-gradient(180deg, var(--group-tint, rgba(255, 255, 255, 0.06)), rgba(255, 255, 255, 0.04)),
    rgba(255, 255, 255, 0.05);
  color: var(--group-accent, var(--text));
  box-shadow: var(--group-glow, 0 10px 22px rgba(0, 0, 0, 0.18));
}

.group-icon-option-mark {
  width: 20px;
  height: 20px;
  color: var(--accent-2);
}

body.light .landing-page::before {
  opacity: 0.03;
}

body.light .landing-hero {
  border-color: var(--border);
  background:
    radial-gradient(circle at top right, var(--ambient-1), transparent 34%),
    linear-gradient(180deg, var(--panel-bg), var(--panel-bg-soft));
  box-shadow: var(--shadow-card);
  backdrop-filter: none;
}

body.light .landing-panel,
body.light .workspace-card,
body.light .modal,
body.light .settings-drawer,
body.light .menu-drawer {
  border-color: var(--border);
  background: linear-gradient(180deg, var(--panel-bg), var(--panel-bg-soft));
  box-shadow: var(--shadow-card);
  backdrop-filter: none;
}



body.light .workspace-card::before {
  background: linear-gradient(180deg, var(--ambient-1), transparent 78%);
}

body.light .landing-mark {
  border-color: var(--border);
  background: linear-gradient(180deg, var(--surface-strong), var(--panel-bg-soft));
  box-shadow:
    var(--shadow-soft),
    inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

body.light .landing-mark {
  box-shadow:
    0 18px 32px rgba(73, 99, 141, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

body.light .landing-feature-card,
body.light .landing-step,
body.light .landing-split-card,
body.light .landing-usecase,
body.light .landing-cta-panel {
  border-color: var(--border);
  background: var(--card-bg);
  box-shadow: var(--shadow-soft);
}

body.light .landing-step-number {
  background: var(--control-bg);
  color: var(--accent);
}

body.light .landing-status,
body.light .hero-chip,
body.light .group-count,
body.light .status-strip,
body.light .favorite-chip,
body.light .trust-detail-rows,
body.light .sync-diagnostics,
body.light .clock,
body.light .sync-choice-card,
body.light .sort-option,
body.light .tile,
body.light .empty-state,
body.light .toast,
body.light .pwa-install-hint {
  border-color: var(--card-border);
  background: var(--card-bg);
  box-shadow: var(--shadow-soft);
}

body.light .status-strip {
  border-color: color-mix(in srgb, var(--border) 70%, transparent);
  background: color-mix(in srgb, var(--card-bg) 78%, transparent);
  box-shadow: none;
}

body.light .status-strip-action-group {
  border-color: transparent;
  background: transparent;
}

body.light .status-strip-connected-actions {
  border-left-color: color-mix(in srgb, var(--border) 78%, transparent);
}

body.light .strip-data-item + .strip-data-item::before {
  color: color-mix(in srgb, var(--text-dim) 55%, transparent);
}

body.light .status-strip-summary,
body.light .strip-data-item {
  color: var(--text-dim);
}

body.light .clock {
  border: 0;
  background: transparent;
  box-shadow: none;
}

body.light .trust-state {
  border-color: rgba(97, 121, 165, 0.15) !important;
  background: rgba(255, 255, 255, 0.6) !important;
  box-shadow: none !important;
  border-radius: 12px !important;
}

body.light .trust-state.off {
  background: rgba(15, 23, 42, 0.04) !important;
  border-color: rgba(15, 23, 42, 0.08) !important;
  color: var(--text-dim) !important;
}

body.light .trust-state.ok {
  background: rgba(34, 197, 94, 0.07) !important;
  border-color: rgba(34, 197, 94, 0.16) !important;
  color: #166534 !important;
}

body.light .trust-state.warn {
  background: rgba(245, 158, 11, 0.07) !important;
  border-color: rgba(245, 158, 11, 0.16) !important;
  color: #9a3412 !important;
}

body.light .app-brand-subtitle,
body.light .hero-text,
body.light .landing-text,
body.light .landing-section-head p,
body.light .setting-hint,
body.light .modal-help,
body.light .sync-choice-text,
body.light .sync-diag-note,
body.light .favorite-chip-meta,
body.light .step-meta,
body.light .status-strip-summary,
body.light .strip-data-item {
  color: var(--text-dim);
}

body.light .hero-chip span,
body.light .group-kicker,
body.light .sync-diag-label,
body.light .sync-choice-label,
body.light .drawer-section-title,
body.light .step-caption {
  color: color-mix(in srgb, var(--text-dim) 86%, var(--text));
}

body.light .app-brand-subtitle {
  font-weight: 600;
}

body.light .hero-chip strong,
body.light .group-title,
body.light .drawer-title {
  color: var(--text);
}

body.light .favorite-chip-icon {
  background: var(--favorite-chip-icon-bg);
  color: var(--favorite-chip-icon-color);
}

body.light .favorite-chip {
  border-color: var(--favorite-chip-border);
  background: var(--favorite-chip-bg);
  box-shadow:
    var(--shadow-soft),
    inset 0 1px 0 rgba(255, 255, 255, 0.78);
}

body.light .favorite-chip:hover {
  border-color: var(--favorite-chip-hover-border);
  background: var(--favorite-chip-hover-bg);
  box-shadow:
    var(--shadow-soft),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

body.light .search-wrap {
  position: relative;
}

body.light .search-input,
body.light .setting-select,
body.light .modal input:not([type='checkbox']),
body.light .modal select {
  background: var(--field-bg);
  border-color: var(--field-border);
  box-shadow: var(--field-shadow);
}

body.light .search-input:focus,
body.light .modal input:not([type='checkbox']):focus,
body.light .modal select:focus {
  background: var(--field-bg-focus);
  border-color: var(--field-border-focus);
  box-shadow: var(--field-shadow-focus);
}

.site-edit-modal input.error:not([type='checkbox']),
.site-edit-modal textarea.error,
.site-edit-modal select.error,
.site-edit-modal input.error:not([type='checkbox']):focus,
.site-edit-modal textarea.error:focus,
.site-edit-modal select.error:focus {
  border-color: var(--field-error-border);
  background: var(--field-error-bg);
  box-shadow: 0 0 0 3px var(--field-error-ring), 0 12px 28px rgba(0, 0, 0, 0.14);
}

body.light .search-input::placeholder,
body.light .modal input:not([type='checkbox'])::placeholder {
  color: var(--field-placeholder);
}

body.light .search-helper {
  color: var(--text-dim);
  opacity: 0.7;
}

body.light .search-submit-btn {
  background: var(--field-bg);
  border-color: var(--field-border);
  box-shadow: var(--field-shadow);
}

body.light .search-submit-btn:hover:not(:disabled) {
  background: var(--field-bg-focus);
  border-color: var(--field-border-focus);
  box-shadow: var(--field-shadow-focus);
}

body.light .modal option {
  background: var(--surface-strong);
  color: var(--text);
}

body.light .setting-select option {
  background: var(--surface-strong);
  color: var(--text);
}

body.light .icon-btn,
body.light .step-btn,
body.light .landing-btn-secondary,
body.light .group-title-edit,
body.light .group-tab-edit,
body.light .group-tab-pin,
body.light .group-tab-handle,
body.light .group-pin-toggle,
body.light .section-toggle-btn,
body.light .tab-add-btn,
body.light .group-color-option,
body.light .group-icon-option,
body.light .tile-action-btn,
body.light .btn-cancel {
  border-color: var(--control-border);
  background: var(--control-bg);
  color: var(--text);
  box-shadow: var(--control-shadow);
}

body.light .icon-btn:hover,
body.light .step-btn:hover,
body.light .landing-btn-secondary:hover,
body.light .group-title-edit:hover,
body.light .group-tab-edit:hover,
body.light .group-tab-pin:hover,
body.light .group-tab-handle:hover,
body.light .group-pin-toggle:hover,
body.light .section-toggle-btn:hover,
body.light .tab-add-btn:hover,
body.light .group-color-option:hover,
body.light .group-icon-option:hover,
body.light .tile-action-btn:hover,
body.light .btn-cancel:hover,
body.light .menu-item:hover {
  border-color: var(--border-strong);
  background: var(--control-hover);
  box-shadow: var(--control-shadow);
}

body.light .icon-btn:active,
body.light .step-btn:active,
body.light .group-title-edit:active,
body.light .group-tab-edit:active,
body.light .group-tab-pin:active,
body.light .group-tab-handle:active,
body.light .group-pin-toggle:active,
body.light .tile-action-btn:active,
body.light .btn-cancel:active {
  background: var(--control-active);
}

body.light .icon-btn.active {
  box-shadow:
    0 12px 22px color-mix(in srgb, var(--accent) 26%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

body.light .btn-secondary-soft,
body.light .toast-action {
  background: var(--surface-soft);
  color: var(--accent);
}

body.light .btn-danger-soft {
  background: rgba(255, 107, 107, 0.1);
  color: #a33a3a;
}

body.light .landing-btn {
  box-shadow:
    0 14px 26px color-mix(in srgb, var(--accent) 18%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

body.light .landing-btn:hover {
  box-shadow:
    0 18px 30px color-mix(in srgb, var(--accent) 22%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

body.light .tab {
  color: var(--text-dim);
  background:
    linear-gradient(180deg, var(--group-tint, var(--chip-bg)), var(--chip-bg)),
    var(--surface);
  border-color: var(--border);
  box-shadow:
    var(--shadow-soft),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

body.light .tab.active {
  color: var(--text);
  border-color: var(--group-active-border, rgba(84, 117, 178, 0.42));
  box-shadow:
    0 10px 18px color-mix(in srgb, var(--accent) 14%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

body.light .tab-count {
  color: currentColor;
  background: var(--group-count-bg, rgba(89, 166, 255, 0.12));
}

body.light .tab.active .tab-count {
  background: var(--group-count-active-bg, rgba(255, 255, 255, 0.62));
}

body.light .tab-pinned-badge {
  color: var(--group-accent, var(--accent));
  opacity: 0.9;
}

body.light .group-tab-pin.active {
  border-color: var(--group-active-border, rgba(84, 117, 178, 0.42));
  background: var(--control-active);
  box-shadow:
    0 10px 18px color-mix(in srgb, var(--accent) 12%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

body.light .group-pin-toggle.active {
  border-color: var(--group-active-border, rgba(84, 117, 178, 0.42));
  background: var(--control-active);
  box-shadow:
    0 10px 18px color-mix(in srgb, var(--accent) 12%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

body.light .group-title-icon {
  background:
    linear-gradient(180deg, var(--group-tint, var(--chip-bg)), var(--chip-bg)),
    var(--surface);
}

body.light .toggle {
  border-color: var(--border);
  background: color-mix(in srgb, var(--surface-soft) 76%, #d5deeb 24%);
  box-shadow: inset 0 1px 2px color-mix(in srgb, var(--text-dim) 12%, transparent);
}

body.light .toggle.on {
  border-color: color-mix(in srgb, var(--accent) 54%, transparent);
  background: linear-gradient(135deg, var(--accent), var(--accent-3));
  box-shadow: inset 0 1px 2px color-mix(in srgb, var(--text-dim) 10%, transparent);
}

body.light .toggle::after {
  background: #fff;
  box-shadow: 0 3px 8px color-mix(in srgb, var(--text-dim) 22%, transparent);
}

body.light .step-meta.is-adaptive,
body.light .layout-safety-note.is-adaptive {
  color: #275487;
}

body.light .sync-choice-card.cloud {
  background:
    linear-gradient(135deg, var(--ambient-1), var(--ambient-2)),
    var(--panel-bg);
}

body.light .tile {
  border-color: var(--card-border);
  background: var(--card-bg);
}

body.light .tile.favorite {
  box-shadow:
    0 0 0 1px var(--favorite-chip-border),
    var(--shadow-soft);
}

body.light .tile:hover {
  background: var(--card-hover);
  box-shadow: var(--shadow-card);
}

body.light .favicon {
  background: var(--favicon-bg);
  color: var(--favicon-color);
}

body.light .tile-action-btn.active {
  color: var(--favorite-chip-icon-color);
  background: var(--favorite-chip-icon-bg);
}

body.light .settings-drawer,
body.light .menu-drawer {
  box-shadow: var(--drawer-shadow);
}

body.light .drawer-head {
  background: var(--drawer-head-bg);
  border-bottom-color: var(--border);
}

body.light .drawer-section {
  border-bottom-color: var(--border);
}

body.light .drawer-section + .drawer-section {
  background: var(--drawer-section-alt-bg);
}

body.light .drawer-backdrop,
body.light .overlay {
  background: var(--overlay-bg);
  backdrop-filter: blur(6px);
}

body.light .drawer-close {
  border-color: var(--control-border);
  background: var(--control-bg);
}

body.light .setting-row {
  border-bottom-color: var(--border);
}

body.light .setting-label {
  color: color-mix(in srgb, var(--text) 82%, var(--text-dim));
}

body.light .menu-item {
  color: var(--text);
}

body.light .menu-item:hover {
  border-color: var(--control-border);
  background: var(--control-hover);
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 980px) {
  .app-header,
  .landing-hero,
  .sync-panel,
  .topbar,
  .workspace-head {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .landing-hero {
    min-height: auto;
    gap: clamp(20px, 4vw, 32px);
  }

  .landing-visual {
    width: 100%;
    min-height: 280px;
  }

  .landing-mark {
    width: min(100%, 460px);
  }

  .app-header-actions {
    justify-content: flex-start;
  }

  .status-strip {
    flex-wrap: wrap;
  }

  .status-strip-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .landing-values {
    grid-template-columns: 1fr;
  }

  .landing-feature-grid,
  .landing-steps,
  .landing-usecases,
  .landing-local-grid,
  .landing-split-grid,
  .landing-faq-grid {
    grid-template-columns: 1fr;
  }

  .landing-value p,
  .landing-positioning p {
    max-width: 100%;
  }

  .hero-stats,
  .workspace-head-right {
    justify-content: flex-start;
  }

  .settings-drawer {
    width: min(340px, 92vw);
  }
}

@media (max-width: 720px) {
  .landing-shell,
  .page-shell {
    width: min(1240px, calc(100% - 20px));
    padding-top: 16px;
  }

  .landing-hero,
  .workspace-card,
  .modal {
    padding: 18px;
    border-radius: 24px;
  }

  .app-brand {
    align-items: flex-start;
  }



  .tabsly-logo {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  .app-brand-subtitle {
    font-size: 12px;
  }

  .group-title-row {
    align-items: flex-start;
  }

  .group-color-options {
    grid-template-columns: 1fr 1fr;
  }

  .landing-hero h1 {
    max-width: 18ch;
    font-size: clamp(30px, 7.5vw, 52px);
  }

  .sync-choice-grid,
  .sync-diagnostics {
    grid-template-columns: 1fr;
  }

  .grid {
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  }

  .toolbar-right,
  .sync-actions {
    width: 100%;
  }

  .app-header-actions {
    flex-wrap: nowrap;
  }

  .app-header-actions .icon-btn {
    flex: 1 1 auto;
    min-width: 0;
  }

  .status-strip-action-buttons .icon-btn {
    flex: 1 1 0;
    min-width: 0;
  }

  .settings-drawer {
    width: 100%;
  }

  .settings-tabs {
    padding-inline: 14px;
    gap: 6px;
  }

  .settings-drawer .setting-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .settings-drawer .setting-control {
    width: 100%;
    justify-content: flex-end;
  }

  .settings-drawer .step-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
  }

  .settings-drawer .toggle {
    flex: 0 0 44px;
  }

  #settings-section-view .setting-row:has(.step-btn) {
    grid-template-columns: 40px minmax(104px, 1fr) 40px;
    gap: 8px;
  }

  #settings-section-view .setting-row:has(.step-btn) .setting-copy,
  #settings-section-view .setting-row:has(.step-btn) > .setting-label {
    grid-column: 1 / -1;
  }

  #settings-section-view .setting-row:has(.step-btn) .step-btn {
    width: 40px;
    min-width: 40px;
    height: 40px;
  }

  #settings-section-view .setting-row:has(.step-btn) .step-btn:first-of-type {
    grid-column: 1;
  }

  #settings-section-view .setting-row:has(.step-btn) .step-readout {
    grid-column: 2;
  }

  #settings-section-view .setting-row:has(.step-btn) .step-btn:last-of-type {
    grid-column: 3;
  }

  #settings-section-view .setting-row:has(.step-btn) .step-readout {
    justify-self: stretch;
  }

  .icon-btn {
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
  }

  .bookmark-import-stats {
    grid-template-columns: 1fr;
  }

  .search-engine-custom-head,
  .search-engine-card,
  .search-engine-card-main {
    flex-direction: column;
  }

  .search-engine-card-actions {
    width: 100%;
  }

  .search-engine-card-actions .icon-btn {
    flex: 1 1 calc(50% - 4px);
  }

  .search-control {
    gap: 8px;
  }

  .search-submit-btn {
    min-height: 50px;
    padding-inline: 14px;
  }
}

@media (max-width: 560px) {
  :root {
    --gap: 12px;
  }

  .landing-shell,
  .page-shell {
    width: min(1240px, calc(100% - 14px));
  }

  .landing-hero {
    min-height: auto;
    gap: 12px;
    padding: 20px;
  }

  .landing-lead {
    display: none;
  }

  .landing-text {
    margin-top: 10px;
  }

  .landing-actions {
    margin-top: 16px;
    gap: 8px;
  }

  .landing-hero .landing-actions .landing-btn {
    width: 100%;
  }

  .landing-status {
    max-width: 100%;
    margin-top: 12px;
    min-height: 32px;
    padding: 7px 12px;
    font-size: 11px;
  }

  .landing-hero h1 {
    max-width: 20ch;
    font-size: clamp(28px, 9vw, 40px);
  }

  .workspace-card {
    padding: 16px;
  }

  .runtime-loading {
    width: 100%;
    min-height: 40px;
    margin-top: 6px;
    padding: 8px 10px;
    border-radius: 12px;
    font-size: 11px;
  }

  .open-all-btn {
    width: 100%;
    justify-content: center;
  }

  .tab-shell {
    width: max-content;
  }

  .status-strip-primary {
    align-items: flex-start;
  }

  .tile {
    gap: 0;
    padding: 0;
  }

  .app-header-actions {
    flex-wrap: wrap;
  }

  .metadata-fetch-row {
    flex-direction: column;
    gap: 0;
  }

  .metadata-fetch-btn {
    width: 100%;
    justify-content: center;
  }

  .sync-choice-actions,
  .modal-btns {
    flex-direction: column;
  }

  .sync-choice-actions .btn,
  .modal-btns .btn {
    min-width: 0;
  }

  .site-edit-modal {
    width: min(100%, calc(100vw - 20px));
  }

  .site-edit-modal .modal-body {
    padding: 12px;
    border-radius: 16px;
  }

  .site-edit-modal .modal-field {
    gap: 6px;
  }

  .site-url-suggestion-item {
    min-height: 48px;
    padding: 9px 10px;
  }

  .tile-footer {
    flex-wrap: wrap;
    gap: 4px;
  }

  .tile-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    gap: 3px;
  }

  .tile-action-btn {
    width: 24px;
    height: 24px;
    font-size: 11px;
    border-radius: 10px;
  }

  .topbar {
    gap: 10px;
  }

  .toolbar-right {
    gap: 6px;
  }

  .icon-btn {
    padding: 11px 12px;
    font-size: 11px;
  }

  .landing-visual {
    min-height: 150px;
  }

  .landing-mark {
    width: 100%;
    padding: 12px 16px;
    border-radius: 20px;
  }

  .runtime-brand-name {
    font-size: 15px;
  }

  .group-color-options,
  .group-icon-options {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  /* Hide ★ action on very narrow tiles; favoriting available via edit modal / long-press */
  .tile-actions .tile-action-btn:first-child {
    display: none;
  }

  .home-section-header {
    align-items: flex-start;
    gap: 8px;
  }

  .home-section-title-row {
    flex: 1 1 100%;
    width: 100%;
    flex-wrap: wrap;
    gap: 4px 8px;
  }

  .home-section-stats {
    flex: 1 1 100%;
    flex-wrap: wrap;
    row-gap: 2px;
  }

  .home-groups-grid {
    grid-template-columns: repeat(var(--group-card-cols, 2), minmax(0, 1fr));
    gap: 7px;
    width: 100%;
    max-width: 100%;
  }

  .group-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 116px;
    padding: 8px;
    border-radius: 13px;
  }

  .group-card-head {
    gap: 6px;
    min-width: 0;
  }

  .group-card-main {
    min-width: 0;
    gap: 6px;
  }

  .group-card-marker {
    width: 8px;
    height: 8px;
    margin-top: 3px;
  }

  .group-card-name-wrap {
    min-width: 0;
  }

  .group-card-name {
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    -webkit-line-clamp: 3;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  .group-card-count {
    font-size: 10px;
    min-width: 24px;
    height: 20px;
    padding: 0 7px;
  }

  .group-card-previews {
    gap: 4px;
    padding: 4px;
    border-radius: 10px;
    min-height: calc(30px * 2 + 4px + 8px);
  }

  .group-card-preview-item {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }

  .group-card-preview-monogram {
    font-size: 16px;
  }

  .group-card-preview-more {
    font-size: 12px;
    min-width: 30px;
    width: auto;
    padding: 0 4px;
  }

  .group-card-footer {
    padding: 7px 8px;
  }

  .group-card-footer-meta {
    font-size: 11px;
  }

  .group-favorite-chip {
    width: 100%;
    max-width: 100%;
    padding: 6px 7px;
  }
}

/* Runtime mobile compact preset: reduce service chrome before reducing bookmark density. */
@media (max-width: 720px) {
  .page-shell {
    padding-top: 10px;
  }

  .workspace-card {
    padding: 12px;
    border-radius: 20px;
  }

  .clock {
    margin-top: 0;
  }

  .clock.visible {
    gap: 4px;
  }

  .clock-time {
    font-size: 11px;
  }

  .clock-date {
    font-size: 10px;
  }

  .app-header {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
  }

  .app-brand {
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
  }

  .runtime-brand {
    gap: 8px;
  }

  .tabsly-logo {
    width: 44px;
    height: 38px;
    min-width: 44px;
  }

  .tabsly-logo__folder--back {
    top: 6px;
    left: 9px;
    width: 31px;
    height: 22px;
  }

  .tabsly-logo__folder--back::before {
    width: 14px;
    height: 8px;
  }

  .tabsly-logo__folder--front {
    top: 13px;
    left: 2px;
    width: 35px;
    height: 23px;
  }

  .tabsly-logo__folder--front::before {
    width: 17px;
    height: 9px;
  }

  .tabsly-logo__line:first-child {
    top: 7px;
    width: 19px;
  }

  .tabsly-logo__line:last-child {
    top: 14px;
    width: 14px;
  }

  .runtime-brand-name {
    font-size: 16px;
  }

  .runtime-brand-subtitle {
    display: none;
  }

  .app-brand-copy {
    display: none;
  }

  .app-brand .clock {
    display: none !important;
  }

  .app-header-actions {
    width: auto;
    max-width: calc(100% - 112px);
    flex: 0 1 auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 4px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .app-header-actions .icon-btn {
    flex: 0 0 auto;
    min-height: 28px;
    padding: 6px 6px;
    border-radius: 10px;
    font-size: 10px;
  }

  .app-header-actions #btn-add-preset,
  .app-header-actions #btn-add-site,
  .app-header-actions #btn-settings,
  .app-header-actions #btn-more,
  .app-header-actions #btn-actions {
    font-size: 0;
  }

  .app-header-actions #btn-add-preset::before,
  .app-header-actions #btn-add-site::before,
  .app-header-actions #btn-settings::before,
  .app-header-actions #btn-more::before,
  .app-header-actions #btn-actions::before {
    font-size: 10px;
    line-height: 1;
  }

  .app-header-actions #btn-add-preset::before {
    content: 'Подборки';
  }

  .app-header-actions #btn-add-site::before {
    content: '+ Сайт';
  }

  .app-header-actions #btn-settings::before {
    content: 'Настр.';
  }

  .app-header-actions #btn-more::before,
  .app-header-actions #btn-actions::before {
    content: 'Данные';
  }

  .app-header-actions::-webkit-scrollbar {
    display: none;
  }

  .status-strip {
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    padding: 6px 7px;
    border-radius: 13px;
    flex-wrap: wrap;
    overflow: visible;
  }

  .status-strip-main {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    gap: 2px;
  }

  .status-strip-primary {
    width: 100%;
    align-items: stretch;
    gap: 3px;
    flex-direction: column;
    flex-wrap: nowrap;
  }

  .trust-state {
    width: 100%;
    max-width: 100%;
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
    overflow: visible;
    min-height: 26px;
    padding: 5px 8px;
    font-size: 10px;
    line-height: 1.25;
    text-overflow: clip;
    white-space: normal;
  }

  .trust-state-file-name {
    width: 100%;
    overflow: visible;
    overflow-wrap: anywhere;
    text-overflow: clip;
    white-space: normal;
    word-break: normal;
  }

  .status-strip-summary {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .status-strip-actions {
    display: flex;
    flex: 1 1 100%;
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 4px;
  }

  .status-strip-secondary {
    gap: 3px 8px;
    max-width: 100%;
    overflow: visible;
    flex-wrap: wrap;
  }

  .strip-data-item {
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .status-strip-action-group {
    flex: 1 1 100%;
    min-width: 0;
    gap: 6px;
  }

  .status-strip-action-buttons {
    width: auto;
    flex: 1 1 auto;
    min-width: 0;
  }

  .status-strip-file-setup {
    flex-wrap: wrap;
    padding-left: 0;
  }

  .status-strip-action-group .icon-btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 28px;
    padding: 6px 8px;
    font-size: 10px;
  }

  .status-strip-actions > .status-strip-action-buttons .icon-btn {
    min-height: 32px;
  }

  .status-strip-connected-actions {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }

  .topbar {
    gap: 8px;
    margin-bottom: 6px;
  }

  .search-input {
    min-height: 42px;
    padding: 10px 13px;
    border-radius: 15px;
    font-size: 14px;
  }

  .search-submit-btn {
    min-height: 42px;
    padding-inline: 12px;
    border-radius: 15px;
  }

  .search-submit-btn span {
    display: none;
  }

  .favorites-panel {
    margin-bottom: 4px;
  }

  .favorites-strip {
    gap: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    padding: 2px 1px;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -ms-overflow-style: none;
    max-height: none !important;
  }

  .favorites-strip::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  #favorites-toggle-row {
    margin-top: 7px;
  }

  .favorite-chip {
    flex: 0 0 auto;
    min-height: 30px;
    padding: 5px 8px 5px 5px;
    border-radius: 12px;
  }

  .favorite-chip-icon {
    width: 22px;
    height: 22px;
    border-radius: 8px;
    font-size: 10px;
  }

  .favorite-chip-name {
    font-size: 10px;
    line-height: 1.25;
  }

  .favorite-chip-meta {
    display: none;
  }

  .tabs-frame {
    overflow: hidden;
    gap: 5px;
    margin-bottom: 7px;
    padding: 6px;
    border-radius: 15px;
  }

  .tabs-bar {
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 1px 1px 3px;
    scroll-snap-type: x proximity;
  }

  .groups-section {
    flex: 0 0 auto;
    min-width: max-content;
  }

  .groups-section-title {
    display: none;
  }

  .groups-section-list {
    flex-wrap: nowrap;
    gap: 8px;
  }

  .tab {
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 15px;
    font-size: 11px;
    scroll-snap-align: start;
  }

  .tab-count {
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
  }

  .section-toggle-row {
    margin-top: 0;
  }

  .section-toggle-btn {
    padding: 6px 10px;
    font-size: 11px;
  }

  .workspace-head {
    flex-direction: row;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 8px;
  }

  .workspace-head-right {
    justify-content: flex-end;
    gap: 6px;
  }

  .group-kicker {
    margin-bottom: 4px;
    font-size: 9px;
  }

  .group-title-row {
    align-items: center;
    gap: 7px;
  }

  .group-title-icon {
    width: 26px;
    height: 26px;
    border-radius: 10px;
  }

  .group-title-icon-mark {
    width: 15px;
    height: 15px;
  }

  .group-title {
    font-size: clamp(23px, 7vw, 30px);
  }

  .group-title-edit {
    width: 30px;
    height: 30px;
  }

  .group-count,
  .open-all-btn {
    min-height: 32px;
    padding: 7px 10px;
    font-size: 10px;
  }

  .group-edit-mode-btn {
    min-height: 32px;
    padding: 7px 10px;
    font-size: 0;
  }

  .group-edit-mode-btn::before {
    content: 'Правка';
    font-size: 10px;
    line-height: 1;
  }

  body.edit-mode .group-edit-mode-btn::before {
    content: 'Готово';
  }

  .grid {
    gap: 10px;
  }

  .tile,
  .empty-state {
    border-radius: 18px;
  }

  .tile {
    --tile-card-height: 132px;
    --tile-caption-height: 46px;
    gap: 0;
    padding: 0;
  }

  .tile-visual {
    height: calc(var(--tile-card-height) - var(--tile-caption-height));
    flex-basis: calc(var(--tile-card-height) - var(--tile-caption-height));
  }

  .tile-caption {
    height: var(--tile-caption-height);
    flex-basis: var(--tile-caption-height);
    gap: 7px;
    padding: 0 10px;
  }

  .tile-caption-favicon {
    flex-basis: 21px;
    width: 21px;
    height: 21px;
    border-radius: 7px;
    font-size: 9px;
  }

  .tile-caption-name {
    font-size: 10px;
  }

  .tile-visual-logo {
    width: min(54px, 48%);
    border-radius: 18px;
    font-size: 24px;
  }

  .tile-body {
    gap: 7px;
    padding: 10px 11px 11px;
  }

  .tile-body-preview {
    height: 58px;
    flex-basis: 58px;
  }

  .tile-body-fallback {
    gap: 9px;
    padding: 10px;
  }

  .tile.no-preview {
    min-height: 0;
  }

  .tile-fallback-identity {
    align-items: flex-start;
    gap: 7px;
  }

  .tile-fallback-favicon {
    width: 30px;
    height: 30px;
    border-radius: 11px;
  }

  .tile-fallback-title {
    font-size: 10px;
  }

  .tile-fallback-host,
  .tile-description {
    font-size: 9px;
  }

  .favicon {
    width: calc(var(--fav-size) + 14px);
    height: calc(var(--fav-size) + 14px);
    border-radius: 15px;
  }

  .tile-favorite-badge {
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    font-size: 10px;
  }

  .tile-name {
    display: block;
    overflow: hidden;
    line-height: 1.28;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tile-host {
    margin-top: 4px;
    overflow: hidden;
    font-size: 10px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
    word-break: normal;
  }

  .tile-footer {
    margin-top: 0;
    gap: 6px;
    font-size: 9px;
    opacity: 0.66;
  }

  .tile-footer > span:last-child {
    display: none;
  }

  .tile-label::before {
    width: 5px;
    height: 5px;
  }

  .tile-add {
    min-height: min(var(--tile-min), 124px);
    border-style: solid;
    border-color: color-mix(in srgb, var(--accent) 36%, var(--border));
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 76%, transparent), transparent 72%),
      var(--surface-soft);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), var(--shadow-soft);
  }

  .tile-add .plus {
    color: var(--accent);
    font-size: 34px;
    font-weight: 500;
  }

  .tile-add .add-label {
    margin-top: 6px;
    color: var(--text);
    font-size: 12px;
  }
}

@media (max-width: 380px) {
  .app-header-actions .icon-btn {
    padding-inline: 5px;
  }

  .group-count {
    display: none;
  }
}

.qr-modal {
  max-width: 360px;
}

.qr-modal-code {
  display: flex;
  justify-content: center;
  padding: 10px;
  background: #fff;
  border-radius: 10px;
}

.qr-modal-code canvas {
  width: 210px;
  height: 210px;
  image-rendering: pixelated;
}

.qr-modal-url {
  font-size: 12px;
  opacity: 0.8;
  word-break: break-all;
}

/* ============================================================
   Preset Catalog Styles (TB-063)
   ============================================================ */

#btn-add-preset {
  display: inline-flex;
}

.presets-modal {
  width: min(820px, 100%) !important;
}

.presets-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
  line-height: 1.5;
}

.presets-field-label {
  display: block;
  font-weight: 500;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.presets-select {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23888' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

.presets-list-field {
  margin-top: 16px;
}

.presets-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.08);
}

.presets-item-icon {
  font-size: 22px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  line-height: 1;
  flex: 0 0 32px;
}

.presets-selected-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.presets-selected-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.presets-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  gap: 12px;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.presets-item:hover {
  border-color: var(--border-strong);
  background: var(--control-hover);
  transform: translateY(-1px);
}

.presets-item-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1 1 auto;
  min-width: 0;
}

.presets-item-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.presets-item-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.presets-item-meta {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-dim);
}

.presets-item-action {
  flex: 0 0 128px;
  width: 128px;
  min-width: 128px;
  height: 40px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  text-align: center;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
}

.presets-selected-info {
  background: rgba(89, 166, 255, 0.06);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border));
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 16px;
}

.presets-selected-info span {
  display: block;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.presets-selected-info p {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
  line-height: 1.4;
}

.presets-sites-field {
  margin-top: 12px;
}

.presets-sites-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  padding: 12px 10px 22px;
  scroll-padding-top: 10px;
  scroll-padding-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.08);
}

.presets-site-url {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 6px;
  font-weight: normal;
}

.presets-empty-msg {
  padding: 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
}

.presets-sites-checkboxes .preset-site-check {
  margin-top: 0;
  min-height: 38px;
  padding: 4px 0;
  display: grid;
  grid-template-columns: 28px 22px minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 10px;
  overflow: visible;
}
.preset-site-check input[type="checkbox"] {
  justify-self: center;
}
.presets-sites-checkboxes .preset-site-check.is-disabled {
  opacity: 0.62;
}

.site-icon {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2, rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  position: relative;
  overflow: hidden;
}
.preset-site-check .preset-site-icon-slot {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow: hidden;
  line-height: 1;
}

.site-icon-img {
  width: 16px;
  height: 16px;
  max-width: 16px;
  max-height: 16px;
  object-fit: contain;
  display: block;
  border: 0;
  background: transparent;
  opacity: 0.98;
  margin: auto;
  flex: 0 0 auto;
}
.preset-site-favicon {
  width: 16px;
  height: 16px;
  max-width: 16px;
  max-height: 16px;
  display: block;
  object-fit: contain;
  flex: 0 0 auto;
  margin: auto;
}

.preset-site-icon-slot .preset-site-fallback {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-dim);
  opacity: 0.8;
  background: transparent;
  text-align: center;
  padding: 0;
  margin: 0;
  transform: none;
  vertical-align: middle;
}
.site-icon.is-fallback .site-icon-img {
  display: none;
}
.site-icon.is-fallback .preset-site-fallback {
  display: inline-flex;
}
.preset-site-check .preset-site-info {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  gap: 0;
  flex: 1 1 auto;
}
.preset-site-check .preset-site-title {
  font-weight: 700;
  flex: 0 0 auto;
  min-width: 0;
  max-width: min(45%, 220px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preset-site-check .presets-site-url {
  display: inline-flex;
  align-items: baseline;
  color: var(--text-dim);
  margin-left: 0;
  font-weight: 500;
  font-size: 11px;
  line-height: 1.2;
  flex: 1 1 auto;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preset-site-check .presets-site-url::before {
  content: '·';
  flex: 0 0 auto;
  margin: 0 6px;
  color: var(--text-dim);
  opacity: 0.75;
}
.preset-site-status:empty {
  display: none;
}
.presets-sites-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.presets-selected-count {
  font-size: 12px;
  color: var(--text-dim);
}
.presets-duplicates-note {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--text-dim);
}
.presets-duplicate-badge {
  display: inline-flex;
  margin-left: 8px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.preset-site-status {
  display: inline-flex;
  justify-content: flex-end;
  min-width: 62px;
  margin-left: 6px;
}
.presets-modal .modal-btns .btn-cancel {
  background: color-mix(in srgb, var(--surface) 90%, var(--text-dim) 10%);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

@media (max-width: 560px) {
  .preset-site-check .preset-site-info {
    flex-wrap: wrap;
    align-items: flex-start;
    white-space: normal;
    row-gap: 1px;
  }

  .preset-site-check .preset-site-title {
    max-width: 100%;
  }

  .preset-site-check .presets-site-url {
    flex-basis: 100%;
    max-width: 100%;
  }

  .preset-site-check .presets-site-url::before {
    content: none;
    margin: 0;
  }

  .preset-site-status {
    min-width: 0;
    margin-left: 0;
  }
}

/* Password visibility toggle styling */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrapper input {
  padding-right: 48px !important;
  width: 100%;
}

.password-toggle-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  opacity: 0.7;
  border-radius: 50%;
  transition: opacity 0.16s ease, background-color 0.16s ease, color 0.16s ease;
  width: 40px;
  height: 40px;
  z-index: 2;
}

.password-toggle-btn:hover {
  opacity: 1;
  color: var(--text);
  background-color: var(--control-hover);
}

.password-toggle-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  opacity: 1;
  color: var(--text);
  background-color: var(--control-hover);
}

.password-toggle-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}

.connected-file-fallback {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--border));
  background: color-mix(in srgb, var(--danger) 5%, rgba(255, 255, 255, 0.03));
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-sizing: border-box;
  max-width: 100%;
}

.connected-file-fallback p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: color-mix(in srgb, var(--danger) 85%, var(--text));
opacity: 0.8;
  background: transparent;
  text-align: center;
  padding: 0;
  margin: 0;
  transform: none;
  vertical-align: middle;
}
.site-icon.is-fallback .site-icon-img {
  display: none;
}
.site-icon.is-fallback .preset-site-fallback {
  display: inline-flex;
}
.preset-site-check .preset-site-info {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  gap: 0;
  flex: 1 1 auto;
}
.preset-site-check .preset-site-title {
  font-weight: 700;
  flex: 0 0 auto;
  min-width: 0;
  max-width: min(45%, 220px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preset-site-check .presets-site-url {
  display: inline-flex;
  align-items: baseline;
  color: var(--text-dim);
  margin-left: 0;
  font-weight: 500;
  font-size: 11px;
  line-height: 1.2;
  flex: 1 1 auto;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preset-site-check .presets-site-url::before {
  content: '·';
  flex: 0 0 auto;
  margin: 0 6px;
  color: var(--text-dim);
  opacity: 0.75;
}
.preset-site-status:empty {
  display: none;
}
.presets-sites-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.presets-selected-count {
  font-size: 12px;
  color: var(--text-dim);
}
.presets-duplicates-note {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--text-dim);
}
.presets-duplicate-badge {
  display: inline-flex;
  margin-left: 8px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.preset-site-status {
  display: inline-flex;
  justify-content: flex-end;
  min-width: 62px;
  margin-left: 6px;
}
.presets-modal .modal-btns .btn-cancel {
  background: color-mix(in srgb, var(--surface) 90%, var(--text-dim) 10%);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

@media (max-width: 560px) {
  .preset-site-check .preset-site-info {
    flex-wrap: wrap;
    align-items: flex-start;
    white-space: normal;
    row-gap: 1px;
  }

  .preset-site-check .preset-site-title {
    max-width: 100%;
  }

  .preset-site-check .presets-site-url {
    flex-basis: 100%;
    max-width: 100%;
  }

  .preset-site-check .presets-site-url::before {
    content: none;
    margin: 0;
  }

  .preset-site-status {
    min-width: 0;
    margin-left: 0;
  }
}

/* Password visibility toggle styling */
.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.password-input-wrapper input {
  padding-right: 48px !important;
  width: 100%;
}

.password-toggle-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  opacity: 0.7;
  border-radius: 50%;
  transition: opacity 0.16s ease, background-color 0.16s ease, color 0.16s ease;
  width: 40px;
  height: 40px;
  z-index: 2;
}

.password-toggle-btn:hover {
  opacity: 1;
  color: var(--text);
  background-color: var(--control-hover);
}

.password-toggle-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  opacity: 1;
  color: var(--text);
  background-color: var(--control-hover);
}

.password-toggle-btn svg {
  width: 20px;
  height: 20px;
  display: block;
}

.connected-file-fallback {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--danger) 30%, var(--border));
  background: color-mix(in srgb, var(--danger) 5%, rgba(255, 255, 255, 0.03));
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-sizing: border-box;
  max-width: 100%;
}

.connected-file-fallback p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: color-mix(in srgb, var(--danger) 85%, var(--text));
}

.connected-file-fallback button {
  width: 100%;
  justify-content: center;
}

/* TB-179 runtime redesign.
 * Derived tokens below use the TB-171 Amethyst palette only:
 * #07050F/#0B0718 backgrounds, #1A1132 surfaces, #9370DB/#A78BFA accents,
 * #22D3EE secondary accent, #F7F3FF/#D4C4EA text, plus opacity variants.
 */
:root {
  --runtime-shell-max: 1600px;
  --runtime-content-max: 1600px; /* Widened desktop layout */
  --runtime-header-bg: var(--drawer-head-bg);
  --runtime-panel-bg: var(--card-bg);
  --runtime-panel-border: var(--border);
  --runtime-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
  --runtime-glow: 0 22px 54px rgba(0, 0, 0, 0.34), 0 0 34px color-mix(in srgb, var(--accent) 8%, transparent);
  --runtime-amber-bg: rgba(255, 193, 92, 0.06);
  --runtime-amber-border: rgba(255, 193, 92, 0.16);
  --runtime-amber-text: #ffd98a;
}

body.light {
  --runtime-header-bg: rgba(255, 255, 255, 0.9) !important;
  --runtime-panel-bg: rgba(255, 255, 255, 0.6) !important;
  --runtime-panel-border: rgba(103, 126, 168, 0.24) !important;
  --runtime-ring: 0 0 0 3px rgba(89, 166, 255, 0.24) !important;
  --runtime-glow: 0 10px 30px rgba(70, 98, 143, 0.08) !important;
  --runtime-amber-bg: rgba(212, 163, 89, 0.06) !important;
  --runtime-amber-border: rgba(212, 163, 89, 0.24) !important;
  --runtime-amber-text: #b37d1b !important;
}

/* ==========================================
   1. Shell, Header & Search Layout
   ========================================== */

.page-shell {
  position: relative;
  z-index: 1;
  width: min(var(--runtime-shell-max), calc(100% - 32px));
  padding: 16px 0 56px;
}

.workspace-card {
  overflow: visible;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.workspace-card::before {
  display: none;
}

.app-header {
  position: sticky;
  top: 12px;
  z-index: 200;
  min-height: 58px;
  margin: 0 0 22px;
  padding: 8px 14px 8px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--runtime-header-bg);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(16px) saturate(132%);
  -webkit-backdrop-filter: blur(16px) saturate(132%);
}

.runtime-brand {
  padding-right: 8px;
}

.runtime-brand-subtitle {
  color: var(--text-dim);
  opacity: 0.82;
}

.clock.visible {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--control-bg);
}

.search-wrap {
  width: min(720px, 100%);
  max-width: 720px;
  margin: 0 auto;
}

.search-control {
  position: relative;
  gap: 10px;
}

.search-control::before {
  content: '';
  position: absolute;
  z-index: 1;
  left: 18px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  border: 2px solid var(--field-placeholder);
  border-radius: 50%;
  opacity: 0.74;
  pointer-events: none;
}

.search-control::after {
  content: '';
  position: absolute;
  z-index: 1;
  left: 32px;
  top: calc(50% + 8px);
  width: 8px;
  height: 2px;
  transform: rotate(45deg);
  transform-origin: left center;
  border-radius: 999px;
  background: var(--field-placeholder);
  opacity: 0.74;
  pointer-events: none;
}

.search-input {
  min-height: 54px;
  padding: 15px 18px 15px 48px;
  border-color: var(--field-border);
  border-radius: 18px;
  background: var(--field-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.search-input:focus,
.search-input:focus-visible {
  border-color: var(--field-border-focus);
  background: var(--field-bg-focus);
  box-shadow: var(--runtime-ring), 0 16px 34px rgba(0, 0, 0, 0.2);
}

.search-submit-btn:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--accent);
  color: var(--bg);
}

.search-helper {
  text-align: center;
  color: var(--text-dim);
}

/* ==========================================
   2. Header Buttons System
   ========================================== */

.app-header-actions {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

.app-header-actions .icon-btn {
  min-height: 38px !important;
  height: 38px !important;
  padding: 0 14px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  border-radius: 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  width: auto !important;
  min-width: auto !important;
  text-transform: none !important;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, color 160ms ease !important;
}

.app-header-actions #btn-header-search[hidden] {
  display: none !important;
}

.app-header-actions .icon-btn:hover {
  transform: translateY(-1px) !important;
}

.app-header-actions .icon-btn:active {
  transform: translateY(0) !important;
}

#btn-add-site {
  background: linear-gradient(135deg, var(--accent-2, var(--accent)), var(--accent)) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 30%, transparent) !important;
}

#btn-add-site:hover {
  filter: brightness(1.1) !important;
}

#btn-add-preset {
  background: var(--favorite-chip-bg) !important;
  color: var(--text-dim) !important;
  border: 1px solid var(--border) !important;
}

#btn-add-preset:hover {
  background: var(--favorite-chip-hover-bg) !important;
  border-color: var(--border-strong) !important;
  color: var(--text) !important;
}

#btn-settings,
#btn-more {
  background: transparent !important;
  border: 1px solid var(--border) !important;
  color: var(--text-dim) !important;
}

#btn-settings:hover,
#btn-more:hover {
  background: var(--control-hover) !important;
  color: var(--text) !important;
  border-color: var(--border-strong) !important;
}

#btn-add-site::before {
  content: '+\00a0' !important;
  font-size: 16px !important;
  font-weight: 800 !important;
}

#btn-add-preset::before {
  content: '▦\00a0' !important;
  font-size: 14px !important;
}

#btn-settings::before {
  content: '⚙\00a0' !important;
  font-size: 15px !important;
}

#btn-more::before {
  content: '⛃\00a0' !important;
  font-size: 15px !important;
}

:where(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--runtime-ring);
}

/* ==========================================
   3. Trust Strip & Favorites Panel
   ========================================== */

.status-strip {
  gap: 12px;
  width: min(var(--runtime-content-max), 100%);
  margin: 0 auto 12px;
  padding: 8px 0 !important; /* No side padding to align content */
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

.trust-state {
  min-height: 30px;
  padding: 7px 10px;
}

.trust-state::before {
  content: '';
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 14%, transparent);
}

.status-strip-summary,
.strip-data-item {
  font-size: 12px;
  opacity: 0.82;
}

.status-strip-action-buttons {
  gap: 7px;
}

.status-strip-action-buttons .icon-btn {
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 11px;
  background: var(--control-bg) !important;
  border: 1px solid var(--control-border) !important;
  color: var(--text-dim) !important;
  font-weight: 600 !important;
  cursor: pointer;
  transition: all 0.15s ease;
}

.status-strip-action-buttons .icon-btn:hover {
  background: var(--control-hover) !important;
  border-color: var(--border-strong) !important;
  color: var(--text) !important;
}

.status-strip-action-buttons .icon-btn:first-child {
  border-color: var(--runtime-amber-border) !important;
  background: var(--runtime-amber-bg) !important;
  color: var(--runtime-amber-text) !important;
}

.status-strip-action-buttons .icon-btn:first-child:hover {
  background: rgba(255, 193, 92, 0.12) !important;
  border-color: rgba(255, 193, 92, 0.32) !important;
}

/* Refined Compact Favorites Panel */
/* Premium Compact borderless Favorites Panel */
.favorites-panel {
  width: min(var(--runtime-content-max), 100%) !important;
  margin: 0 auto 10px !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

.home-favorites-title {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  margin-bottom: 6px !important;
  color: var(--runtime-amber-text) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  opacity: 0.8 !important;
}

.home-favorites-title::before {
  content: '★' !important;
  font-size: 12px !important;
  line-height: 1 !important;
}

.favorites-strip {
  display: flex !important;
  flex-wrap: wrap !important;
  overflow-x: hidden !important;
  overflow-y: visible !important;
  gap: 6px !important;
  padding: 2px 0 6px !important;
  max-height: none !important;
}

.favorites-strip::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

@media (max-width: 720px) {
  .favorites-strip {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    max-height: none !important;
    scrollbar-width: none !important;
  }
}

.favorite-chip {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: 28px !important;
  padding: 4px 8px !important;
  border-radius: 8px !important;
  border: 1px solid rgba(255, 193, 92, 0.14) !important;
  background: rgba(255, 193, 92, 0.05) !important;
  opacity: 0.9 !important;
  transition: all 0.2s ease !important;
  flex-shrink: 0 !important;
  min-width: 0 !important;
}

.favorites-strip .favorite-chip {
  max-width: min(220px, 100%) !important;
}

.favorites-drawer-list .favorite-chip {
  display: flex !important;
  width: 100% !important;
  max-width: 100% !important;
}

.favorite-chip:hover {
  border-color: rgba(255, 193, 92, 0.38) !important;
  background: rgba(255, 193, 92, 0.12) !important;
  transform: translateY(-1px) !important;
  opacity: 1 !important;
}

.favorite-chip-icon {
  width: 18px !important;
  height: 18px !important;
  border-radius: 4px !important;
  background: rgba(255, 193, 92, 0.1) !important;
  color: var(--runtime-amber-text) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

.favorite-chip-icon img {
  width: 12px !important;
  height: 12px !important;
}

.favorite-chip-copy {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 6px !important;
  min-width: 0 !important;
}

.favorite-chip-name {
  font-size: 11px !important;
  font-weight: 700 !important;
  color: var(--text) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.favorite-chip-meta {
  margin-top: 0 !important;
  color: var(--text-dim) !important;
  font-size: 9px !important;
  font-weight: 600 !important;
  opacity: 0.55 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.favorite-chip-meta::before {
  content: '·';
  margin-right: 6px;
  opacity: 0.7;
}

/* ==========================================
   4. Groups Navigation Dock & Tabs
   ========================================== */

.tabs-frame {
  position: relative;
  width: min(var(--runtime-content-max), 100%);
  margin: 0 auto;
  margin-bottom: 0 !important; /* Stacked */
  padding: 6px 0 !important; /* No side padding to align content */
  overflow: hidden;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body.runtime-view-home .tabs-frame {
  display: none !important; /* Hide to avoid duplication on Home view */
}

body.runtime-view-home #tabs-bar,
body.runtime-view-group #tabs-bar {
  display: flex;
}

body.runtime-view-home .tabs-frame .section-toggle-row,
body.runtime-view-group .tabs-frame .section-toggle-row {
  display: flex;
}

.tabs-frame::after {
  content: '';
  position: absolute;
  inset: 0 0 0 auto;
  width: 56px;
  background: linear-gradient(90deg, transparent, var(--bg, #0b0718)) !important;
  opacity: 0.88;
  pointer-events: none;
}

.tabs-bar {
  display: flex;
  flex-direction: row;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
  scrollbar-width: none;
  align-items: center;
}

.tabs-bar::-webkit-scrollbar {
  display: none;
}

.groups-section {
  flex: 0 0 auto;
}

.groups-section-title {
  display: none;
}

.groups-section-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
}

.tab-shell {
  display: flex;
  align-items: center;
}

.tab {
  position: relative;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  justify-content: space-between !important;
  min-height: 34px;
  max-width: 188px;
  padding: 6px 12px !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  color: var(--text-dim) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  transition: all 0.2s ease !important;
  cursor: pointer;
}

.tab::after {
  display: none !important;
}

.tab:hover {
  color: var(--text) !important;
  background: var(--control-hover) !important;
}

.tab.active {
  background: var(--control-active) !important;
  border: 1px solid var(--border-strong) !important;
  color: var(--text) !important;
  box-shadow: none !important;
}

.tab.active::after {
  display: none !important;
}

.tab-label {
  display: inline-flex;
  align-items: center;
  gap: 8px !important;
}

.tab-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-icon {
  width: 16px !important;
  height: 16px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: var(--group-accent, var(--accent));
}

.tab-count {
  font-size: 11px !important;
  font-weight: 500 !important;
  min-width: auto !important;
  height: auto !important;
  padding: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--text-dim) !important;
  margin-left: 4px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tab.active .tab-count {
  background: transparent !important;
  color: var(--text-dim) !important;
  box-shadow: none !important;
}

.tab-pinned-badge {
  color: var(--runtime-amber-text);
  margin-left: 2px;
}

.tab-add-btn {
  min-height: 34px;
  padding-inline: 14px;
  border: 1px dashed var(--control-border) !important;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease !important;
}

.tab-add-btn:hover {
  background: var(--control-hover) !important;
  border-color: var(--border-strong) !important;
  color: var(--text);
}

/* ==========================================
   5. Unified Workspace Container & Grids
   ========================================== */

.workspace-head {
  display: flex;
  align-items: center;
  width: min(var(--runtime-content-max), 100%);
  margin: 0 auto;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding: 14px 0 10px !important; /* No side padding to align content */
  border: none !important; /* Remove borders */
  background: transparent !important; /* Transparent */
}

/* Fallback top-rounded container if tab bar is hidden */
.tabs-frame[hidden] + .workspace-head {
  border-radius: 0 !important;
  border-top: none !important;
}

.workspace-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

body.runtime-view-home.runtime-mode-simple.runtime-simple-has-sites:not(.runtime-search-active) .group-sort-btn,
body.runtime-view-home.runtime-mode-simple.runtime-simple-has-sites:not(.runtime-search-active) .group-edit-mode-btn {
  display: inline-flex;
}

.group-kicker {
  margin-bottom: 4px;
  color: rgba(212, 196, 234, 0.72);
  font-size: 11px;
}

.group-title {
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 800;
}

/* Unified Spacing for Control System */
#btn-back-home,
.group-sort-btn,
.group-edit-mode-btn,
.open-all-btn {
  background: var(--button-bg) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-dim) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  padding: 0 12px !important;
  height: 34px !important;
  min-height: 34px !important;
  border-radius: 10px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  cursor: pointer;
  transition: all 0.2s ease !important;
}

#btn-back-home:hover,
.group-sort-btn:hover,
.group-edit-mode-btn:hover,
.open-all-btn:hover {
  background: var(--button-hover) !important;
  border-color: var(--border-strong) !important;
  color: var(--text) !important;
  transform: translateY(-1px) !important;
}

#btn-back-home:active,
.group-sort-btn:active,
.group-edit-mode-btn:active,
.open-all-btn:active {
  background: var(--button-active) !important;
  transform: translateY(0) !important;
}

.group-edit-mode-btn.active,
body.edit-mode .group-edit-mode-btn {
  background: var(--accent) !important;
  color: var(--bg) !important;
  border-color: transparent !important;
  font-weight: 700 !important;
}

.group-count {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: var(--chip-bg) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-dim) !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 0 10px !important;
  height: 34px !important;
  min-height: 34px !important;
  border-radius: 10px !important;
}

/* Site card grid wrapper - Bottom Deck */
.grid-wrap {
  width: min(var(--runtime-content-max), 100%);
  margin: 0 auto 22px !important; /* Spacing aligned with home-view */
  margin-top: 0 !important;
  padding: 0 0 18px !important; /* No side padding to align content */
  border: none !important; /* Remove borders */
  border-radius: 0 !important;
  background: transparent !important; /* Transparent */
}

.grid {
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--gap);
}

.home-view {
  width: min(var(--runtime-content-max), 100%);
  margin: 0 auto 22px;
}

body.light .home-view {
  padding-left: clamp(20px, 3vw, 48px);
  padding-right: clamp(20px, 3vw, 48px);
}

@media (max-width: 720px) {
  body.light .home-view {
    padding-left: 12px;
    padding-right: 12px;
  }
}

.home-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 10px !important; /* No side padding to align content */
  border: none !important; /* Remove borders */
  background: transparent !important; /* Transparent */
  margin: 0 !important;
}

.home-section-header .home-section-title {
  font-size: clamp(20px, 2vw, 26px) !important;
  font-weight: 800 !important;
  color: var(--text) !important;
}

.home-groups-grid {
  display: grid;
  grid-template-columns: repeat(var(--group-card-cols, 4), minmax(0, 1fr));
  grid-auto-rows: 1fr;
  align-items: stretch;
  gap: var(--group-card-gap, var(--gap, 12px));
  width: 100%;
  padding: 0 0 18px !important; /* No side padding to align content */
  border: none !important; /* Remove borders */
  border-radius: 0 !important;
  background: transparent !important; /* Transparent */
}

/* ==========================================
   6. Premium Group Navigation Cards
   ========================================== */

.group-card {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 10px !important;
  width: 100% !important;
  height: 100% !important;
  min-height: var(--group-card-min-height, 132px) !important;
  padding: var(--group-card-padding, 12px) !important;
  border-radius: var(--group-card-radius, 16px) !important;
  border: 1px solid color-mix(in srgb, var(--group-color, var(--accent)) 42%, var(--border)) !important;
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--group-tint, var(--favorite-chip-bg)) 76%, var(--surface-strong)) 0%,
      color-mix(in srgb, var(--bg2) 72%, transparent) 100%) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  color: var(--text) !important;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.22s ease, box-shadow 0.22s ease !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 8px 32px rgba(0, 0, 0, 0.15) !important;
  position: relative !important;
  text-align: left;
  cursor: pointer;
  overflow: hidden !important;
}

.group-card:hover {
  transform: translateY(-3px) !important;
  border-color: var(--group-active-border, var(--border-strong)) !important;
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--group-tint, var(--favorite-chip-hover-bg)) 86%, var(--surface-strong)) 0%,
      color-mix(in srgb, var(--bg2) 82%, transparent) 100%) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 12px 40px rgba(0, 0, 0, 0.25),
    0 0 18px color-mix(in srgb, var(--group-color, var(--accent)) 12%, transparent) !important;
}

.group-card:active {
  transform: translateY(-1px) !important;
}

.group-card.is-empty {
  min-height: var(--group-card-min-height, 132px) !important;
  justify-content: flex-start !important;
}

.group-card-marker {
  width: 8px !important;
  height: 8px !important;
  border-radius: 50% !important;
  margin-top: 3px !important;
  flex-shrink: 0 !important;
  background: var(--group-color, var(--accent)) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--group-color, var(--accent)) 25%, transparent) !important;
}

.group-card-name {
  font-size: var(--group-card-name-font, 14px) !important;
  font-weight: 800 !important;
  color: var(--text) !important;
  line-height: 1.25 !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
}

.group-card-count {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 22px !important;
  height: 18px !important;
  padding: 0 6px !important;
  border-radius: 9px !important;
  border: 1px solid color-mix(in srgb, var(--group-color, var(--accent)) 25%, rgba(255, 255, 255, 0.15)) !important;
  background: rgba(3, 3, 12, 0.6) !important;
  color: var(--text-dim) !important;
  font-size: var(--group-card-count-font, 10px) !important;
  opacity: 1 !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  margin-top: 0 !important;
  transition: opacity 0.14s ease !important;
}

.group-card-count::before {
  content: none !important;
}

.group-card-head {
  align-items: flex-start !important;
  gap: 6px !important;
  min-width: 0 !important;
}

.group-card-main {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  align-items: flex-start !important;
  gap: 5px !important;
}

.group-card-name-wrap {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

.group-card-head-actions {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 4px !important;
  flex: 0 0 auto !important;
}

.group-card-pinned {
  width: 14px !important;
  height: 14px !important;
  color: color-mix(in srgb, var(--group-color, var(--accent)) 74%, var(--text)) !important;
  opacity: 0.84 !important;
}

.group-card-previews {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: flex-start !important;
  align-items: flex-start !important;
  align-content: flex-start !important;
  gap: var(--group-card-shelf-gap, 6px) !important;
  width: 100% !important;
  min-height: calc(var(--group-card-favicon-size, 40px) * 2 + var(--group-card-shelf-gap, 6px) + var(--group-card-shelf-pad, 6px) * 2) !important;
  margin-top: 0 !important;
  padding: var(--group-card-shelf-pad, 6px) !important;
  border-radius: var(--group-card-shelf-radius, 13px) !important;
  border: 1px solid rgba(255, 255, 255, 0.05) !important;
  background: rgba(0, 0, 0, 0.12) !important;
  overflow: hidden !important;
}

.group-card-previews.is-empty {
  align-items: center !important;
  min-height: calc(var(--group-card-favicon-size, 40px) + var(--group-card-shelf-pad, 6px) * 2) !important;
}

.group-card-preview-empty {
  display: inline-flex !important;
  align-items: center !important;
  min-height: var(--group-card-favicon-size, 40px) !important;
  color: color-mix(in srgb, var(--text-dim) 88%, var(--text)) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
}

.group-card-preview-favicon {
  width: 80% !important;
  height: 80% !important;
  border-radius: 0 !important;
  background: transparent !important;
  border: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: hidden !important;
  box-shadow: none !important;
}

.group-card-preview-favicon img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
}

.group-card-preview-favicon.group-card-preview-monogram {
  font-size: calc(var(--group-card-favicon-size, 40px) * 0.46) !important;
  font-weight: 800 !important;
  color: var(--text) !important;
  background: transparent !important;
}

.group-card-preview-item {
  width: var(--group-card-favicon-size, 40px) !important;
  height: var(--group-card-favicon-size, 40px) !important;
  border-radius: 10px !important;
  background: color-mix(in srgb, var(--group-color, var(--accent)) 6%, rgba(255, 255, 255, 0.03)) !important;
  border: 1px solid color-mix(in srgb, var(--group-color, var(--accent)) 10%, rgba(255, 255, 255, 0.05)) !important;
  pointer-events: none !important;
  box-shadow: none !important;
}

.group-card-preview-more {
  font-size: calc(var(--group-card-favicon-size, 40px) * 0.32) !important;
  font-weight: 600 !important;
  color: var(--text-dim) !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px dashed rgba(255, 255, 255, 0.2) !important;
  width: calc(var(--group-card-favicon-size, 40px) * 0.75) !important;
  min-width: calc(var(--group-card-favicon-size, 40px) * 0.75) !important;
  height: calc(var(--group-card-favicon-size, 40px) * 0.75) !important;
  padding: 0 !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  align-self: center !important;
  box-shadow: none !important;
}

.group-card-footer {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  min-width: 0 !important;
  margin: auto calc(var(--group-card-padding, 12px) * -1) calc(var(--group-card-padding, 12px) * -1) !important;
  padding: 9px var(--group-card-padding, 12px) !important;
  border-top: 1px solid color-mix(in srgb, var(--group-color, var(--accent)) 42%, transparent) !important;
  background: rgba(2, 2, 10, 0.58) !important;
}

.group-card-footer-meta {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  color: color-mix(in srgb, var(--text) 82%, var(--text-dim)) !important;
  font-size: 12px !important;
  font-weight: 650 !important;
}

.group-card-footer-action {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex: 0 0 auto !important;
  color: color-mix(in srgb, var(--group-color, var(--accent)) 58%, var(--text)) !important;
  font-weight: 900 !important;
}

.group-card-footer-arrow {
  color: currentColor !important;
  opacity: 0.78 !important;
  font-size: 13px !important;
}

.group-card-menu-btn {
  position: static !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 22px !important;
  height: 22px !important;
  padding: 0 !important;
  border-radius: 6px !important;
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.14s ease, background 0.14s ease, border-color 0.14s ease !important;
  transform: none !important;
}

.group-card-menu-btn svg {
  width: 12px !important;
  height: 12px !important;
}

@media (hover: hover) {
  .group-card:hover .group-card-menu-btn,
  .group-card-menu-btn:hover,
  .group-card-menu-btn:focus-within,
  body.edit-mode .group-card-menu-btn {
    opacity: 1 !important;
    pointer-events: auto !important;
  }
}

@media (hover: none), (pointer: coarse) {
  .group-card-menu-btn {
    opacity: 0.75 !important;
    pointer-events: auto !important;
    transform: none !important;
  }
}

@media (max-width: 640px) {
  .home-groups-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .group-card {
    min-height: 128px !important;
    padding: 8px !important;
    border-radius: 13px !important;
    gap: 8px !important;
  }

  .group-card-head {
    gap: 6px !important;
  }

  .group-card-main {
    gap: 6px !important;
  }

  .group-card-marker {
    width: 8px !important;
    height: 8px !important;
    margin-top: 3px !important;
  }

  .group-card-name {
    font-size: 12px !important;
    -webkit-line-clamp: 3 !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }

  .group-card-head-actions {
    gap: 4px !important;
  }

  .group-card-pinned {
    width: 16px !important;
    height: 16px !important;
  }

  .group-card-count {
    min-width: 24px !important;
    height: 20px !important;
    padding: 0 7px !important;
    font-size: 10px !important;
  }

  .group-card-menu-btn {
    position: static !important;
    opacity: 0.75 !important;
    pointer-events: auto !important;
    transform: none !important;
  }

  .group-card-previews {
    gap: 4px !important;
    min-height: 70px !important;
    padding: 4px !important;
    border-radius: 10px !important;
  }

  .group-card-preview-item {
    width: 30px !important;
    height: 30px !important;
    border-radius: 8px !important;
  }

  .group-card-preview-favicon.group-card-preview-monogram {
    font-size: 14px !important;
  }

  .group-card-preview-more {
    width: 22px !important;
    min-width: 22px !important;
    height: 22px !important;
    border-radius: 50% !important;
    padding: 0 !important;
    font-size: 9px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px dashed rgba(255, 255, 255, 0.2) !important;
    color: var(--text-dim) !important;
    align-self: center !important;
  }

  .group-card-preview-empty {
    min-height: 30px !important;
    font-size: 11px !important;
  }

  .group-card-footer {
    margin: auto -8px -8px !important;
    padding: 7px 8px !important;
  }

  .group-card-footer-meta {
    font-size: 11px !important;
  }

  .group-card-footer-action {
    gap: 5px !important;
  }
}

/* ==========================================
   7. Site Cards & Launcher Tiles
   ========================================== */

.tile,
.tile.has-preview,
.tile.no-preview {
  min-height: 116px;
  height: auto;
  max-height: none;
  border-radius: 18px;
  background: var(--card-bg) !important;
  border: 1px solid var(--card-border) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease !important;
}

.tile:hover {
  border-color: var(--border-strong) !important;
  background: var(--card-hover) !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25), 0 0 16px color-mix(in srgb, var(--accent) 5%, transparent) !important;
  transform: translateY(-3px) !important;
}

.tile.favorite {
  border-color: rgba(255, 193, 92, 0.28) !important;
  box-shadow: 0 0 0 1px rgba(255, 193, 92, 0.12), 0 16px 38px rgba(0, 0, 0, 0.22);
}

.tile-linker {
  position: relative;
  display: grid;
  min-height: 116px;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  gap: 8px 10px !important;
  width: 100%;
  padding: 14px !important;
}

.tile-fallback-favicon {
  width: 46px !important;
  height: 46px !important;
  border-radius: 50% !important;
  background: var(--favicon-bg) !important;
  color: var(--favicon-color) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: none !important;
  position: relative;
}

.tile-fallback-favicon img {
  width: 24px !important;
  height: 24px !important;
  object-fit: contain !important;
  border-radius: 4px !important;
}

.tile-fav-star-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg, #07050f) !important;
  border: 1px solid rgba(255, 193, 92, 0.4) !important;
  border-radius: 50% !important;
  color: var(--runtime-amber-text) !important;
  font-size: 9px !important;
  line-height: 1 !important;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
}

.tile-card-copy {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 2px !important;
}

.tile-card-name {
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  white-space: normal !important;
  overflow: hidden !important;
  color: var(--text) !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
  min-height: 35px !important; /* Perfect align layout */
}

.tile-card-host {
  overflow: hidden;
  color: #B8A0D8 !important;
  opacity: 0.7 !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-card-description {
  display: -webkit-box;
  overflow: hidden;
  grid-column: 1 / -1;
  margin-top: 2px;
  color: rgba(212, 196, 234, 0.76);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.tile-card-footer {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 10px;
  margin-top: 4px;
}

.tile-card-group {
  overflow: hidden;
  min-width: 0;
  color: rgba(212, 196, 234, 0.66);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-card-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.tile-card-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text-dim);
}

.tile-card-badge svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.tile-card-badge.favorite {
  display: none !important; /* Hidden in favor of favicon corner star */
}

.tile-card-badge.note {
  width: 18px !important;
  height: 18px !important;
  border-radius: 5px !important;
  background: var(--favorite-chip-bg) !important;
  border: 1px solid var(--favorite-chip-border) !important;
  color: var(--accent) !important;
  opacity: 0.8 !important;
  transition: opacity 0.2s ease !important;
}

.tile-card-badge.note:hover {
  opacity: 1 !important;
}

.tile-card-badge.note svg {
  width: 10px !important;
  height: 10px !important;
  stroke: currentColor !important;
  stroke-width: 2px !important;
}

.tile-visual,
.tile-caption,
.tile-body {
  display: none;
}

.tile-actions {
  top: 10px;
  right: 10px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.tile:hover .tile-actions,
.tile:focus-within .tile-actions,
.tile-actions:focus-within,
.tile.edit-mode .tile-actions {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.tile-action-btn {
  background: var(--button-bg) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-dim) !important;
  width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  border-radius: 8px !important;
  transition: all 0.15s ease !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.tile-action-btn:hover {
  background: var(--button-hover) !important;
  border-color: var(--border-strong) !important;
  color: var(--text) !important;
}

.tile-action-btn.danger {
  background: rgba(239, 68, 68, 0.10) !important;
  border: 1px solid rgba(239, 68, 68, 0.24) !important;
  color: #FCA5A5 !important;
}

.tile-action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.18) !important;
  border-color: rgba(239, 68, 68, 0.40) !important;
  color: #fff !important;
}

.tile-menu-btn {
  top: auto;
  right: 12px;
  bottom: 12px;
  opacity: 0;
}

.tile-note-btn {
  top: auto;
  right: 48px;
  bottom: 12px;
  opacity: 0;
}

.tile:hover .tile-note-btn,
.tile:focus-within .tile-note-btn,
.tile-note-btn:focus-visible,
.tile.edit-mode .tile-note-btn {
  opacity: 1;
}

.tile-add {
  min-height: 116px !important;
  height: auto !important;
  border-radius: 18px !important;
  background: var(--surface-soft) !important;
  border: 1px dashed var(--border) !important;
  box-shadow: none !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  cursor: pointer !important;
  transition: all 0.22s ease !important;
}

.tile-add:hover {
  transform: translateY(-3px) !important;
  border-color: var(--border-strong) !important;
  background: var(--control-hover) !important;
  border-style: solid !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2), 0 0 16px color-mix(in srgb, var(--accent) 5%, transparent) !important;
}

.tile-add .plus {
  font-size: 26px !important;
  font-weight: 300 !important;
  color: var(--text-dim) !important;
  line-height: 1 !important;
  transition: color 0.2s ease !important;
}

.tile-add .add-label {
  font-size: 12px !important;
  font-weight: 700 !important;
  color: var(--text-dim) !important;
  transition: color 0.2s ease !important;
}

.tile-add:hover .plus,
.tile-add:hover .add-label {
  color: var(--text) !important;
}

.empty-state {
  min-height: 220px;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 24px;
  background: var(--runtime-panel-bg);
}

/* ==========================================
   8. Drawers & Modals
   ========================================== */

.settings-drawer {
  width: 360px !important;
  max-width: 100% !important;
  background: var(--drawer-head-bg, var(--surface)) !important;
  border-left: 1px solid var(--border) !important;
  box-shadow: var(--drawer-shadow) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
}

.drawer-head {
  min-height: 72px;
  padding: 18px 20px;
}

.drawer-title {
  font-size: 14px;
}

.drawer-section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border) !important;
}

/* Text Tabs inside drawers */
.settings-tabs {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  border-bottom: 1px solid var(--border) !important;
  padding-bottom: 8px !important;
  margin-bottom: 16px !important;
  overflow-x: auto !important;
}

.settings-tab {
  flex: 0 0 auto !important;
  border: none !important;
  background: transparent !important;
  border-radius: 0 !important;
  color: var(--text-dim) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  padding: 6px 4px !important;
  min-height: auto !important;
  cursor: pointer !important;
  position: relative !important;
}

.settings-tab:hover {
  color: var(--text) !important;
}

.settings-tab.is-active {
  color: var(--text) !important;
  background: transparent !important;
  box-shadow: none !important;
}

.settings-tab.is-active::after {
  content: '' !important;
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  bottom: -9px !important;
  height: 2px !important;
  border-radius: 999px !important;
  background: var(--accent) !important;
}

.data-drawer-section:first-of-type,
.data-drawer-section:nth-of-type(2) {
  background: var(--drawer-section-alt-bg) !important;
}

.modal {
  border-color: var(--border-strong);
  background: var(--panel-elevated) !important;
  box-shadow: 0 34px 90px rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.modal input:not([type='checkbox']),
.modal textarea,
.modal select,
.setting-select {
  min-height: 44px;
  border-color: var(--field-border);
  background: var(--field-bg);
}

/* Premium Bento-style Data File Card & Action Buttons for Drawer */
.data-file-card {
  border-radius: 16px !important;
  background: var(--drawer-section-alt-bg) !important;
  border: 1px solid var(--border) !important;
  padding: 14px 16px !important;
  margin-bottom: 12px !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02) !important;
}

.data-drawer-actions .icon-btn:not(.danger) {
  background: var(--button-bg) !important;
  color: var(--text-dim) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  font-weight: 600 !important;
  transition: all 0.2s ease !important;
}

.data-drawer-actions .icon-btn:not(.danger):hover:not(:disabled) {
  background: var(--button-hover) !important;
  border-color: var(--border-strong) !important;
  color: var(--text) !important;
  transform: translateY(-1px) !important;
}

.data-drawer-actions .icon-btn:not(.danger):active:not(:disabled) {
  background: var(--button-active) !important;
  transform: translateY(0) !important;
}

.data-drawer-actions .icon-btn:disabled {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
  transform: none !important;
}

.data-drawer-actions .icon-btn.danger {
  background: rgba(239, 68, 68, 0.10) !important;
  color: #FCA5A5 !important;
  border: 1px solid rgba(239, 68, 68, 0.28) !important;
  border-radius: 12px !important;
  font-weight: 600 !important;
  transition: all 0.2s ease !important;
}

.data-drawer-actions .icon-btn.danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.18) !important;
  border-color: rgba(239, 68, 68, 0.42) !important;
  color: #fff !important;
  transform: translateY(-1px) !important;
}

.data-drawer-actions .icon-btn.danger:active:not(:disabled) {
  background: rgba(239, 68, 68, 0.24) !important;
  transform: translateY(0) !important;
}

/* ==========================================
   9. Mobile & Responsive Layouts
   ========================================== */

@media (max-width: 1439px) {
  #btn-settings,
  #btn-more {
    width: 36px !important;
    min-width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    font-size: 0 !important;
    line-height: 0 !important;
    gap: 0 !important;
    border-radius: 10px !important;
  }

  #btn-settings::before {
    content: '⚙' !important;
    line-height: 1 !important;
  }

  #btn-more::before {
    content: '☰' !important;
    line-height: 1 !important;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100%, calc(100% - 16px));
    padding-top: 8px;
  }

  .app-header {
    top: 8px;
    min-height: 60px;
    margin-bottom: 14px;
    padding: 8px;
    border-radius: 18px;
  }

  .app-header-actions {
    max-width: none;
    gap: 6px !important;
  }

  .app-header-actions .icon-btn {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    border-radius: 14px !important;
    font-size: 0 !important;
    line-height: 0 !important;
    gap: 0 !important;
    flex: 0 0 44px !important;
  }

  #btn-add-preset {
    display: none !important;
  }

  #btn-add-site::before {
    content: '+' !important;
    font-size: 22px !important;
    line-height: 1 !important;
  }

  #btn-settings::before {
    content: '⚙' !important;
    font-size: 16px !important;
    line-height: 1 !important;
  }

  #btn-more::before {
    content: '☰' !important;
    font-size: 18px !important;
    line-height: 1 !important;
  }

  .search-wrap {
    width: 100%;
  }

  .search-input,
  .search-submit-btn {
    min-height: 48px;
    border-radius: 16px;
  }

  .search-helper {
    display: none;
  }

  .search-wrap:focus-within .search-helper {
    display: block;
  }

  .status-strip {
    flex-wrap: nowrap;
    align-items: center;
    padding: 8px;
    overflow: hidden;
  }

  .status-strip-main {
    flex: 1 1 auto;
    width: auto;
  }

  .status-strip-primary {
    flex-direction: row;
    align-items: center;
  }

  .status-strip-secondary,
  .status-strip-summary,
  .status-strip-action-buttons .icon-btn:nth-child(n+2) {
    display: none;
  }

  .trust-state {
    width: auto;
    max-width: 100%;
    flex-direction: row;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .status-strip-actions {
    flex: 0 0 auto;
    width: auto;
    margin-left: auto;
  }

  .status-strip-action-buttons {
    width: auto;
  }

  .status-strip-action-buttons .icon-btn:first-child {
    display: inline-flex;
    min-height: 40px;
    padding: 8px 10px;
  }

  .favorites-strip,
  .tabs-bar {
    margin-inline: -2px;
  }

  .favorite-chip {
    min-height: 36px !important;
    height: 36px !important;
    padding: 4px 10px 4px 6px !important;
    border-radius: 8px !important;
  }

  .tabs-frame {
    padding: 6px 8px !important;
    border-radius: 14px !important;
    margin-bottom: 0 !important;
  }

  .tabs-frame::after {
    width: 36px;
  }

  .tab {
    min-width: 72px !important;
    max-width: 130px !important;
    padding: 8px 10px !important;
    font-size: 13px !important;
  }

  .workspace-head {
    align-items: flex-start;
    gap: 10px;
    border-radius: 0 !important;
  }

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

  .group-sort-btn,
  .group-edit-mode-btn,
  .group-add-btn,
  .group-back-btn,
  .group-count {
    min-height: 44px;
  }

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

  .tile,
  .tile.has-preview,
  .tile.no-preview {
    min-height: 112px;
    border-radius: 16px;
  }

  .tile-linker {
    min-height: 112px;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 9px;
    padding: 12px !important;
  }

  .tile-fallback-favicon {
    width: 38px !important;
    height: 38px !important;
    border-radius: 13px !important;
  }

  .tile-card-name {
    display: -webkit-box;
    font-size: 13px;
    white-space: normal;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: auto !important;
  }

  .tile-card-host,
  .tile-card-description,
  .tile-card-group {
    font-size: 10px;
  }

  .tile-actions {
    display: none;
  }

  .tile.edit-mode .tile-actions,
  .tile:focus-within .tile-actions {
    display: flex;
  }

  .tile-actions .tile-action-btn:first-child {
    display: inline-flex;
  }

  .tile-action-btn {
    width: 34px;
    height: 34px;
    min-height: 34px;
  }

  .tile-menu-btn,
  .tile-note-btn {
    opacity: 0;
    pointer-events: none;
  }

  .tile.edit-mode .tile-menu-btn,
  .tile.edit-mode .tile-note-btn,
  .tile:focus-within .tile-menu-btn,
  .tile:focus-within .tile-note-btn {
    opacity: 1;
    pointer-events: auto;
  }

  .settings-drawer {
    width: 100% !important;
  }

  .modal {
    width: min(100%, calc(100vw - 16px));
    max-height: calc(100dvh - 20px);
    margin-top: auto;
    border-radius: 20px 20px 0 0;
  }
}

@media (max-width: 390px) {
  .page-shell {
    width: min(100%, calc(100% - 12px));
  }

  .runtime-brand-name {
    font-size: 15px;
  }

  .app-header-actions {
    gap: 4px;
  }

  .app-header-actions .icon-btn {
    width: 42px;
    min-width: 42px;
  }

  .tile-card-badge {
    width: 22px;
    height: 22px;
  }
}

/* ==========================================================================
   TB-179 Modern Tabs Interface Overrides & Adaptations
   ========================================================================== */

/* 1. Open All Button Hidden Override */
.open-all-btn[hidden] {
  display: none !important;
}

/* 2. Workspace Action Icons */
.group-sort-btn::before {
  content: '⇅\00a0' !important;
  font-size: 13px !important;
}

.group-edit-mode-btn::before {
  content: '✎\00a0' !important;
  font-size: 13px !important;
}

/* 3. Trust Strip Button Icons */
#btn-trust-backup::before {
  content: '💾\00a0' !important;
  font-size: 11px !important;
}

#btn-trust-json-import::before {
  content: '📂\00a0' !important;
  font-size: 11px !important;
}

#btn-trust-file-write::before {
  content: '⬇\00a0' !important;
  font-size: 11px !important;
}

#btn-trust-file-read::before {
  content: '⬆\00a0' !important;
  font-size: 11px !important;
}

/* 4. Group View Empty Favorites Helper */
.favorites-panel.is-helper-view {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  padding: 0 0 10px !important;
  margin-bottom: 8px !important;
}

.favorites-panel.is-helper-view .home-favorites-title {
  display: none !important;
}

.favorites-panel.is-helper-view .favorites-empty-hint {
  color: var(--text-dim) !important;
  font-size: 12px !important;
  opacity: 0.6 !important;
  font-weight: normal !important;
}

/* 5. Light Theme Adaptation (body.light) */
body.light .group-card {
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--group-tint, rgba(147, 112, 219, 0.08)) 36%, rgba(255, 255, 255, 0.82)) 0%,
      rgba(255, 255, 255, 0.64) 100%) !important;
  border: 1px solid color-mix(in srgb, var(--group-color, var(--accent)) 30%, rgba(103, 126, 168, 0.15)) !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06) !important;
}

body.light .group-card:hover {
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--group-tint, rgba(147, 112, 219, 0.10)) 44%, rgba(255, 255, 255, 0.88)) 0%,
      rgba(255, 255, 255, 0.76) 100%) !important;
  border-color: color-mix(in srgb, var(--group-color, var(--accent)) 42%, rgba(103, 126, 168, 0.22)) !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1) !important;
}

body.light .group-card-count {
  background: rgba(255, 255, 255, 0.74) !important;
  color: var(--text) !important;
}

body.light .group-card-previews {
  background: rgba(0, 0, 0, 0.02) !important;
  border-color: rgba(0, 0, 0, 0.05) !important;
}

body.light .group-card-preview-item {
  background: rgba(0, 0, 0, 0.03) !important;
  border: 1px solid rgba(0, 0, 0, 0.05) !important;
}

body.light .group-card-preview-more {
  background: rgba(0, 0, 0, 0.04) !important;
  border: 1px dashed rgba(0, 0, 0, 0.15) !important;
  color: rgba(0, 0, 0, 0.6) !important;
}

body.light .group-card-footer {
  background: rgba(255, 255, 255, 0.54) !important;
  border-top-color: color-mix(in srgb, var(--group-color, var(--accent)) 28%, rgba(103, 126, 168, 0.18)) !important;
}

body.light .tile {
  background: var(--card-bg) !important;
  border-color: var(--card-border) !important;
  box-shadow: var(--shadow-soft) !important;
}

body.light .tile:hover {
  background: var(--card-hover) !important;
  border-color: var(--border-strong) !important;
  box-shadow: var(--shadow-card) !important;
}

body.light .tile-add {
  min-height: 148px !important;
  height: 148px !important;
  max-height: 148px !important;
  background: rgba(255, 255, 255, 0.62) !important;
  border: 1px dashed rgba(112, 71, 235, 0.28) !important;
  box-shadow: none !important;
}

body.light .tile-add:hover {
  background: rgba(112, 71, 235, 0.05) !important;
  border-color: rgba(112, 71, 235, 0.5) !important;
  border-style: solid !important;
  box-shadow: 0 12px 28px rgba(31, 23, 71, 0.06) !important;
}

body.light .tile-add .plus {
  color: var(--accent) !important;
  font-weight: 400 !important;
}

body.light .tile-add .add-label {
  color: var(--text-dim) !important;
}

body.light .tile-add:hover .plus {
  color: var(--accent) !important;
}

body.light .tile-add:hover .add-label {
  color: var(--text) !important;
}

body.light .settings-drawer,
body.light .menu-drawer {
  background: rgba(255, 255, 255, 0.98) !important;
  border-left: 1px solid rgba(103, 126, 168, 0.22) !important;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15) !important;
}

body.light .tile-fav-star-badge {
  background: #ffffff !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
}

/* ==========================================================================
   TB-260 Name-first Dial Card site tiles
   ========================================================================== */

.tile:not(.tile-add),
.tile.has-preview:not(.tile-add),
.tile.no-preview:not(.tile-add) {
  --dial-border: color-mix(in srgb, var(--tile-accent) 48%, rgba(167, 139, 250, 0.20));
  --dial-fill: linear-gradient(
    180deg,
    color-mix(in srgb, var(--tile-accent) 9%, rgba(26, 17, 50, 0.84)),
    color-mix(in srgb, var(--tile-accent) 6%, rgba(12, 8, 24, 0.88))
  );
  --dial-fill-hover: linear-gradient(
    180deg,
    color-mix(in srgb, var(--tile-accent) 12%, rgba(31, 21, 58, 0.86)),
    color-mix(in srgb, var(--tile-accent) 8%, rgba(14, 9, 28, 0.9))
  );
  --dial-footer: rgba(7, 5, 15, 0.88);
  --dial-footer-border: color-mix(in srgb, var(--tile-accent) 28%, rgba(167, 139, 250, 0.16));
  min-height: 148px !important;
  height: 148px !important;
  max-height: 148px !important;
  border: 1px solid var(--dial-border) !important;
  border-radius: 18px !important;
  background: var(--dial-fill) !important;
  box-shadow: none !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
  overflow: hidden !important;
}

.tile:not(.tile-add)::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), transparent 42%),
    linear-gradient(135deg, color-mix(in srgb, var(--tile-accent) 4%, transparent), transparent 58%);
  pointer-events: none;
}

.tile:not(.tile-add):hover {
  border-color: color-mix(in srgb, var(--tile-accent) 62%, rgba(247, 243, 255, 0.26)) !important;
  background: var(--dial-fill-hover) !important;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--tile-accent) 18%, transparent),
    0 10px 24px rgba(0, 0, 0, 0.18) !important;
  transform: translateY(-2px) !important;
}

.tile:not(.tile-add):active {
  transform: translateY(0) scale(0.99) !important;
  background: color-mix(in srgb, var(--tile-accent) 15%, rgba(16, 10, 32, 0.86)) !important;
}

.tile:not(.tile-add):focus-visible {
  outline: none !important;
  border-color: var(--dial-border) !important;
  box-shadow:
    0 0 0 3px rgba(34, 211, 238, 0.28),
    0 0 0 5px rgba(7, 5, 15, 0.82) !important;
}

.tile.favorite:not(.tile-add) {
  border-color: var(--dial-border) !important;
  box-shadow:
    0 0 0 1px rgba(255, 193, 92, 0.22),
    0 10px 24px rgba(255, 193, 92, 0.10),
    0 10px 24px rgba(0, 0, 0, 0.16) !important;
}

.tile.favorite:not(.tile-add)::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 193, 92, 0.16);
}

.tile-linker {
  position: relative;
  z-index: 1;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: minmax(0, 1fr) 42px !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  padding: 0 !important;
  gap: 0 !important;
}

.tile-card-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  padding: 22px 18px 16px;
}

.tile-card-copy,
.tile-card-description,
.tile-card-group,
.tile-fav-star-badge {
  display: none !important;
}

.tile-card-name {
  display: -webkit-box !important;
  max-width: 100%;
  min-height: 0 !important;
  overflow: hidden !important;
  color: var(--text) !important;
  font-size: 18px !important;
  font-weight: 800 !important;
  line-height: 1.22 !important;
  text-align: center;
  text-overflow: ellipsis;
  text-wrap: balance;
  white-space: normal !important;
  word-break: normal;
  overflow-wrap: break-word;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
}

.tile-card-footer {
  grid-column: auto !important;
  display: flex !important;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  min-height: 42px;
  gap: 0;
  margin-top: 0 !important;
  padding: 8px 10px;
  border-top: 1px solid var(--dial-footer-border);
  background: var(--dial-footer);
}

.tile-card-meta {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.tile-fallback-favicon {
  width: 24px !important;
  height: 24px !important;
  flex: 0 0 24px;
  border-radius: 8px !important;
  border: 1px solid color-mix(in srgb, var(--tile-accent) 32%, rgba(255, 255, 255, 0.12));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent),
    color-mix(in srgb, var(--tile-accent) 18%, rgba(255, 255, 255, 0.055)) !important;
  color: color-mix(in srgb, var(--text) 92%, var(--tile-accent)) !important;
  font-size: 9px !important;
  font-weight: 900 !important;
  box-shadow: none !important;
  overflow: hidden !important;
}

.tile-fallback-favicon img {
  width: 16px !important;
  height: 16px !important;
  border-radius: 4px !important;
  object-fit: contain !important;
}

.tile-card-host {
  min-width: 0;
  overflow: hidden;
  color: rgba(212, 196, 234, 0.78) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  line-height: 1.2;
  opacity: 1 !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-card-badges {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.tile-card-badge {
  width: 28px !important;
  height: 28px !important;
  border-radius: 9px !important;
  border: 1px solid color-mix(in srgb, var(--tile-accent) 58%, rgba(255, 255, 255, 0.16)) !important;
  background: color-mix(in srgb, var(--tile-accent) 13%, rgba(7, 5, 15, 0.34)) !important;
  color: color-mix(in srgb, var(--tile-accent) 80%, #f7f3ff) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.tile-card-badge.favorite {
  display: inline-flex !important;
  border-color: rgba(255, 193, 92, 0.48) !important;
  background: rgba(255, 193, 92, 0.14) !important;
  color: #ffd777 !important;
  font-size: 18px !important;
  line-height: 1 !important;
  box-shadow: 0 0 16px rgba(255, 193, 92, 0.18);
}

.tile-card-badge.note {
  width: 28px !important;
  height: 28px !important;
  border-radius: 9px !important;
  background: color-mix(in srgb, var(--tile-accent) 14%, rgba(7, 5, 15, 0.34)) !important;
  border-color: color-mix(in srgb, var(--tile-accent) 62%, rgba(255, 255, 255, 0.16)) !important;
  color: color-mix(in srgb, var(--tile-accent) 82%, #f7f3ff) !important;
  opacity: 1 !important;
}

.tile-card-badge.note svg {
  width: 16px !important;
  height: 16px !important;
  stroke: currentColor !important;
  stroke-width: 1.9px !important;
}

.tile:hover .tile-card-badges,
.tile:focus-within .tile-card-badges,
.tile.edit-mode .tile-card-badges {
  opacity: 0;
  transform: translateY(-2px);
  pointer-events: none;
}

.tile-actions {
  top: 8px !important;
  right: 8px !important;
  padding: 3px !important;
  border-radius: 10px !important;
  border: 1px solid rgba(167, 139, 250, 0.18) !important;
  background: rgba(7, 5, 15, 0.72) !important;
  box-shadow: none !important;
}

.tile-action-btn {
  width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  border-radius: 8px !important;
  background: rgba(255, 255, 255, 0.045) !important;
}

.tile-action-btn.active {
  border-color: rgba(255, 193, 92, 0.42) !important;
  background: rgba(255, 193, 92, 0.13) !important;
  color: #ffd777 !important;
}

.tile-menu-btn,
.tile-note-btn {
  top: auto !important;
  right: 9px !important;
  bottom: 7px !important;
  width: 28px !important;
  height: 28px !important;
  opacity: 0 !important;
  pointer-events: none;
}

.tile-note-btn {
  right: 43px !important;
  border-radius: 9px;
  background: rgba(7, 5, 15, 0.76);
}

.tile:hover .tile-menu-btn,
.tile:focus-within .tile-menu-btn,
.tile-menu-btn:focus-visible,
.tile.edit-mode .tile-menu-btn,
.tile:hover .tile-note-btn,
.tile:focus-within .tile-note-btn,
.tile-note-btn:focus-visible,
.tile.edit-mode .tile-note-btn {
  opacity: 1 !important;
  transform: translateY(0);
  pointer-events: auto;
}

.site-card-preview-tile {
  width: min(100%, 260px);
  margin-inline: auto;
}

body.light .tile:not(.tile-add),
body.light .tile.has-preview:not(.tile-add),
body.light .tile.no-preview:not(.tile-add) {
  /* Card fill: very light accent tint so each card has individual colour identity */
  --dial-border: color-mix(in srgb, var(--tile-accent) 36%, rgba(97, 121, 165, 0.22)) !important;
  --dial-footer-border: color-mix(in srgb, var(--tile-accent) 20%, rgba(97, 121, 165, 0.14)) !important;
  --dial-fill: color-mix(in srgb, var(--tile-accent) 5%, rgba(252, 253, 255, 0.98)) !important;
  --dial-fill-hover: color-mix(in srgb, var(--tile-accent) 8%, #ffffff) !important;
  --dial-footer: color-mix(in srgb, var(--tile-accent) 10%, rgba(237, 242, 250, 0.92)) !important;
  box-shadow:
    0 2px 8px rgba(31, 23, 71, 0.06),
    0 1px 3px rgba(31, 23, 71, 0.04) !important;
}

/* Soft accent wash: stronger top tint that fades downward — the main colour identity signal */
body.light .tile:not(.tile-add)::before {
  content: '' !important;
  position: absolute !important;
  inset: 0 !important;
  background:
    linear-gradient(180deg,
      color-mix(in srgb, var(--tile-accent) 18%, transparent) 0%,
      color-mix(in srgb, var(--tile-accent) 6%, transparent) 38%,
      transparent 72%) !important;
  border-radius: inherit !important;
  pointer-events: none !important;
  z-index: 0 !important;
}

body.light .tile:not(.tile-add):hover {
  border-color: color-mix(in srgb, var(--tile-accent) 60%, rgba(97, 121, 165, 0.28)) !important;
  box-shadow:
    0 8px 24px color-mix(in srgb, var(--tile-accent) 14%, rgba(31, 23, 71, 0.08)),
    0 2px 6px rgba(31, 23, 71, 0.06) !important;
  transform: translateY(-2px) !important;
}

body.light .tile:not(.tile-add):active {
  transform: translateY(0) scale(0.99) !important;
  box-shadow: 0 2px 6px rgba(31, 23, 71, 0.06) !important;
}

body.light .tile-card-host {
  color: var(--text-dim) !important;
  font-weight: 600 !important;
}

body.light .tile-fallback-favicon {
  border-color: color-mix(in srgb, var(--tile-accent) 32%, rgba(97, 121, 165, 0.18)) !important;
  background: color-mix(in srgb, var(--tile-accent) 12%, rgba(230, 235, 248, 0.80)) !important;
  color: color-mix(in srgb, var(--tile-accent) 80%, var(--text)) !important;
}

/* Action buttons / context menu on light background */
body.light .tile-actions {
  border-color: rgba(97, 121, 165, 0.18) !important;
  background: rgba(255, 255, 255, 0.92) !important;
  box-shadow: 0 2px 8px rgba(31, 23, 71, 0.08) !important;
}

body.light .tile-action-btn {
  background: transparent !important;
  color: var(--text) !important;
}

body.light .tile-action-btn:hover {
  background: rgba(112, 71, 235, 0.07) !important;
  color: var(--accent) !important;
}

body.light .tile-action-btn.active {
  border-color: rgba(234, 179, 8, 0.38) !important;
  background: rgba(234, 179, 8, 0.10) !important;
  color: #a07800 !important;
}

body.light .tile-menu-btn,
body.light .tile-note-btn {
  background: rgba(255, 255, 255, 0.88) !important;
  border: 1px solid rgba(97, 121, 165, 0.18) !important;
  color: var(--text) !important;
  box-shadow: 0 2px 6px rgba(31, 23, 71, 0.08) !important;
}

body.light .tile-menu-btn:hover,
body.light .tile-note-btn:hover {
  background: rgba(112, 71, 235, 0.07) !important;
  border-color: rgba(112, 71, 235, 0.24) !important;
  color: var(--accent) !important;
}

/* Badges on light surface */
body.light .tile-card-badge {
  border-color: rgba(97, 121, 165, 0.22) !important;
  background: rgba(245, 247, 253, 0.92) !important;
  color: var(--text) !important;
  backdrop-filter: none !important;
}

body.light .tile-card-badge.favorite {
  border-color: rgba(202, 138, 4, 0.36) !important;
  background: rgba(253, 230, 138, 0.24) !important;
  color: #92650a !important;
}

body.light .tile-card-badge.note {
  background: rgba(245, 247, 253, 0.92) !important;
  border-color: rgba(112, 71, 235, 0.22) !important;
  color: var(--accent) !important;
}

@media (max-width: 720px) {
  .tile:not(.tile-add),
  .tile.has-preview:not(.tile-add),
  .tile.no-preview:not(.tile-add) {
    min-height: 128px !important;
    height: 128px !important;
    max-height: 128px !important;
    border-radius: 16px !important;
  }

  .tile-linker {
    grid-template-rows: minmax(0, 1fr) 40px !important;
  }

  .tile-card-main {
    padding: 14px 12px 12px;
  }

  .tile-card-name {
    font-size: 15px !important;
  }

  .tile-card-footer {
    min-height: 40px;
    padding: 8px;
  }

  .tile-card-badges {
    top: 9px;
    right: 9px;
    gap: 5px;
  }

  .tile-card-badge,
  .tile-card-badge.favorite,
  .tile-card-badge.note {
    width: 24px !important;
    height: 24px !important;
  }

  .tile-card-badge.favorite {
    font-size: 15px !important;
  }

  .tile-card-badge.note svg {
    width: 14px !important;
    height: 14px !important;
  }

  .tile-fallback-favicon {
    width: 22px !important;
    height: 22px !important;
    flex-basis: 22px;
  }

  .tile-card-host {
    font-size: 10px !important;
  }

  .tile-actions {
    display: flex !important;
    opacity: 0 !important;
  }

  .tile.edit-mode .tile-actions,
  .tile:focus-within .tile-actions {
    opacity: 1 !important;
    pointer-events: auto;
  }
}

@media (hover: none), (max-width: 480px) {
  .tile-menu-btn {
    opacity: 0.72 !important;
    pointer-events: auto;
  }

  .tile-note-btn {
    opacity: 0.72 !important;
    pointer-events: auto;
  }
}

/* ==========================================================================
   TB-260 Dial Card runtime integration polish
   ========================================================================== */

.status-strip {
  display: flex !important;
  align-items: center !important;
  width: min(var(--runtime-content-max), 100%) !important;
  margin: 0 auto 8px !important;
  padding: 8px 10px !important;
  gap: 10px !important;
  border: 1px solid var(--border) !important;
  border-radius: 14px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015)),
    color-mix(in srgb, var(--bg2) 54%, transparent) !important;
  box-shadow: none !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
}

.status-strip-main {
  display: flex !important;
  align-items: center !important;
  min-width: 0;
  gap: 10px !important;
}

.status-strip-primary {
  flex: 0 1 auto;
  gap: 8px !important;
}

.status-strip-secondary {
  flex: 1 1 auto;
  gap: 8px !important;
}

.trust-state {
  min-height: 28px !important;
  padding: 6px 10px !important;
  border-radius: 10px !important;
  white-space: nowrap;
}

.status-strip-summary,
.strip-data-item {
  font-size: 11px !important;
}

.status-strip-actions {
  margin-left: 0 !important;
}

.status-strip-action-buttons {
  gap: 6px !important;
}

.status-strip-action-buttons .icon-btn {
  min-height: 30px !important;
  padding: 6px 10px !important;
  border-radius: 9px !important;
}

body.runtime-view-group .tabs-frame {
  margin-bottom: 4px !important;
  padding-bottom: 2px !important;
}

body.runtime-view-group #favorites-panel:not([hidden]) {
  margin-bottom: 4px !important;
}

body.runtime-view-group .favorites-panel.is-helper-view {
  display: flex !important;
  width: min(var(--runtime-content-max), 100%) !important;
  margin: -2px auto 6px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body.runtime-view-group .favorites-panel:not(.is-helper-view) .home-favorites-title {
  display: none !important;
}

body.runtime-view-group .favorites-empty-hint {
  color: var(--text-dim) !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  line-height: 1.35 !important;
  opacity: 0.68 !important;
}

body.runtime-view-group .workspace-head {
  align-items: center !important;
  gap: 10px !important;
  margin: 0 auto 8px !important;
  padding: 6px 0 4px !important;
}

body.runtime-view-group .group-back-row {
  width: auto !important;
  flex: 0 0 auto;
  order: 0;
}

body.runtime-view-group .group-back-btn {
  min-height: 30px !important;
  height: 30px !important;
  padding: 5px 9px !important;
  border-radius: 9px !important;
  font-size: 11px !important;
  opacity: 0.78;
}

body.runtime-view-group .workspace-head-copy {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  flex: 1 1 auto;
  order: 1;
}

body.runtime-view-group .group-kicker {
  display: none !important;
}

body.runtime-view-group .group-title-row {
  min-width: 0;
  gap: 7px !important;
}

body.runtime-view-group .group-title {
  overflow: hidden;
  max-width: min(42vw, 360px);
  font-size: clamp(18px, 1.7vw, 24px) !important;
  font-weight: 760 !important;
  letter-spacing: -0.02em !important;
  line-height: 1.1 !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.runtime-view-group .workspace-head-right {
  flex: 0 0 auto;
  order: 2;
  gap: 8px !important;
  align-items: center !important;
}

body.runtime-view-group .group-count {
  order: -1;
  min-height: 30px !important;
  height: 30px !important;
  padding: 0 9px !important;
  border-radius: 9px !important;
  font-size: 11px !important;
}

body.runtime-view-group .group-sort-btn,
body.runtime-view-group .group-edit-mode-btn {
  min-height: 30px !important;
  height: 30px !important;
  padding: 0 10px !important;
  border-radius: 9px !important;
  font-size: 11px !important;
}

body.runtime-view-group .grid-wrap {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

.tile-card-name {
  font-weight: 700 !important;
  letter-spacing: 0 !important;
}

.runtime-brand-subtitle {
  max-width: 220px;
  font-size: 10px !important;
  line-height: 1.25 !important;
  opacity: 0.36 !important;
}

.groups-overflow-shell {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.groups-overflow-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(167, 139, 250, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.groups-overflow-btn:hover,
.groups-overflow-btn:focus-visible {
  border-color: rgba(167, 139, 250, 0.34);
  background: rgba(167, 139, 250, 0.09);
  color: var(--text);
}

.groups-overflow-btn:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.48);
  outline-offset: 2px;
}

@media (hover: hover) and (pointer: fine) {
  .tile:not(.tile-add):hover .tile-menu-btn,
  .tile:not(.tile-add):hover .tile-note-btn {
    opacity: 0 !important;
    pointer-events: none !important;
  }
}

body.edit-mode .tile:not(.tile-add) .tile-menu-btn,
body.edit-mode .tile:not(.tile-add) .tile-note-btn,
.tile.edit-mode:not(.tile-add) .tile-menu-btn,
.tile.edit-mode:not(.tile-add) .tile-note-btn {
  opacity: 0 !important;
  pointer-events: none !important;
}

.tile-fallback-favicon {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.10), transparent),
    color-mix(in srgb, var(--tile-accent) 16%, rgba(255, 255, 255, 0.065)) !important;
}

@media (max-width: 720px) {
  .status-strip {
    gap: 8px !important;
    padding: 7px 8px !important;
  }

  .status-strip-main {
    flex: 1 1 auto;
    display: grid !important;
    gap: 4px !important;
  }

  .status-strip-secondary {
    display: none !important;
  }

  body.runtime-view-group .tabs-frame,
  body.runtime-view-group #groups-toggle-row {
    display: none !important;
  }

  body.runtime-view-group .favorites-panel.is-helper-view {
    display: none !important;
  }

  body.runtime-view-group .workspace-head {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 4px 8px !important;
    margin-bottom: 8px !important;
    padding: 0 !important;
  }

  body.runtime-view-group .group-back-row {
    width: 100% !important;
    margin: 0 !important;
    order: 0;
  }

  body.runtime-view-group #btn-back-home {
    justify-content: flex-start !important;
    min-width: 0 !important;
    min-height: 36px !important;
    height: 36px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: transparent !important;
    color: color-mix(in srgb, var(--text-dim) 82%, var(--accent)) !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    box-shadow: none !important;
    transform: none !important;
  }

  body.runtime-view-group #btn-back-home:hover {
    background: rgba(167, 139, 250, 0.06) !important;
    color: var(--text) !important;
    transform: none !important;
  }

  body.runtime-view-group #btn-back-home:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--accent) 58%, transparent) !important;
    outline-offset: 2px !important;
  }

  body.runtime-view-group .workspace-head-copy {
    width: auto !important;
    flex: 0 1 auto !important;
    min-width: 0 !important;
    order: 1;
  }

  body.runtime-view-group .group-color-dot,
  body.runtime-view-group .group-title-icon,
  body.runtime-view-group .group-title-edit {
    display: none !important;
  }

  body.runtime-view-group .group-title-row {
    min-width: 0 !important;
    gap: 0 !important;
    flex-wrap: nowrap !important;
  }

  body.runtime-view-group .workspace-head-right {
    display: contents !important;
  }

  body.runtime-view-group .group-count {
    order: 2;
    min-height: 24px !important;
    height: auto !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: color-mix(in srgb, var(--text-dim) 86%, var(--text)) !important;
    font-size: 13px !important;
    font-weight: 650 !important;
    line-height: 1.2 !important;
  }

  body.runtime-view-group .group-count::before {
    content: "·";
    margin-right: 8px;
    color: color-mix(in srgb, var(--text-dim) 72%, transparent);
  }

  body.runtime-view-group .group-sort-btn {
    order: 3;
    margin-left: 0 !important;
  }

  body.runtime-view-group .group-edit-mode-btn {
    order: 4;
  }

  body.runtime-view-group .group-sort-btn,
  body.runtime-view-group .group-edit-mode-btn {
    margin-top: 4px !important;
    min-height: 36px !important;
    height: 36px !important;
    padding: 0 11px !important;
    border-radius: 10px !important;
    font-size: 12px !important;
    background: rgba(147, 112, 219, 0.055) !important;
    border-color: rgba(147, 112, 219, 0.14) !important;
    color: color-mix(in srgb, var(--text-dim) 88%, var(--text)) !important;
  }

  body.runtime-view-group .group-sort-btn:hover,
  body.runtime-view-group .group-edit-mode-btn:hover {
    transform: none !important;
  }

  body.runtime-view-group .group-add-btn,
  body.runtime-view-group .open-all-btn {
    display: none !important;
  }

  body.runtime-view-group .grid-wrap {
    margin-top: 0 !important;
  }

  body.runtime-view-group .grid {
    padding-top: 0 !important;
  }

  body.edit-mode.runtime-view-group .group-edit-mode-btn {
    background: var(--accent) !important;
    color: #07050f !important;
    border-color: transparent !important;
  }

  body.runtime-view-group .group-title {
    max-width: min(62vw, 270px);
    font-size: 18px !important;
    line-height: 1.15 !important;
    letter-spacing: 0 !important;
  }

  .runtime-brand-subtitle {
    display: none !important;
  }

  .groups-overflow-btn {
    min-height: 36px;
    height: 36px;
    padding-inline: 12px;
  }
}

/* ==========================================================================
   CU-TB-266 Favorites Visible Limits & Mobile Drawer list
   ========================================================================== */
.favorites-drawer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}

.favorites-drawer-list .favorite-chip {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Ensure favorites row does not overflow page width on mobile */
@media (max-width: 720px) {
  .favorites-strip {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

.favorites-drawer-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-strong, #151b27) 88%, transparent);
}

.favorites-drawer-controls input,
.favorites-drawer-controls select {
  width: 100%;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--field-border, rgba(255, 255, 255, 0.12));
  border-radius: 10px;
  background: var(--field-bg, rgba(255, 255, 255, 0.05));
  color: var(--text);
  font-size: 12px;
  outline: none;
  box-sizing: border-box;
}

.favorites-drawer-controls input:focus,
.favorites-drawer-controls select:focus {
  border-color: var(--field-border-focus, #3b82f6);
}

@media (max-width: 720px) {
  .favorites-drawer-controls {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   TB-275: Runtime Top Block Settings & Compact Layout
   ========================================================================== */
.top-blocks-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

@media (min-width: 641px) {
  body.compact-search-data .top-blocks-container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 24px;
  }

  body.compact-search-data .top-blocks-container #topbar {
    flex: 1 1 360px;
    margin-bottom: 0;
    min-width: 0;
  }

  body.compact-search-data .top-blocks-container #trust-bar {
    flex: 1.5 1 450px;
    margin: 0 !important;
    width: auto;
    min-width: 0;
  }

  body.compact-search-data #topbar,
  body.compact-search-data #trust-bar {
    min-height: 48px;
  }

  body.compact-search-data .search-input {
    min-height: 48px !important;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
  }

  body.compact-search-data .search-submit-btn {
    min-height: 48px !important;
  }

  body.compact-search-data #trust-bar {
    min-height: 48px !important;
    padding-top: 8px !important;
    padding-bottom: 8px !important;
  }

  body.compact-search-data .search-wrap {
    position: relative;
  }

  body.compact-search-data .search-helper {
    position: absolute;
    top: calc(100% + 4px);
    left: 2px;
    margin: 0;
  }

  body.compact-search-data .search-wrap,
  body.compact-search-data .status-strip-main,
  body.compact-search-data .status-strip-actions {
    align-items: center;
  }
}

/* ==========================================================================
   TB-247 Light theme runtime spacing & favorites follow-up
   Normalizes border-radius hierarchy, fixes vertical spacing rhythm,
   polishes the favorites strip/chips, and tunes card/workspace padding.
   All rules are scoped to body.light.
   ========================================================================== */

/* 1. App shell & header border-radius normalization (hierarchy: shell 20px > header 14px) */
body.light .workspace-card {
  border-radius: 20px !important;
}

body.light .app-header {
  border-radius: 14px 14px 0 0 !important; /* Top corners softly rounded, bottom edge calmer/straight */
  box-shadow: 0 8px 24px rgba(31, 23, 71, 0.04), 0 2px 6px rgba(31, 23, 71, 0.02) !important;
  border: 1px solid var(--border) !important;
  margin-bottom: 24px !important; /* separation from search/status */
}

/* 2. Top search/status area — transparent layout aligned with page shell rails */
body.light .top-blocks-container {
  padding-left: clamp(20px, 3vw, 48px) !important;
  padding-right: clamp(20px, 3vw, 48px) !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-bottom: 24px !important; /* separation from favorites strip / group tabs */
  box-sizing: border-box !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Reduce data/status panel height and align elements in one horizontal line on desktop */
body.light .status-strip {
  border-radius: 12px !important;
  padding: 6px 14px !important;
  min-height: 44px !important;
  background: var(--surface-low) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-soft) !important;
  margin-bottom: 0 !important;
}

@media (min-width: 721px) {
  body.light .top-blocks-container {
    align-items: flex-start !important;
  }

  body.light .status-strip {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 16px !important;
    height: 48px !important;
    min-height: 48px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    align-self: flex-start !important;
  }

  body.light .status-strip-main {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 16px !important;
    flex: 1 1 auto !important;
  }

  body.light .status-strip-primary {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    flex: 0 1 auto !important;
  }

  body.light .status-strip-secondary {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    flex: 0 1 auto !important;
  }

  body.light .status-strip-actions {
    display: flex !important;
    align-items: center !important;
    flex: 0 0 auto !important;
  }
}

/* Search helper text — proper margin-top, margin-bottom, stable line-height, non-absolute positioning */
body.light .search-helper {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  display: block !important;
  margin-top: 12px !important;
  margin-bottom: 18px !important;
  line-height: 1.5 !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  color: var(--text-dim) !important;
  opacity: 0.72 !important;
}

body.light .search-input,
body.light .search-submit-btn {
  border-radius: 12px !important;
}

/* 3. Favorites Strip & Chips Polish — compact pinned bookmarks look */
body.light .home-favorites-title {
  display: flex !important;
  font-size: 0 !important; /* Hide original localized text */
  margin-top: 0 !important;
  margin-bottom: 8px !important;
}

body.light .home-favorites-title::before {
  content: '★\00a0ИЗБРАННОЕ' !important; /* \00a0 is non-breaking space */
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  color: var(--runtime-amber-text, #d99516) !important; /* Calm amber/gold */
}

/* Ensure favorites label is consistently displayed in selected group view when strip is visible */
body.light.runtime-view-group .favorites-panel:not(.is-helper-view) .home-favorites-title {
  display: flex !important;
}

body.light .favorites-panel {
  padding-left: clamp(20px, 3vw, 48px) !important;
  padding-right: clamp(20px, 3vw, 48px) !important;
  margin-bottom: 24px !important; /* separation from groups/workspace */
}

body.light .favorites-strip {
  gap: 6px 10px !important; /* Row-gap 6px, Col-gap 10px */
  padding: 4px 0 6px !important;
}

body.light .favorite-chip {
  padding: 4px 10px !important;
  min-height: 28px !important;
  border-radius: 8px !important;
  gap: 6px !important;
  background: color-mix(in srgb, var(--accent, #a78bfa) 3.5%, rgba(255, 255, 255, 0.85)) !important;
  border: 1px solid color-mix(in srgb, var(--accent, #a78bfa) 10%, rgba(0, 0, 0, 0.05)) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.01) !important;
  opacity: 0.9 !important;
}

body.light .favorite-chip:hover {
  background: color-mix(in srgb, var(--accent, #a78bfa) 7%, #ffffff) !important;
  border-color: color-mix(in srgb, var(--accent, #a78bfa) 30%, rgba(0, 0, 0, 0.1)) !important;
  box-shadow: 0 3px 8px color-mix(in srgb, var(--accent) 6%, rgba(0, 0, 0, 0.03)) !important;
  transform: translateY(-1px) !important;
  opacity: 1 !important;
}

body.light .favorite-chip-icon {
  width: 16px !important;
  height: 16px !important;
  border-radius: 3px !important;
  background: color-mix(in srgb, var(--accent, #a78bfa) 10%, rgba(255, 255, 255, 0.9)) !important;
  color: var(--accent, #9370db) !important;
}

body.light .favorite-chip-icon img {
  width: 11px !important;
  height: 11px !important;
}

body.light .favorite-chip-copy {
  gap: 6px !important;
}

body.light .favorite-chip-name {
  font-size: 11px !important;
  font-weight: 600 !important;
  color: var(--text) !important;
}

body.light .favorite-chip-meta {
  font-size: 9px !important;
  font-weight: 500 !important;
  color: var(--text-dim) !important;
  opacity: 0.65 !important;
}

/* Aligned & Calmer "All favorites" control */
body.light #favorites-toggle-row {
  margin-top: 6px !important;
  display: flex !important;
  justify-content: flex-start !important;
}

body.light #favorites-toggle-row .section-toggle-btn {
  background: transparent !important;
  border: 1px solid var(--border) !important;
  color: var(--text-dim) !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  padding: 4px 10px !important;
  border-radius: 6px !important;
  box-shadow: none !important;
  transition: all 0.2s ease !important;
}

body.light #favorites-toggle-row .section-toggle-btn:hover {
  background: var(--control-hover) !important;
  border-color: var(--border-strong) !important;
  color: var(--text) !important;
}

/* 4. Section Rhythm Gaps (tabs & workspace) */
body.light .tabs-frame {
  margin-top: 24px !important; /* consistent vertical gap before group tabs */
  margin-bottom: 24px !important; /* consistent vertical gap after group tabs before workspace header */
  padding: 6px clamp(20px, 3vw, 48px) !important; /* Keep vertical padding, align side margins with workspace content */
}

body.light.runtime-view-group .workspace-head {
  margin-bottom: 16px !important;
}

/* 5. Workspace content padding and selected group view alignment */
body.light.runtime-view-group .workspace-head,
body.light.runtime-view-group .grid-wrap {
  padding-left: clamp(20px, 3vw, 48px) !important;
  padding-right: clamp(20px, 3vw, 48px) !important;
}

body.light.runtime-view-group .workspace-head {
  padding-top: 14px !important;
  padding-bottom: 12px !important;
}

/* 6. Site cards internal spacing */
body.light .tile-card-main {
  padding: 22px 20px 18px !important;
}

body.light .tile-card-footer {
  padding: 9px 13px !important;
  gap: 8px !important;
}

body.light .tile-card-meta {
  gap: 7px !important;
}

body.light .tile-fallback-favicon {
  width: 22px !important;
  height: 22px !important;
  flex: 0 0 22px !important;
}

body.light .tile-card-host {
  font-size: 11.5px !important;
  letter-spacing: 0.01em !important;
}

body.light .tile-card-badges {
  top: 16px !important;
  right: 16px !important;
}

body.light .tile-menu-btn {
  bottom: 9px !important;
  right: 10px !important;
}

body.light .tile-note-btn {
  bottom: 9px !important;
  right: 44px !important;
}

/* 7. Add-site card spacing */
body.light .tile-add {
  min-height: 148px !important;
  height: 148px !important;
  max-height: 148px !important;
  background: rgba(255, 255, 255, 0.62) !important;
  border: 1px dashed rgba(112, 71, 235, 0.28) !important;
  box-shadow: none !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
}

body.light .tile-add .plus {
  font-size: 28px !important;
  color: var(--accent) !important;
}

body.light .tile-add .add-label {
  font-size: 12px !important;
  font-weight: 700 !important;
  color: var(--text-dim) !important;
}

/* Mobile overrides (max-width: 720px) */
@media (max-width: 720px) {
  body.light .top-blocks-container {
    padding: 16px 12px 12px !important;
    margin-bottom: 20px !important;
  }

  body.light .favorites-panel {
    padding-left: 12px !important;
    padding-right: 12px !important;
    margin-bottom: 20px !important;
  }

  body.light .status-strip {
    padding: 6px 10px !important;
    gap: 8px !important;
    min-height: auto !important;
  }

  body.light .favorites-strip {
    gap: 8px !important;
    padding: 2px 12px 6px !important;
    margin-left: -12px !important;
    margin-right: -12px !important;
    width: calc(100% + 24px) !important;
  }

  body.light .search-helper {
    display: none !important;
    margin-top: 8px !important;
    margin-bottom: 10px !important;
  }

  body.light .search-wrap:focus-within .search-helper {
    display: block !important;
  }

  body.light .tabs-frame {
    margin-top: 12px !important;
    margin-bottom: 10px !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  body.light.runtime-view-group .workspace-head {
    padding-top: 10px !important;
    padding-bottom: 8px !important;
    margin-bottom: 10px !important;
  }

  body.light.runtime-view-group .workspace-head,
  body.light.runtime-view-group .grid-wrap {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  body.light .tile-card-main {
    padding: 18px 14px 14px !important;
  }

  body.light .tile-card-footer {
    padding: 8px 11px !important;
  }
}

.sync-choice-warning {
  display: block;
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, #ffcf66 34%, transparent);
  background: color-mix(in srgb, #ffcf66 12%, transparent);
  color: color-mix(in srgb, #ffdf8b 88%, var(--text));
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}
.sync-choice-warning[hidden] {
  display: none;
}

.site-footer--runtime {
  border-top: 1px solid var(--border);
  padding: 24px 8px 16px;
  margin-top: 40px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.6;
}

.footer-runtime-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-runtime-info {
  max-width: 500px;
}

.footer-runtime-desc {
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--text);
}

.footer-runtime-trust {
  margin: 0;
  color: var(--text-dim);
}

.footer-runtime-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-runtime-link {
  color: var(--text-dim);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.16s ease;
}

.footer-runtime-link:hover {
  color: var(--text);
}

.footer-runtime-link:focus-visible {
  outline: 2px solid var(--border-strong);
  outline-offset: 4px;
}

@media (max-width: 720px) {
  .footer-runtime-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .footer-runtime-links {
    width: 100%;
    justify-content: flex-start;
    gap: 12px 16px;
  }
}
