:root {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

:focus-visible {
  outline: 3px solid #3b6ede;
  outline-offset: 2px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f4f6fb;
  color: #1a1f2e;
}

a {
  color: #2c5cc5;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.page {
  width: 100%;
}

.shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  gap: 18px;
}

.shell-sm {
  max-width: 560px;
}

.shell-md {
  max-width: 800px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.topbar nav,
.topbar .row {
  gap: 8px;
}

.logo {
  color: #1a1f2e;
  font-weight: 700;
  font-size: 19px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.brand-logo {
  height: 30px;
  width: auto;
  display: block;
  border-radius: 8px;
}

.brand-wordmark {
  margin-left: 8px;
  font-size: 18px;
  font-weight: 700;
  color: #1a1f2e;
}

.hero {
  display: grid;
  gap: 12px;
  padding: 30px;
  border-radius: 16px;
  border: 1px solid #d4dae8;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.hero-layout {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 1fr);
  align-items: center;
  gap: 24px;
}

.hero-copy {
  display: grid;
  gap: 12px;
}

.hero h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.15;
}

.hero p {
  margin: 0;
  color: #4a5270;
  max-width: 760px;
}

.hero .row {
  margin-top: 4px;
}

.hero-visual {
  position: relative;
  min-height: 280px;
  border-radius: 14px;
  border: 1px solid #d4dae8;
  background: linear-gradient(160deg, #eef2fb, #e4eaf8);
  overflow: hidden;
  padding: 18px;
}

.visual-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
  opacity: 0.9;
}

.orb-a {
  width: 180px;
  height: 180px;
  background: radial-gradient(circle at 30% 30%, rgba(109, 147, 255, 0.25), rgba(74, 99, 201, 0.06) 70%);
  top: -52px;
  right: -24px;
}

.orb-b {
  width: 160px;
  height: 160px;
  background: radial-gradient(circle at 40% 40%, rgba(79, 222, 255, 0.2), rgba(21, 68, 112, 0.05) 72%);
  bottom: -46px;
  left: -34px;
}

.visual-card {
  position: relative;
  border: 1px solid #c8d2e8;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(2px);
}

.card-main {
  z-index: 2;
  padding: 16px;
  min-height: 210px;
  display: grid;
  gap: 10px;
}

.card-float {
  position: absolute;
  z-index: 3;
  right: 18px;
  bottom: 16px;
  width: 150px;
  padding: 12px;
  display: grid;
  gap: 8px;
  border-color: #c8d2e8;
}

.visual-chip {
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.03em;
  color: #2c5cc5;
  border: 1px solid #b8c8e8;
  background: rgba(44, 92, 197, 0.08);
}

.visual-line {
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(44, 92, 197, 0.3), rgba(86, 117, 217, 0.12));
}

.line-lg { width: 88%; }
.line-md { width: 62%; }
.line-sm { width: 74%; height: 8px; }

.visual-bars {
  margin-top: auto;
  height: 96px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  align-items: end;
}

.visual-bars span {
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, rgba(44, 92, 197, 0.5), rgba(79, 112, 226, 0.3));
}

.visual-pill {
  width: 62%;
  height: 8px;
  border-radius: 999px;
  background: rgba(44, 92, 197, 0.18);
}

.hero-inline h1 {
  margin: 8px 0 6px;
}

.card {
  background: #ffffff;
  border: 1px solid #d4dae8;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.card h2,
.card h3 {
  margin-top: 0;
}

.auth-card {
  display: grid;
  gap: 14px;
}

.grid {
  display: grid;
  gap: 12px;
}

.three-col {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.two-col {
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
}

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

.row.space-between {
  justify-content: space-between;
}

.row.end {
  justify-content: flex-end;
}

.row.start {
  justify-content: flex-start;
}

.pill {
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef2fb;
  font-size: 12px;
  border: 1px solid #c8d2e8;
  color: #2c5cc5;
}

.form {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

input {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #cdd4e0;
  background: #ffffff;
  color: #1a1f2e;
}

input:focus {
  outline: 2px solid #3b6ede;
  outline-offset: 1px;
}

select {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #cdd4e0;
  background: #ffffff;
  color: #1a1f2e;
}

select:focus {
  outline: 2px solid #3b6ede;
  outline-offset: 1px;
}

.btn {
  border: 1px solid #cdd4e0;
  background: #ffffff;
  color: #1a1f2e;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
}

.btn:disabled,
.btn[aria-busy='true'] {
  opacity: 0.65;
  cursor: not-allowed;
  filter: none;
}

.btn.primary {
  background: #2c5cc5;
  border-color: #2451b0;
  color: #ffffff;
}

.btn.chrome-install {
  font-size: 16px;
  font-weight: 700;
  padding: 14px 18px;
  min-height: 52px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(44, 92, 197, 0.25);
}

.btn:hover {
  filter: brightness(1.1);
  text-decoration: none;
}

.saved-tabs-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.tabs-workspace {
  padding: 20px;
}

.batch-actions {
  margin-top: 12px;
  border: 1px solid #d4dae8;
  border-radius: 10px;
  background: #f0f3fa;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.batch-info {
  color: #4a5270;
  font-size: 13px;
}

.tabs-controls {
  margin-top: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(240px, 1fr) repeat(2, minmax(140px, 170px)) auto;
  align-items: end;
}

.control-field {
  margin: 0;
}

.control-input,
.control-select {
  width: 100%;
}

.control-input {
  padding-right: 12px;
}

.select-modern {
  position: relative;
  display: block;
}

.select-modern::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 12px;
  width: 8px;
  height: 8px;
  margin-top: -6px;
  border-right: 2px solid #6b7a9e;
  border-bottom: 2px solid #6b7a9e;
  transform: rotate(45deg);
  pointer-events: none;
}

.control-select {
  appearance: none;
  padding-right: 36px;
  background: linear-gradient(180deg, #ffffff 0%, #f8f9fc 100%);
}

.tab-group {
  border: 1px solid #d4dae8;
  border-radius: 12px;
  padding: 12px;
  background: #ffffff;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  grid-template-areas:
    'checkbox header'
    'checkbox meta'
    'checkbox list';
  gap: 12px;
}

.tab-group.selected {
  border-color: #2c5cc5;
  box-shadow: 0 0 0 2px rgba(44, 92, 197, 0.12) inset;
}

.group-checkbox {
  display: flex;
  align-items: flex-start;
  padding-top: 8px;
  grid-area: checkbox;
}

.group-select-checkbox {
  width: 16px;
  height: 16px;
}

.tab-group-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  grid-area: header;
}

.tab-group > .muted {
  grid-area: meta;
  margin: 2px 0 0;
}

.tab-group-header-left,
.tab-group-header-right {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.group-name-input {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #cdd4e0;
  background: #f8f9fc;
  color: #1a1f2e;
  font-weight: 600;
  min-width: 220px;
  max-width: 520px;
}

.btn.btn-small {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 13px;
}

.tab-group h3 {
  margin: 0;
  font-size: 16px;
}

.tab-count {
  font-size: 12px;
  background: #eef2fb;
  padding: 4px 8px;
  border-radius: 999px;
  color: #2c5cc5;
}

.tab-items {
  margin: 10px 0 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 6px;
  grid-area: list;
}

.tab-item {
  line-height: 1.3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid #e2e6f0;
  border-radius: 8px;
  padding: 8px 10px;
  background: #f8f9fc;
}

.tab-item-link {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.tab-title,
.tab-url {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-title {
  color: #1a1f2e;
  font-weight: 600;
}

.tab-url {
  color: #6b7a9e;
  font-size: 12px;
}

.tab-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.group-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.action-btn {
  border-color: #cdd4e0;
  background: linear-gradient(180deg, #ffffff 0%, #f4f6fb 100%);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04) inset;
}

.action-btn:hover {
  background: linear-gradient(180deg, #f4f6fb 0%, #eef1f8 100%);
}

.danger-btn {
  border-color: #e8b4c0;
  background: linear-gradient(180deg, #fdf0f2 0%, #f9e6ea 100%);
  color: #a33048;
}

.danger-btn:hover {
  background: linear-gradient(180deg, #f9e6ea 0%, #f4d8df 100%);
}

.tab-actions .btn {
  min-width: 36px;
}

.empty-state {
  border: 1px dashed #c8d2e8;
  border-radius: 10px;
  padding: 16px;
  margin-top: 12px;
}

.empty-state h3 {
  margin-top: 0;
}

.hidden {
  display: none;
}

.message {
  min-height: 22px;
  color: #4a5270;
}

.message.success {
  color: #1a8a4a;
}

.message.error {
  color: #c93545;
}

.danger-zone {
  border-color: #e8b4c0;
  background: linear-gradient(180deg, #fdf5f7 0%, #faf0f2 100%);
}

.danger-zone h2 {
  color: #a33048;
}

.muted {
  color: #6b7a9e;
  font-size: 14px;
}

.muted.strong {
  color: #4a5270;
}

.help-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
}

.cta {
  text-align: center;
  display: grid;
  gap: 10px;
}

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

.kpi-card {
  border: 1px solid #d4dae8;
  background: #ffffff;
  border-radius: 12px;
  padding: 14px;
  display: grid;
  gap: 6px;
}

.kpi-label {
  color: #6b7a9e;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-value {
  color: #1a1f2e;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.feature-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 7px;
}

.feature-list li {
  color: #4a5270;
}

.legal h1 {
  margin-top: 0;
}

.legal .effective-date {
  color: #6b7a9e;
  font-size: 13px;
  margin-top: -4px;
}

.legal h2 {
  margin-bottom: 8px;
}

.legal p {
  margin-top: 0;
  color: #4a5270;
}

.legal ul {
  margin-top: 0;
  margin-bottom: 16px;
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

.legal li {
  color: #4a5270;
}

.site-footer {
  border-top: 1px solid #d4dae8;
  padding-top: 14px;
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  color: #6b7a9e;
  font-size: 13px;
}

.site-footer a {
  color: #2c5cc5;
}

.footer-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

hr {
  border: 0;
  border-top: 1px solid #d4dae8;
  margin: 16px 0;
}

@media (max-width: 800px) {
  .two-col {
    grid-template-columns: 1fr;
  }

  .tabs-controls {
    grid-template-columns: 1fr;
  }

  .batch-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .tab-group {
    grid-template-columns: 1fr;
    grid-template-areas:
      'checkbox'
      'header'
      'meta'
      'list';
  }

  .group-checkbox {
    padding-top: 0;
  }

  .tab-group-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .tab-group-header-left,
  .tab-group-header-right {
    width: 100%;
    justify-content: space-between;
  }

  .group-actions {
    justify-content: flex-start;
  }

  .group-name-input {
    min-width: 0;
    width: 100%;
  }

  .hero-layout {
    grid-template-columns: 1fr;
  }

  .hero-visual {
    min-height: 240px;
  }

  .topbar {
    flex-direction: column;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero h1 {
    font-size: 28px;
  }
}

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