:root,
[data-bs-theme="light"] {
  --bs-primary: #0f766e;
  --bs-primary-rgb: 15, 118, 110;
  --bs-body-font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --bs-body-bg: #f3f5f9;
  --bs-body-color: #121826;
  --bs-secondary-color: #5c6b7e;
  --bs-border-color: rgba(18, 24, 38, 0.08);
  --bs-border-radius: 0.85rem;
  --bs-link-color: #0f766e;
  --bs-link-color-rgb: 15, 118, 110;
  --bs-link-hover-color: #0d9488;
  --bs-link-hover-color-rgb: 13, 148, 136;
  --bs-card-bg: #ffffff;
  --bs-card-color: #121826;
  --bs-card-border-color: rgba(18, 24, 38, 0.08);
  --bs-focus-ring-color: rgba(15, 118, 110, 0.28);
  --surface: #ffffff;
  --line: rgba(18, 24, 38, 0.08);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 12px 32px rgba(16, 24, 40, 0.06);
  --ink: #0b1220;
  color-scheme: light;
}

[data-bs-theme="dark"] {
  --bs-body-bg: #0c1118;
  --bs-body-color: #e7edf6;
  --bs-secondary-color: #9aa6b8;
  --bs-tertiary-bg: #18202c;
  --bs-border-color: rgba(231, 237, 246, 0.1);
  --bs-link-color: #5eead4;
  --bs-link-color-rgb: 94, 234, 212;
  --bs-link-hover-color: #99f6e4;
  --bs-link-hover-color-rgb: 153, 246, 228;
  --bs-card-bg: #151c27;
  --bs-card-color: #e7edf6;
  --bs-card-border-color: rgba(231, 237, 246, 0.1);
  --bs-emphasis-color: #f8fafc;
  --surface: #151c27;
  --line: rgba(231, 237, 246, 0.1);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.28), 0 14px 36px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 420px at -10% -20%, rgba(15, 118, 110, 0.14), transparent 58%),
    radial-gradient(800px 360px at 110% -10%, rgba(20, 184, 166, 0.08), transparent 52%),
    var(--bs-body-bg);
  letter-spacing: -0.011em;
}

a { text-decoration: none; }
a:hover { text-decoration: none; }

::selection { background: rgba(20, 184, 166, 0.28); }

.btn {
  --bs-btn-border-radius: 0.8rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.btn-primary {
  --bs-btn-bg: #0f766e;
  --bs-btn-border-color: #0f766e;
  --bs-btn-hover-bg: #0d9488;
  --bs-btn-hover-border-color: #0d9488;
  --bs-btn-active-bg: #115e59;
  --bs-btn-active-border-color: #115e59;
  --bs-btn-disabled-bg: #0f766e;
  --bs-btn-disabled-border-color: #0f766e;
  --bs-btn-color: #fff;
  --bs-btn-hover-color: #fff;
  --bs-btn-active-color: #fff;
}

.btn-outline-secondary {
  --bs-btn-color: var(--bs-body-color);
  --bs-btn-border-color: var(--line);
  --bs-btn-hover-bg: rgba(15, 118, 110, 0.08);
  --bs-btn-hover-border-color: rgba(15, 118, 110, 0.35);
  --bs-btn-hover-color: var(--bs-body-color);
  --bs-btn-active-bg: rgba(15, 118, 110, 0.14);
  --bs-btn-active-color: var(--bs-body-color);
}

.form-control,
.form-select {
  border-radius: 0.8rem;
  border-color: var(--line);
  background-color: var(--surface);
  padding: 0.65rem 0.8rem;
  box-shadow: none;
}

.form-control:focus,
.form-select:focus {
  border-color: #0f766e;
  box-shadow: 0 0 0 0.22rem rgba(15, 118, 110, 0.18);
}

.form-label {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--bs-secondary-color);
  margin-bottom: 0.35rem;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
  background-color: #101720;
  border-color: rgba(231, 237, 246, 0.12);
  color: #e7edf6;
}

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 272px;
  flex: 0 0 272px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1rem 0.85rem 1.1rem;
  color: #d5deea;
  background:
    radial-gradient(420px 220px at 0% 0%, rgba(45, 212, 191, 0.18), transparent 62%),
    linear-gradient(180deg, #152033 0%, #0b1220 58%, #090f1a 100%);
  z-index: 1040;
}

.brand-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  padding: 0.25rem 0.45rem 0.85rem;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(20, 184, 166, 0.25);
}

.brand-name {
  display: block;
  font-weight: 800;
  letter-spacing: -0.04em;
  font-size: 1.05rem;
  line-height: 1.1;
}

.brand-sub {
  display: block;
  margin-top: 0.12rem;
  color: rgba(213, 222, 234, 0.55);
  font-size: 0.75rem;
  font-weight: 600;
}

.sidebar .icon-btn {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.14);
  margin-top: 0.15rem;
}

.sidebar-nav { overflow: auto; padding: 0.15rem 0.15rem 0.5rem; }

.nav-label {
  margin: 1.05rem 0.75rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(213, 222, 234, 0.42);
}

.nav-label:first-child { margin-top: 0.2rem; }

.side-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: #d5deea;
  border-radius: 0.85rem;
  padding: 0.62rem 0.75rem;
  margin-bottom: 0.12rem;
  font-weight: 650;
  font-size: 0.94rem;
  white-space: nowrap;
}

.side-link i {
  width: 1.2rem;
  text-align: center;
  font-size: 1.05rem;
  opacity: 0.88;
}

.side-link:hover { background: rgba(255, 255, 255, 0.05); color: #fff; }

.side-link.is-active {
  background: rgba(45, 212, 191, 0.14);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.3);
}

.side-link.is-active i { color: #5eead4; opacity: 1; }

.side-link:focus-visible,
.icon-btn:focus-visible {
  outline: 2px solid #5eead4;
  outline-offset: 2px;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(7, 11, 18, 0.52);
  z-index: 1030;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.35rem;
  background: color-mix(in srgb, var(--bs-body-bg) 78%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.today-label {
  margin: 0.1rem 0 0;
  color: var(--bs-secondary-color);
  font-size: 0.78rem;
  font-weight: 600;
}

.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }

.icon-btn {
  width: 2.4rem;
  height: 2.4rem;
  display: inline-grid;
  place-items: center;
  border-radius: 0.8rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: inherit;
  padding: 0;
}

.icon-btn:hover {
  border-color: rgba(15, 118, 110, 0.4);
  color: #0f766e;
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.18rem 0.7rem 0.18rem 0.18rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-weight: 700;
  font-size: 0.88rem;
}

.avatar {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #0f766e;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
}

.app-content { padding: 1.35rem 1.35rem 2.75rem; }

.acp-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.acp-card > .card-body { padding: 1.1rem 1.15rem; }

.acp-card-header {
  background: transparent;
  border-bottom: 1px solid var(--line);
  padding: 0.95rem 1.15rem;
}

.section-title {
  font-size: 0.98rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  margin: 0 0 0.85rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  height: 100%;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.15rem;
  padding: 1rem 1.05rem 0.95rem;
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 118, 110, 0.35);
  color: inherit;
}

.stat-icon {
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border-radius: 0.75rem;
  margin-bottom: 0.45rem;
  background: rgba(15, 118, 110, 0.12);
  color: #0f766e;
  font-size: 1.05rem;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}

.stat-label {
  color: var(--bs-secondary-color);
  font-size: 0.84rem;
  font-weight: 650;
}

.stat-card.is-alert .stat-icon {
  background: rgba(180, 35, 24, 0.12);
  color: #b42318;
}

.stat-card.is-alert .stat-value { color: #b42318; }

[data-bs-theme="dark"] .stat-card.is-alert .stat-value,
[data-bs-theme="dark"] .stat-card.is-alert .stat-icon { color: #fca5a5; }

.stack-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
}

.stack-item:first-child { padding-top: 0; }
.stack-item:last-child { border-bottom: 0; padding-bottom: 0; }

.empty-note { color: var(--bs-secondary-color); margin: 0; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: rgba(15, 23, 42, 0.05);
  color: #5c6b7e;
}

.status-pill::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: currentColor;
}

.status-open,
.status-idea,
.status-planned,
.status-unread,
.status-normal { color: #175cd3; background: rgba(23, 92, 211, 0.1); }

.status-in_progress { color: #0f766e; background: rgba(15, 118, 110, 0.12); }
.status-waiting,
.status-high { color: #b54708; background: rgba(181, 71, 8, 0.12); }
.status-done,
.status-completed,
.status-read { color: #067647; background: rgba(6, 118, 71, 0.12); }
.status-archived,
.status-low { color: #5b6b79; background: rgba(91, 107, 121, 0.12); }
.status-critical { color: #b42318; background: rgba(180, 35, 24, 0.12); }

[data-bs-theme="dark"] .status-open,
[data-bs-theme="dark"] .status-idea,
[data-bs-theme="dark"] .status-planned,
[data-bs-theme="dark"] .status-unread,
[data-bs-theme="dark"] .status-normal { color: #93c5fd; }

[data-bs-theme="dark"] .status-in_progress { color: #5eead4; }
[data-bs-theme="dark"] .status-waiting,
[data-bs-theme="dark"] .status-high { color: #fdba74; }
[data-bs-theme="dark"] .status-done,
[data-bs-theme="dark"] .status-completed,
[data-bs-theme="dark"] .status-read { color: #6ee7b7; }
[data-bs-theme="dark"] .status-critical { color: #fca5a5; }
[data-bs-theme="dark"] .status-archived,
[data-bs-theme="dark"] .status-low { color: #cbd5e1; }

.acp-table {
  --bs-table-bg: transparent;
  --bs-table-color: inherit;
  --bs-table-border-color: var(--line);
  --bs-table-hover-bg: rgba(15, 118, 110, 0.06);
  --bs-table-hover-color: inherit;
  margin-bottom: 0;
}

.acp-table thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bs-secondary-color);
  font-weight: 750;
  white-space: nowrap;
  border-bottom-width: 1px;
  padding: 0.8rem 0.9rem;
}

.acp-table td {
  padding: 0.85rem 0.9rem;
  vertical-align: middle;
}

.link-strong {
  color: inherit;
  font-weight: 700;
}

.link-strong:hover { color: #0f766e; }
[data-bs-theme="dark"] .link-strong:hover { color: #5eead4; }

.acp-progress {
  height: 0.42rem;
  background: rgba(15, 118, 110, 0.12);
  border-radius: 999px;
}

.acp-progress .progress-bar {
  background: linear-gradient(90deg, #0f766e, #2dd4bf);
}

.acp-alert {
  border: 0;
  border-radius: 0.95rem;
  font-weight: 600;
}

.alert-success.acp-alert {
  background: rgba(6, 118, 71, 0.12);
  color: #065f46;
}

.alert-danger.acp-alert {
  background: rgba(180, 35, 24, 0.12);
  color: #9f1239;
}

[data-bs-theme="dark"] .alert-success.acp-alert { color: #6ee7b7; }
[data-bs-theme="dark"] .alert-danger.acp-alert { color: #fda4af; }

.ai-thread {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: min(52vh, 560px);
  overflow: auto;
  margin-bottom: 1rem;
  padding-right: 0.15rem;
}

.ai-bubble {
  max-width: min(100%, 42rem);
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  border: 1px solid var(--line);
  white-space: pre-wrap;
  line-height: 1.55;
}

.ai-bubble.user {
  align-self: flex-end;
  background: rgba(15, 118, 110, 0.12);
  border-bottom-right-radius: 0.35rem;
}

.ai-bubble.assistant {
  align-self: flex-start;
  background: color-mix(in srgb, var(--surface) 88%, #0f766e 12%);
  border-bottom-left-radius: 0.35rem;
}

.auth-body {
  min-height: 100vh;
  background: var(--bs-body-bg);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
}

.auth-aside {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
  padding: 2.5rem 2.75rem;
  color: #e8eef6;
  background:
    radial-gradient(520px 260px at 12% 8%, rgba(45, 212, 191, 0.22), transparent 62%),
    linear-gradient(165deg, #172338 0%, #0b1220 68%);
}

.auth-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 1.25rem;
  color: #5eead4;
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-headline {
  font-size: clamp(2rem, 4vw, 3.1rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.05;
  margin: 0 0 0.85rem;
  max-width: 12ch;
}

.auth-lead {
  max-width: 34rem;
  margin: 0;
  color: rgba(232, 238, 246, 0.72);
  font-size: 1.05rem;
  line-height: 1.55;
}

.auth-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.7rem;
}

.auth-points li {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: rgba(232, 238, 246, 0.86);
  font-weight: 600;
}

.auth-points i {
  width: 1.7rem;
  height: 1.7rem;
  display: grid;
  place-items: center;
  border-radius: 0.55rem;
  background: rgba(45, 212, 191, 0.14);
  color: #5eead4;
}

.auth-panel {
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.35rem;
  padding: 1.6rem 1.5rem 1.4rem;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin: 0 0 0.35rem;
}

.center-card {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 86vw);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: none;
  }

  body.sidebar-open .sidebar {
    transform: none;
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.35);
  }

  body.sidebar-open .sidebar-backdrop { display: block; }
  body.sidebar-open { overflow: hidden; }

  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { padding: 1.15rem 1.2rem; }
  .auth-kicker,
  .auth-headline,
  .auth-lead,
  .auth-points { display: none; }
  .app-content { padding: 1rem 1rem 2.25rem; }
  .topbar { padding: 0.75rem 0.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .stat-card { transition: none; }
}
