:root {
  color-scheme: dark;
  --bg: #06163a;
  --bg-deep: #020819;
  --card: rgba(5, 25, 64, 0.76);
  --card-strong: rgba(8, 39, 92, 0.86);
  --line: rgba(123, 224, 255, 0.24);
  --line-strong: rgba(160, 239, 255, 0.68);
  --text: #f7fbff;
  --muted: #c9def8;
  --blue-5: #d9f6ff;
  --cyan: #69e8ff;
  --teal: #90f4ff;
  --electric: #2e8cff;
  --orange: #ffad22;
  --berry: #1849b8;
  --shadow: 0 26px 82px rgba(0, 10, 34, 0.48);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  min-height: 100%;
  background: #06163a;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 0%, rgba(91, 226, 255, 0.22), transparent 25%),
    radial-gradient(circle at 92% 18%, rgba(33, 112, 255, 0.26), transparent 34%),
    linear-gradient(150deg, #020819 0%, #061642 48%, #073073 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(80, 224, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(80, 224, 255, 0.028) 1px, transparent 1px);
  background-position: 0 0, 0 0;
  background-size: 34px 34px, 34px 34px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.42), transparent 96%);
  pointer-events: none;
}

body::after {
  content: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

#app {
  position: relative;
  z-index: 1;
  width: min(100%, 880px);
  margin: 0 auto;
  padding: 12px 12px 118px;
}

.auth-shell,
.app-shell,
.tab-section,
.form-grid,
.partner-list,
.request-list,
.user-list,
.team-board,
.team-children {
  display: grid;
  gap: 14px;
}

.auth-card,
.panel,
.app-topbar,
.member-modal {
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(7, 29, 73, 0.9), rgba(4, 18, 49, 0.84)),
    radial-gradient(circle at 18% 0%, rgba(148, 243, 255, 0.1), transparent 30%);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-card,
.panel {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border-radius: var(--radius-xl);
}

.auth-card::after,
.panel::after {
  content: "";
  position: absolute;
  right: -42px;
  top: -52px;
  width: 150px;
  height: 150px;
  border-radius: 38px;
  background:
    linear-gradient(135deg, rgba(168, 245, 255, 0.22), rgba(32, 124, 255, 0.03)),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.14) 0 1px, transparent 1px 9px);
  transform: rotate(16deg);
  opacity: 0.18;
  pointer-events: none;
}

.auth-card {
  width: min(100%, 560px);
  margin: 10vh auto 0;
}

.app-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 22px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-copy {
  display: grid;
  gap: 4px;
}

.hero-top,
.panel-heading,
.top-actions,
.debug-row,
.action-row,
.request-head,
.user-head,
.team-card-head,
.team-pill-row,
.team-card-actions,
.month-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-top,
.panel-heading,
.request-head,
.user-head {
  justify-content: space-between;
  align-items: flex-start;
}

.top-actions,
.debug-row,
.action-row,
.team-pill-row,
.team-card-actions,
.month-row {
  align-items: center;
}

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

.split-actions {
  justify-content: space-between;
}

.split-actions .button {
  flex: 1;
}

.compact-head {
  align-items: center;
}

.tiny-label,
.status-chip,
.role-pill,
.team-pill,
.quality-pill,
.top-pill,
.owner-pill,
.month-chip,
.nav-btn {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tiny-label,
.auth-card p,
.panel p,
.identity-card span,
.summary-box span,
.metric-card span,
.partner-main small,
.request-note,
.empty-state,
.team-card-copy small,
.team-stats span,
.select-option small {
  color: var(--muted);
}

h1,
h2,
h3,
strong {
  margin: 0;
}

h1,
h2,
h3 {
  font-family: "Space Grotesk", sans-serif;
}

p {
  margin: 0;
  line-height: 1.5;
}

.status-chip,
.role-pill,
.team-pill,
.quality-pill,
.top-pill,
.owner-pill,
.month-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(67, 203, 255, 0.18);
  background: linear-gradient(180deg, rgba(16, 44, 78, 0.78), rgba(11, 30, 54, 0.84));
}

.status-chip {
  color: var(--blue-5);
}

.status-chip.waiting {
  color: #effcff;
  background: linear-gradient(135deg, rgba(26, 113, 168, 0.92), rgba(14, 52, 101, 0.92));
}

.role-pill.owner {
  color: #f5fcff;
  background: linear-gradient(135deg, rgba(33, 132, 255, 0.98), rgba(37, 220, 255, 0.88));
}

.role-pill.admin {
  color: #e4f9ff;
  background: rgba(20, 94, 176, 0.86);
}

.role-pill.manager {
  color: #d8f5ff;
  background: rgba(17, 62, 118, 0.82);
}

.team-pill.owner {
  color: #f2fbff;
  background: rgba(37, 128, 255, 0.24);
}

.team-pill.admin,
.team-pill.affiliate {
  color: #dbf7ff;
  background: rgba(28, 135, 196, 0.2);
}

.team-pill.local {
  color: #d7f0ff;
  background: rgba(18, 96, 168, 0.18);
}

.quality-pill.red {
  color: #ffe4ec;
  background: rgba(255, 82, 119, 0.18);
  border-color: rgba(255, 82, 119, 0.34);
}

.quality-pill.yellow {
  color: #fff4b6;
  background: rgba(255, 214, 79, 0.18);
  border-color: rgba(255, 214, 79, 0.34);
}

.quality-pill.green {
  color: #d7fff4;
  background: rgba(55, 240, 208, 0.16);
  border-color: rgba(55, 240, 208, 0.34);
}

.quality-pill.gold,
.top-pill {
  color: #ffe9bf;
  background: rgba(255, 158, 27, 0.18);
  border-color: rgba(255, 158, 27, 0.34);
}

.owner-pill {
  color: var(--blue-5);
}

.identity-card,
.auth-block,
.summary-box,
.metric-card,
.partner-row,
.request-card,
.user-card,
.team-card,
.empty-state,
.archive-box,
.modal-box {
  border: 1px solid rgba(60, 193, 255, 0.14);
  background:
    linear-gradient(180deg, rgba(5, 25, 64, 0.94), rgba(3, 15, 38, 0.94));
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 0 rgba(220, 255, 255, 0.05);
}

.identity-card,
.auth-block,
.summary-box,
.metric-card,
.request-card,
.user-card,
.empty-state,
.archive-box,
.modal-box,
.team-card {
  padding: 14px;
}

.identity-card {
  display: grid;
  gap: 6px;
}

.identity-card strong {
  font-size: 20px;
}

.notice {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 20px));
  padding: 13px 15px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(63, 205, 255, 0.22);
  background: rgba(9, 31, 60, 0.86);
  z-index: 40;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.34);
}

.notice.success {
  border-color: rgba(55, 240, 208, 0.28);
  background: rgba(11, 74, 84, 0.62);
}

.notice.error {
  border-color: rgba(255, 82, 119, 0.24);
  background: rgba(87, 19, 42, 0.62);
}

.dual-grid,
.summary-grid,
.metric-grid,
.workspace-grid,
.modal-grid,
.toolbar-grid,
.triple-grid {
  display: grid;
  gap: 12px;
}

.dual-grid,
.summary-grid,
.modal-grid {
  grid-template-columns: repeat(2, 1fr);
}

.language-switch-card {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.language-switch {
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid rgba(116, 221, 255, 0.2);
  border-radius: 999px;
  background: rgba(2, 16, 45, 0.72);
  box-shadow: inset 0 1px 0 rgba(220, 255, 255, 0.05);
}

.language-button {
  min-width: 58px;
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  letter-spacing: 0.04em;
}

.language-button.active {
  color: #f5fdff;
  background: linear-gradient(135deg, rgba(28, 138, 255, 0.98), rgba(42, 225, 255, 0.86));
  box-shadow: 0 10px 26px rgba(18, 164, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

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

.triple-grid {
  grid-template-columns: repeat(3, 1fr);
}

.workspace-grid {
  grid-template-columns: 1fr;
}

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

.partners-toolbar .toolbar-search {
  grid-column: 1 / -1;
}

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

.filter-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
}

.filter-actions .button {
  flex: 1;
}

.form-row {
  display: grid;
  gap: 8px;
}

.form-row.compact {
  min-width: 0;
}

.form-row label {
  color: var(--muted);
  font-size: 13px;
}

.deal-model-field {
  align-content: start;
}

.deal-model-stack {
  gap: 10px;
}

.deal-model-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.deal-add-button,
.deal-remove-button {
  min-height: 40px;
}

.deal-model-field .select-menu {
  margin-bottom: 8px;
}

.native-select-wrap {
  position: relative;
}

.native-select {
  appearance: none;
  padding-right: 46px;
}

.native-select-caret {
  position: absolute;
  top: 50%;
  right: 18px;
  width: 12px;
  height: 12px;
  border-right: 2px solid #7cecff;
  border-bottom: 2px solid #7cecff;
  transform: translateY(-60%) rotate(45deg);
  pointer-events: none;
}

.deal-model-dropdown {
  position: relative;
  z-index: 5;
}

.deal-model-dropdown.open {
  z-index: 80;
}

.deal-model-dropdown-button {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 18px;
  border: 1px solid rgba(149, 206, 255, 0.24);
  background:
    linear-gradient(180deg, rgba(8, 45, 110, 0.96), rgba(4, 22, 62, 0.94)),
    radial-gradient(circle at 16% 0%, rgba(163, 246, 255, 0.16), transparent 34%),
    linear-gradient(35deg, rgba(116, 221, 255, 0.13), transparent 58%);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
}

.deal-model-dropdown-caret {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border-right: 2px solid #7cecff;
  border-bottom: 2px solid #7cecff;
  transform: rotate(45deg) translateY(-2px);
}

.deal-model-dropdown.open .deal-model-dropdown-caret {
  transform: rotate(225deg) translateY(-1px);
}

.deal-model-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: none;
  gap: 6px;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid rgba(149, 206, 255, 0.22);
  background:
    linear-gradient(180deg, rgba(7, 42, 105, 0.995), rgba(3, 18, 54, 0.995)),
    radial-gradient(circle at 20% 0%, rgba(147, 242, 255, 0.18), transparent 34%);
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.44);
}

.deal-model-dropdown.open .deal-model-dropdown-menu {
  display: grid;
}

.deal-model-dropdown-option {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  text-align: left;
  font-weight: 800;
}

.deal-model-dropdown-option.active {
  border-color: rgba(116, 221, 255, 0.32);
  background: linear-gradient(135deg, rgba(29, 122, 214, 0.86), rgba(17, 173, 218, 0.72));
}

.deal-model-dropdown-option:disabled {
  opacity: 0.36;
  cursor: not-allowed;
}

.deal-model-field[hidden],
.deal-single-wrap[hidden],
.deal-cpa-grid[hidden],
.deal-cpa-example[hidden] {
  display: none !important;
}

.deal-single-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.deal-single-input {
  min-width: 0;
}

.deal-single-suffix {
  min-width: 52px;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1px solid rgba(149, 206, 255, 0.22);
  background: rgba(10, 28, 55, 0.74);
  color: var(--blue-4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.deal-cpa-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 10px;
}

.deal-cpa-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.deal-cpa-suffix {
  min-width: 44px;
  min-height: 48px;
  padding: 0 12px;
  border-radius: 16px;
  border: 1px solid rgba(149, 206, 255, 0.22);
  background: rgba(10, 28, 55, 0.74);
  color: var(--blue-4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.deal-cpa-example {
  margin-top: 8px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.form-row.is-disabled {
  opacity: 0.62;
}

.deal-model-field.is-hidden {
  display: none;
}

.input,
.textarea {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1px solid rgba(149, 206, 255, 0.22);
  background:
    linear-gradient(180deg, rgba(8, 41, 99, 0.94), rgba(4, 20, 58, 0.9)),
    radial-gradient(circle at 14% 0%, rgba(163, 246, 255, 0.1), transparent 32%),
    linear-gradient(35deg, rgba(116, 221, 255, 0.08), transparent 54%);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.textarea {
  min-height: 104px;
  padding: 13px 14px;
  resize: vertical;
}

.input:focus,
.textarea:focus {
  outline: none;
  border-color: rgba(116, 221, 255, 0.62);
  box-shadow: 0 0 0 3px rgba(116, 221, 255, 0.14), 0 0 24px rgba(116, 221, 255, 0.14);
}

.select-menu {
  position: relative;
  isolation: isolate;
}

.select-menu.open {
  z-index: 90;
}

.select-button {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 18px;
  border: 1px solid rgba(149, 206, 255, 0.24);
  background:
    linear-gradient(180deg, rgba(8, 45, 110, 0.96), rgba(4, 22, 62, 0.94)),
    radial-gradient(circle at 16% 0%, rgba(163, 246, 255, 0.16), transparent 34%),
    linear-gradient(35deg, rgba(116, 221, 255, 0.13), transparent 58%);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 0 1px rgba(46, 174, 255, 0.08);
}

.select-menu.compact .select-button {
  min-height: 50px;
}

.select-menu.open .select-button {
  border-color: rgba(116, 221, 255, 0.52);
  box-shadow:
    0 0 0 3px rgba(116, 221, 255, 0.12),
    0 0 20px rgba(116, 221, 255, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.select-button-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-caret {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  border-right: 2px solid #7cecff;
  border-bottom: 2px solid #7cecff;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms ease;
}

.select-menu.open .select-caret {
  transform: rotate(225deg) translateY(-1px);
}

.select-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  display: none;
  gap: 6px;
  padding: 8px;
  max-height: min(60vh, 340px);
  overflow: auto;
  border-radius: 20px;
  border: 1px solid rgba(149, 206, 255, 0.22);
  background:
    linear-gradient(180deg, rgba(7, 42, 105, 0.995), rgba(3, 18, 54, 0.995)),
    radial-gradient(circle at 20% 0%, rgba(147, 242, 255, 0.18), transparent 34%),
    linear-gradient(35deg, rgba(116, 221, 255, 0.14), transparent 56%);
  box-shadow: 0 22px 52px rgba(0, 0, 0, 0.44);
  backdrop-filter: blur(18px);
}

.select-menu.open .select-dropdown {
  display: grid;
}

.select-option {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 18px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  display: grid;
  gap: 3px;
  text-align: left;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.select-option:hover,
.select-option.active {
  border-color: rgba(153, 241, 255, 0.42);
  background:
    linear-gradient(135deg, rgba(12, 91, 196, 0.94), rgba(11, 164, 218, 0.72)),
    linear-gradient(35deg, rgba(255, 173, 34, 0.1), transparent 58%);
  transform: translateY(-1px);
}

.select-option.disabled {
  opacity: 0.34;
  pointer-events: none;
  transform: none;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 700;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:disabled,
.input:disabled,
.textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button.primary {
  color: #f4fcff;
  border-color: rgba(63, 205, 255, 0.28);
  background:
    linear-gradient(135deg, #086ee5, #17c3ed),
    linear-gradient(35deg, rgba(255, 255, 255, 0.16), transparent 52%);
  box-shadow: 0 14px 30px rgba(19, 121, 196, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.button.secondary {
  color: var(--text);
  border-color: rgba(63, 205, 255, 0.18);
  background: linear-gradient(135deg, rgba(22, 71, 131, 0.96), rgba(13, 38, 74, 0.96));
}

.button.ghost {
  color: var(--blue-5);
  border-color: rgba(63, 205, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(7, 42, 96, 0.78), rgba(3, 18, 48, 0.78)),
    radial-gradient(circle at 18% 0%, rgba(153, 241, 255, 0.14), transparent 34%);
}

.button.danger {
  color: #ffd3d8;
  border-color: rgba(255, 138, 147, 0.18);
  background: rgba(91, 31, 47, 0.55);
}

.button.compact {
  min-height: 38px;
  border-radius: 12px;
}

.summary-box strong,
.metric-card strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.metric-card small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.team-board {
  gap: 22px;
}

.org-tree {
  position: relative;
}

.team-node {
  position: relative;
  display: grid;
  gap: 16px;
}

.team-children {
  position: relative;
  margin-left: 18px;
  padding-left: 28px;
  gap: 18px;
}

.team-children::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 0;
  bottom: 18px;
  width: 2px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(116, 221, 255, 0.5), rgba(155, 45, 101, 0.24));
}

.team-children > .team-node::before {
  content: "";
  position: absolute;
  left: -18px;
  top: 34px;
  width: 18px;
  height: 2px;
  background: linear-gradient(90deg, rgba(116, 221, 255, 0.5), rgba(255, 255, 255, 0.12));
}

.team-card {
  position: relative;
  overflow: hidden;
}

.team-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(37, 220, 255, 0.08), transparent 42%),
    linear-gradient(35deg, rgba(255, 158, 27, 0.05), transparent 56%);
  pointer-events: none;
}

.team-card.focused {
  border-color: var(--line-strong);
  box-shadow: inset 0 0 0 1px rgba(37, 220, 255, 0.18), 0 0 30px rgba(37, 220, 255, 0.08);
}

.branch-card {
  border-radius: 24px;
  padding: 16px;
}

.team-card-head {
  align-items: flex-start;
}

.team-card-copy {
  display: grid;
  gap: 6px;
  flex: 1;
}

.team-card-copy strong {
  font-size: 18px;
}

.team-card-actions .button {
  min-width: 128px;
}

.metric-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(149, 206, 255, 0.2);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(35, 30, 84, 0.72), rgba(27, 29, 71, 0.64));
}

.partner-insights {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 12px;
}

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

.team-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.team-stats div {
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(63, 205, 255, 0.12);
  background: rgba(7, 22, 41, 0.64);
}

.team-stats strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.status-chip.active {
  border-color: rgba(66, 238, 200, 0.32);
  color: #bfffee;
  background: rgba(40, 191, 170, 0.14);
}

.status-chip.closed {
  border-color: rgba(159, 185, 218, 0.24);
  color: #d2e5ff;
  background: rgba(104, 129, 172, 0.13);
}

.deal-current-box {
  border-color: rgba(75, 214, 255, 0.24);
}

.partner-card-block {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(98, 205, 255, 0.18);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(4, 20, 53, 0.78), rgba(16, 54, 111, 0.46)),
    radial-gradient(circle at 94% 4%, rgba(90, 215, 255, 0.12), transparent 32%);
}

.partner-card-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.partner-card-block-head h3 {
  margin: 2px 0 0;
  font-size: 18px;
}

.deal-readonly-summary {
  padding: 12px 14px;
  border: 1px solid rgba(116, 221, 255, 0.18);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(6, 28, 70, 0.78), rgba(22, 64, 125, 0.58));
  color: #f3fbff;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.deal-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.deal-close-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 175, 66, 0.22);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(43, 29, 74, 0.72), rgba(4, 27, 67, 0.72)),
    radial-gradient(circle at 100% 0%, rgba(255, 172, 50, 0.14), transparent 34%);
}

.chip-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.partner-section,
.deal-details-card {
  overflow: hidden;
  border: 1px solid rgba(98, 205, 255, 0.18);
  border-radius: 18px;
  background: rgba(3, 18, 46, 0.56);
}

.partner-section > summary,
.deal-details-card > summary {
  min-height: 54px;
  padding: 13px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  color: var(--text);
  font-weight: 900;
}

.partner-section > summary::-webkit-details-marker,
.deal-details-card > summary::-webkit-details-marker {
  display: none;
}

.partner-section > summary::after,
.deal-details-card > summary::after {
  content: "⌄";
  color: var(--blue-5);
  font-size: 24px;
  line-height: 1;
  transition: transform 0.18s ease;
}

.partner-section[open] > summary::after,
.deal-details-card[open] > summary::after {
  transform: rotate(180deg);
}

.partner-section > summary small,
.deal-details-card > summary small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.partner-section > .form-grid,
.partner-section > .archive-box,
.partner-section > .month-multi,
.partner-section > .month-grid,
.partner-section > .month-row {
  margin: 0 14px 14px;
}

.partner-section > .month-multi {
  margin-top: 2px;
}

.deal-details-card {
  background: linear-gradient(135deg, rgba(6, 33, 78, 0.84), rgba(37, 30, 84, 0.62));
}

.deal-details-card.active {
  border-color: rgba(66, 238, 200, 0.32);
}

.deal-details-card.closed {
  border-color: rgba(159, 185, 218, 0.2);
}

.deal-full-info {
  display: grid;
  gap: 12px;
  padding: 0 14px 14px;
}

.deal-term-list {
  display: grid;
  gap: 8px;
}

.deal-term-list div,
.deal-kpi-line {
  padding: 10px 12px;
  border: 1px solid rgba(149, 206, 255, 0.12);
  border-radius: 14px;
  background: rgba(0, 17, 42, 0.52);
}

.deal-term-list span,
.deal-kpi-line {
  color: var(--muted);
  font-size: 12px;
}

.deal-term-list strong {
  display: block;
  margin-top: 4px;
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(98, 205, 255, 0.18);
  border-radius: 16px;
  background: rgba(4, 23, 58, 0.54);
  color: var(--text);
  font-weight: 700;
}

.toggle-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.deal-row {
  display: grid;
  gap: 8px;
}

.deal-row.closed {
  opacity: 0.88;
}

.deal-close-results,
.deal-close-edit-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.deal-close-results span {
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(0, 17, 42, 0.56);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.deal-close-results.labeled span {
  display: grid;
  gap: 4px;
}

.deal-close-results.labeled small,
.labeled-inputs span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.deal-close-results.labeled strong {
  color: var(--text);
  font-size: 15px;
}

.labeled-inputs label {
  display: grid;
  gap: 6px;
}

.compact-textarea {
  min-height: 78px;
}

.danger-bottom {
  display: grid;
  gap: 8px;
  padding-top: 6px;
}

.partner-card-v4 {
  gap: 12px;
}

.partner-accordion {
  border: 1px solid rgba(98, 205, 255, 0.16);
  background: rgba(3, 18, 46, 0.58);
  border-radius: 20px;
  overflow: hidden;
}

.partner-accordion > summary,
.mini-section > summary,
.comment-reply > summary {
  cursor: pointer;
  list-style: none;
}

.partner-accordion > summary {
  min-height: 58px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 900;
}

.partner-accordion > summary small {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.partner-section-body {
  display: grid;
  gap: 12px;
  padding: 0 14px 14px;
}

.mini-section {
  margin-top: 10px;
  border: 1px solid rgba(98, 205, 255, 0.12);
  border-radius: 16px;
  background: rgba(0, 13, 34, 0.34);
}

.mini-section > summary {
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 800;
}

.comment-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.comment-card {
  display: grid;
  gap: 10px;
  margin-left: calc(var(--comment-depth, 0) * 14px);
  padding: 12px;
  border: 1px solid rgba(98, 205, 255, 0.15);
  border-radius: 18px;
  background: rgba(3, 18, 46, 0.64);
}

.comment-card.reply {
  border-color: rgba(37, 220, 255, 0.22);
  background: rgba(8, 35, 74, 0.52);
}

.comment-actions,
.comment-replies {
  display: grid;
  gap: 8px;
}

.comment-reply {
  display: grid;
  gap: 8px;
}

.comment-reply > summary {
  color: var(--blue-4);
  font-weight: 900;
  font-size: 13px;
}

.comment-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.comment-head span,
.comment-card p {
  color: var(--muted);
}

.comment-card p {
  margin: 0;
  line-height: 1.45;
}

.team-card-actions.single .button {
  width: 100%;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 16px;
  font-weight: 800;
  color: #09101b;
  box-shadow: inset 0 -10px 16px rgba(255, 255, 255, 0.2);
}

.avatar-photo {
  overflow: hidden;
}

.avatar-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar.owner {
  background: linear-gradient(135deg, #7cecff, #4f8dff);
}

.avatar.admin {
  background: linear-gradient(135deg, #69e6ff, #3a7fff);
}

.avatar.affiliate {
  background: linear-gradient(135deg, #7cecff, #2797d8);
}

.avatar.local {
  background: linear-gradient(135deg, #8fd8ff, #5d8fff);
}

.partner-row-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: 8px 10px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, rgba(10, 34, 78, 0.9), rgba(5, 23, 57, 0.88));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.partner-list-window {
  display: grid;
  gap: 12px;
}

.partner-row {
  min-height: 46px;
  padding: 8px 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  color: var(--text);
  border: 0;
  background: transparent;
  box-shadow: none;
}

.partner-row-shell .partner-row {
  flex: 1;
}

.partner-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid rgba(116, 221, 255, 0.18);
  background: rgba(2, 15, 40, 0.56);
  color: var(--muted);
  font-weight: 800;
}

.pager-button {
  width: 44px;
  height: 38px;
  border: 1px solid rgba(116, 221, 255, 0.28);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(28, 157, 234, 0.42), rgba(6, 29, 75, 0.82));
  color: var(--text);
  font-weight: 900;
}

.pager-button:disabled {
  cursor: default;
  opacity: 0.36;
}

.partner-pick {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 14px;
  border: 1px solid rgba(149, 206, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
}

.partner-pick.active {
  border-color: rgba(116, 221, 255, 0.5);
  background: linear-gradient(135deg, rgba(118, 221, 255, 0.3), rgba(88, 168, 255, 0.32));
}

.partner-row-shell.picked {
  box-shadow: 0 0 0 1px rgba(116, 221, 255, 0.28), 0 12px 28px rgba(38, 120, 199, 0.12);
}

.partner-row-shell.quality-red {
  border-color: #ff5277;
  box-shadow: inset 0 0 0 1px rgba(255, 82, 119, 0.24), 0 0 20px rgba(255, 82, 119, 0.12);
}

.partner-row-shell.quality-yellow {
  border-color: #ffd64f;
  box-shadow: inset 0 0 0 1px rgba(255, 214, 79, 0.2), 0 0 18px rgba(255, 214, 79, 0.12);
}

.partner-row-shell.quality-green {
  border-color: #37f0d0;
  box-shadow: inset 0 0 0 1px rgba(55, 240, 208, 0.2), 0 0 18px rgba(55, 240, 208, 0.12);
}

.partner-row-shell.quality-gold {
  border-color: #ff9e1b;
  box-shadow: inset 0 0 0 1px rgba(255, 158, 27, 0.22), 0 0 20px rgba(255, 158, 27, 0.14);
}

.partner-line {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}

.partner-line strong {
  flex: 0 0 auto;
}

.partner-inline {
  color: #b8d5f2;
  overflow: hidden;
  text-overflow: ellipsis;
}

.partner-geo {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid rgba(105, 232, 255, 0.32);
  background: rgba(30, 126, 205, 0.28);
  color: #e9fbff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.danger-panel {
  border-color: rgba(255, 112, 132, 0.28);
}

.danger-note {
  border-color: rgba(255, 112, 132, 0.2);
  background: rgba(91, 31, 47, 0.28);
}

.compact-pill {
  min-height: 28px;
  padding: 0 10px;
  margin-left: auto;
  font-size: 10px;
}

.archive-box {
  display: grid;
  gap: 12px;
}

.deal-history,
.deal-summary {
  display: grid;
  gap: 8px;
}

.deal-row {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(149, 206, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
}

.deal-row.active,
.deal-summary {
  border: 1px solid rgba(116, 221, 255, 0.22);
  background: linear-gradient(135deg, rgba(83, 53, 126, 0.62), rgba(52, 94, 171, 0.4));
  padding: 12px 14px;
  border-radius: 16px;
}

.deal-row small,
.deal-summary small,
.deal-summary span {
  color: var(--muted);
}

.highlight-row label {
  color: #fff2bf;
}

.empty-state {
  text-align: center;
}

.month-row {
  margin-top: 2px;
}

.month-chip {
  color: var(--blue-5);
  background: rgba(13, 41, 74, 0.84);
}

.month-chip.active {
  color: #f1fcff;
  border-color: rgba(37, 220, 255, 0.34);
  background: linear-gradient(135deg, rgba(22, 118, 180, 0.98), rgba(15, 58, 111, 0.98));
}

.panel-heading h2::after,
.panel-heading h3::after {
  content: none;
}

.toggle {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--text);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 880px);
  padding: 8px;
  display: grid;
  gap: 8px;
  background:
    linear-gradient(180deg, rgba(5, 31, 79, 0.96), rgba(3, 13, 42, 0.96)),
    radial-gradient(circle at 50% -12%, rgba(207, 252, 255, 0.24), transparent 36%),
    linear-gradient(135deg, rgba(116, 221, 255, 0.1), transparent 44%);
  border: 1px solid rgba(149, 206, 255, 0.18);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  z-index: 10;
}

.bottom-nav::before {
  content: none;
}

.bottom-nav.five {
  grid-template-columns: repeat(5, 1fr);
}

.bottom-nav.four {
  grid-template-columns: repeat(4, 1fr);
}

.nav-btn {
  min-height: 54px;
  padding: 8px 6px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.1;
}

.nav-btn.active {
  color: #f4fcff;
  background:
    linear-gradient(135deg, rgba(4, 104, 224, 0.98), rgba(18, 194, 237, 0.9)),
    linear-gradient(35deg, rgba(255, 173, 34, 0.16), transparent 56%);
  box-shadow: inset 0 0 0 1px rgba(167, 245, 255, 0.32), 0 0 22px rgba(37, 220, 255, 0.16);
}

.member-modal {
  width: min(640px, calc(100% - 20px));
  padding: 0;
  border-radius: 24px;
  color: var(--text);
}

.partner-modal {
  width: min(760px, calc(100% - 20px));
}

.member-modal::backdrop {
  background: rgba(3, 9, 20, 0.82);
  backdrop-filter: blur(5px);
}

.modal-top,
.modal-content {
  padding: 18px 20px;
}

.modal-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  border-bottom: 1px solid rgba(63, 205, 255, 0.14);
}

.partner-modal .panel {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.partner-modal .panel-heading {
  margin-bottom: 14px;
}

.partner-modal .form-grid {
  gap: 14px;
}

.partner-modal .archive-box {
  border-width: 1px;
}

.partner-modal .modal-content {
  display: grid;
  gap: 14px;
  max-height: 72vh;
  overflow: auto;
}

@media (max-width: 760px) {
  #app {
    padding: 10px 10px 122px;
  }

  .auth-card,
  .panel,
  .app-topbar {
    padding: 16px;
    border-radius: 22px;
  }

  .hero-top,
  .panel-heading,
  .top-actions,
  .debug-row,
  .action-row,
  .request-head,
  .user-head,
  .team-card-head,
  .team-card-actions,
  .month-row {
    flex-direction: column;
    align-items: stretch;
  }

  .dual-grid,
  .summary-grid,
  .metric-grid,
  .toolbar-grid,
  .modal-grid,
  .triple-grid,
  .team-stats,
  .partner-insights,
  .compact-metrics,
  .deal-action-row,
  .deal-close-results,
  .deal-close-edit-grid {
    grid-template-columns: 1fr;
  }

  .partners-toolbar .toolbar-search {
    grid-column: auto;
  }

  .deal-cpa-wrap {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .team-children {
    margin-left: 10px;
    padding-left: 18px;
  }

  .partner-line {
    gap: 8px;
    font-size: 13px;
  }

  .partner-inline {
    font-size: 12px;
  }

  .bottom-nav {
    width: 100%;
  }

  .nav-btn {
    min-height: 50px;
    font-size: 10px;
  }
}
