* {
  box-sizing: border-box;
}

html {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(31, 122, 104, 0.34);
  outline-offset: 2px;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.auth-locked {
  display: none !important;
}

.auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(73, 182, 156, 0.18), rgba(244, 196, 48, 0.12)),
    var(--bg);
}

.auth-card {
  width: min(560px, 100%);
  display: grid;
  gap: 18px;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.auth-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-header h1,
.auth-header p {
  margin: 0;
}

.auth-header p:not(.eyebrow) {
  color: var(--muted);
  margin-top: 6px;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-form label,
.admin-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.auth-form input,
.admin-form input,
.admin-form select {
  min-height: 42px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  padding: 0 12px;
}

.checkbox-line {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.checkbox-line input {
  min-height: auto;
}

.auth-secret {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius);
  background: #f7fbfa;
  border: 1px solid var(--line);
}

.auth-secret strong {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  word-break: break-all;
  letter-spacing: 0;
}

.auth-secret small,
.auth-note {
  color: var(--muted);
  line-height: 1.45;
}

.auth-error {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

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

.auth-user-card .secondary-button {
  width: 100%;
  justify-content: center;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
  min-width: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 14px;
  background: var(--sidebar-bg);
  color: #f8fbfa;
  position: sticky;
  top: 0;
  height: 100vh;
  min-width: 0;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 4px 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #49b69c;
  color: #10201d;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  max-width: 180px;
  overflow: hidden;
  color: #ffffff;
  font-size: 17px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand span {
  color: #b6c7c4;
  font-size: 12px;
  line-height: 1.35;
  margin-top: 4px;
}

.nav {
  display: grid;
  gap: 16px;
  min-width: 0;
  scrollbar-width: none;
}

.nav::-webkit-scrollbar {
  display: none;
}

.nav-section {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.nav-section-label {
  display: block;
  padding: 0 10px 5px;
  color: rgba(221, 236, 232, 0.58);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.nav-section-system {
  margin-top: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: rgba(244, 250, 248, 0.82);
  padding: 0 10px;
  position: relative;
  text-align: left;
  font-size: 14px;
  font-weight: 720;
  line-height: 1.1;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.nav-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: center;
  transition: transform 0.15s ease;
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  position: relative;
  width: 25px;
  height: 25px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(153, 229, 211, 0.9);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.nav-icon:not(.platform-nav-icon) {
  font-size: 0;
}

.nav-icon:not(.platform-nav-icon)::before,
.nav-icon:not(.platform-nav-icon)::after {
  content: "";
  display: block;
}

.nav-icon-dashboard::before {
  width: 13px;
  height: 13px;
  background:
    linear-gradient(currentColor 0 0) 0 0 / 5px 5px no-repeat,
    linear-gradient(currentColor 0 0) 8px 0 / 5px 5px no-repeat,
    linear-gradient(currentColor 0 0) 0 8px / 5px 5px no-repeat,
    linear-gradient(currentColor 0 0) 8px 8px / 5px 5px no-repeat;
  border-radius: 3px;
}

.nav-icon-campaigns::before {
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-left-color: transparent;
  border-radius: 50%;
}

.nav-icon-results::before {
  width: 14px;
  height: 13px;
  background:
    linear-gradient(currentColor 0 0) 1px 7px / 3px 6px no-repeat,
    linear-gradient(currentColor 0 0) 6px 3px / 3px 10px no-repeat,
    linear-gradient(currentColor 0 0) 11px 0 / 3px 13px no-repeat;
  border-radius: 2px;
}

.nav-icon-products::before {
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 4px;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.12);
}

.nav-icon-ready::before {
  width: 13px;
  height: 7px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: translateY(-1px) rotate(-45deg);
}

.nav-icon-calendar::before {
  width: 14px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 3px;
  background:
    linear-gradient(currentColor 0 0) 0 4px / 100% 2px no-repeat,
    linear-gradient(currentColor 0 0) 4px 0 / 2px 100% no-repeat,
    linear-gradient(currentColor 0 0) 9px 0 / 2px 100% no-repeat;
}

.nav-icon-tasks::before {
  width: 14px;
  height: 12px;
  background:
    radial-gradient(circle at 1px 2px, currentColor 0 1.5px, transparent 1.7px),
    radial-gradient(circle at 1px 6px, currentColor 0 1.5px, transparent 1.7px),
    radial-gradient(circle at 1px 10px, currentColor 0 1.5px, transparent 1.7px),
    linear-gradient(currentColor 0 0) 5px 1px / 9px 2px no-repeat,
    linear-gradient(currentColor 0 0) 5px 5px / 9px 2px no-repeat,
    linear-gradient(currentColor 0 0) 5px 9px / 9px 2px no-repeat;
}

.nav-icon-releases::before {
  width: 14px;
  height: 14px;
  background: currentColor;
  clip-path: polygon(50% 0, 61% 34%, 98% 35%, 68% 56%, 79% 91%, 50% 69%, 21% 91%, 32% 56%, 2% 35%, 39% 34%);
}

.nav-icon-settings::before {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.13);
}

.nav-icon-admin::before {
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 4px;
}

.nav-icon-admin::after {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: translate(-50%, -50%);
}

.platform-nav-icon {
  color: #ffffff;
  background: rgba(73, 182, 156, 0.16);
}

.nav-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.platform-icon-img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.nav-icon-img {
  width: 18px;
  height: 18px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.nav-item.active::before {
  transform: scaleY(1);
}

.nav-item.active .nav-icon {
  background: var(--accent);
  color: #ffffff;
}

.sidebar-card {
  margin-top: auto;
  padding: 13px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.11);
}

.sidebar-card strong,
.sidebar-card small {
  display: block;
}

.sidebar-card strong {
  margin-top: 8px;
}

.sidebar-card small {
  color: #b6c7c4;
  margin-top: 4px;
}

.workspace {
  padding: 24px 28px 32px;
  max-width: none;
  width: 100%;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  margin-bottom: 18px;
  padding: 0 0 18px;
  border-bottom: 1px solid rgba(32, 48, 54, 0.1);
}

.topbar > div {
  min-width: 0;
}

.topbar h1,
.section-header h2,
.modal-header h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 26px;
  line-height: 1.12;
  max-width: 900px;
}

.topbar-actions,
.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.topbar-actions > .muted {
  flex-basis: 100%;
  text-align: right;
  font-size: 12px;
  line-height: 1.35;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-weight: 800;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.sidebar .eyebrow {
  color: #88d8c6;
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  min-height: 38px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 750;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.primary-button {
  background: var(--accent);
  color: white;
  padding: 0 15px;
  box-shadow: 0 8px 18px rgba(31, 122, 104, 0.16);
}

.secondary-button {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
  padding: 0 13px;
}

.danger-button {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #ffc7c7;
  padding: 0 14px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
  font-size: 20px;
}

.primary-button:hover,
.secondary-button:hover,
.danger-button:hover,
.icon-button:hover {
  border-color: rgba(31, 122, 104, 0.42);
  box-shadow: var(--shadow-soft);
}

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

.stat-card {
  min-height: 104px;
  padding: 15px;
  border-radius: var(--radius);
  background: var(--surface);
  border: var(--panel-border);
  box-shadow: var(--panel-shadow);
}

.stat-card span,
.stat-card small,
.muted {
  color: var(--muted);
}

.stat-card span,
.stat-card small {
  display: block;
}

.stat-card strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 30px;
  letter-spacing: 0;
}

.tool-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 220px 190px;
  gap: 10px;
  margin-bottom: 18px;
  padding: 10px;
  border: var(--panel-border);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 4px 18px rgba(23, 33, 38, 0.035);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 14px;
}

.search-box input,
.tool-row select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.tool-row select {
  min-height: 42px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
}

body:not([data-active-section="dashboard"]) .stats-grid,
body[data-active-section="dashboard"][data-active-section-view="tasks"] .stats-grid,
body:not([data-active-section="calendar"]) .tool-row {
  display: none;
}

body:not([data-active-section="dashboard"]):not([data-active-section="calendar"]) #openFormBtn {
  display: none;
}

