:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #667085;
  --primary: #1250e6;
  --primary-dark: #0d46d0;
  --primary-soft: rgba(18, 80, 230, 0.1);
  --border: #e8eaf2;
  --shadow: 0 10px 30px rgba(41, 47, 76, 0.08);
  --shadow-soft: 0 6px 18px rgba(41, 47, 76, 0.06);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --success-bg: #ecfdf3;
  --success-text: #027a48;
  --error-bg: #fef2f2;
  --error-text: #b42318;
  --warning-bg: #fff4e5;
  --warning-text: #b54708;
  --info-bg: #eef4ff;
  --info-text: #1d4ed8;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

body {
  min-height: 100vh;
}

a {
  text-decoration: none;
  color: inherit;
}

button,
input {
  font: inherit;
}

.dashboard-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 24;
  padding: 20px 16px;
  background:
    radial-gradient(circle at top right, rgba(18, 80, 230, 0.16), transparent 32%),
    linear-gradient(180deg, #ffffff 0%, #f7f8fd 100%);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.topbar__right-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

.referral-discount-btn {
  border: 1px solid rgba(18, 80, 230, 0.18);
  border-radius: 999px;
  background: rgba(18, 80, 230, 0.08);
  color: var(--primary-dark);
  cursor: pointer;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.referral-discount-btn:active {
  transform: scale(0.98);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 100%;
}

.brand__logo {
  width: 87px;
  height: 87px;
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(18, 80, 230, 0.18);
  flex-shrink: 0;
}

.brand__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}

.brand__text h1 {
  margin: 0;
  font-size: 28px;
}

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

.user-chip__avatar {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(18, 80, 230, 0.24);
}

.user-chip__text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
}

.user-chip__name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.user-chip__text strong {
  font-size: 15px;
}

.user-chip__text span {
  color: var(--muted);
  font-size: 13px;
}

.user-chip__edit-box {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.user-chip__edit-box[hidden] {
  display: none !important;
}

.user-chip__edit-box input {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  outline: none;
}

.user-chip__edit-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(18, 80, 230, 0.12);
}

.user-chip__edit-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.edit-name-btn {
  border: none;
  background: transparent;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.btn-ghost,
.btn-secondary,
.btn-primary,
.mini-btn {
  border: none;
  cursor: pointer;
  border-radius: 14px;
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-ghost:active,
.btn-secondary:active,
.btn-primary:active,
.mini-btn:active {
  transform: scale(0.98);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary-dark);
  padding: 12px 16px;
  box-shadow: var(--shadow-soft);
}

.btn-primary {
  background: #1250e6;
  color: #fff;
  box-shadow: 0 10px 24px rgba(18, 80, 230, 0.22);
  padding: 14px 18px;
}

.btn-primary--support-green {
  background: #0f8d2d;
  border: 1px solid #0f8d2d;
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 141, 45, 0.22);
}

.btn-primary--classic-blue {
  background: #1250e6;
}

.btn-primary--classic-green {
  background: #0f8d2d;
}

.btn-secondary {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--primary-dark);
  padding: 14px 18px;
  box-shadow: var(--shadow-soft);
}

.dashboard-main {
  padding: 12px 16px 124px;
  display: grid;
  gap: 12px;
}

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

.primary-shortcuts-card__button {
  width: 100%;
  min-height: 58px;
  font-size: 18px;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.primary-shortcuts-card__button > * {
  position: relative;
  z-index: 1;
}

.feed-shortcuts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 14px;
}

.feed-shortcuts__themes {
  min-height: calc((58px * 2) + 14px);
  border: 1px solid #0f8d2d;
  border-radius: 14px;
  background: #0f8d2d;
  color: #ffffff;
  box-shadow: 0 10px 24px rgba(15, 141, 45, 0.22);
  cursor: pointer;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 2px;
  padding: 12px;
  font-weight: 800;
  text-align: center;
}

.feed-shortcuts__themes span {
  font-size: 14px;
  line-height: 1;
}

.feed-shortcuts__themes strong {
  font-size: 18px;
  line-height: 1.05;
}

.feed-shortcuts__links {
  display: grid;
  gap: 14px;
}

.button-ai-badge {
  position: absolute;
  top: 10px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: rgba(255, 255, 255, 0.96);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.dashboard-spacer {
  min-height: 440px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  transform: none;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px 24px 0 0;
  background: rgba(35, 48, 70, 0.96);
  backdrop-filter: blur(14px);
  box-shadow: 0 -10px 28px rgba(20, 24, 38, 0.18);
  z-index: 30;
}

.profile-panel {
  margin-top: 8px;
}

.bottom-nav__item {
  appearance: none;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  min-height: 58px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  position: relative;
}

.bottom-nav__item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.bottom-nav__item:active {
  transform: scale(0.98);
}

.bottom-nav__item.is-active {
  background: rgba(18, 80, 230, 0.12);
  color: #fff;
}

.bottom-nav__item.is-active::before {
  content: "";
  position: absolute;
  top: 6px;
  width: 24px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
}

.bottom-nav__icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
}

.bottom-nav__icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.bottom-nav__label {
  font-size: 11px;
  line-height: 1;
}

.bottom-nav__menu-wrap {
  position: relative;
  display: flex;
  width: 100%;
}

.bottom-nav__menu-wrap .bottom-nav__item {
  width: 100%;
}

.bottom-nav__menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 12px);
  min-width: 220px;
  max-height: min(72vh, 560px);
  overflow-y: auto;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(29, 39, 57, 0.98);
  box-shadow: 0 18px 40px rgba(20, 24, 38, 0.28);
}

.bottom-nav__menu[hidden] {
  display: none !important;
}

.bottom-nav__menu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.14);
  margin: 2px 4px;
}

.bottom-nav__menu-item {
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-align: left;
  padding: 12px 14px;
  font-weight: 700;
  cursor: pointer;
}

.bottom-nav__menu-item:hover {
  background: rgba(18, 80, 230, 0.24);
}

.bottom-nav__menu-item--danger {
  color: #ffd5d5;
}

.bottom-nav__menu-item--danger:hover {
  background: rgba(220, 38, 38, 0.24);
}

.welcome-card,
.primary-action-card,
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.welcome-card {
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(18, 80, 230, 0.12), rgba(18, 80, 230, 0.04));
  border: 1px solid rgba(18, 80, 230, 0.15);
}

.welcome-card__label {
  margin: 0 0 8px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.welcome-card__content h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.12;
}

.welcome-card__content p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.tasks-entry-card {
  display: flex;
  justify-content: center;
  padding: 4px 0 2px;
}

.btn-tasks {
  width: 100%;
  max-width: 320px;
  text-align: center;
  font-size: 16px;
}

.primary-action-card {
  padding: 18px 16px;
  display: grid;
  gap: 14px;
}

.primary-action-card h3,
.panel__header h3 {
  margin: 0 0 6px;
  font-size: 20px;
}

.primary-action-card p,
.panel__header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.panel {
  padding: 18px 16px;
}

.panel--secondary {
  border-style: dashed;
}

.panel--info {
  border-color: rgba(29, 78, 216, 0.18);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.panel--success {
  border-color: rgba(2, 122, 72, 0.18);
  background: linear-gradient(180deg, #ffffff 0%, #f9fefb 100%);
}

.panel__header {
  margin-bottom: 14px;
}

.invite-form {
  display: grid;
  gap: 14px;
}

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

.form-group label {
  font-size: 14px;
  font-weight: 700;
}

.form-group input,
.generated-link-box input {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 14px;
  padding: 14px 14px;
  background: #fff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus,
.generated-link-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(18, 80, 230, 0.12);
}

.form-message {
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 700;
}

.form-message[hidden] {
  display: none !important;
}

.form-message--error {
  background: var(--error-bg);
  color: var(--error-text);
}

.form-message--success {
  background: var(--success-bg);
  color: var(--success-text);
}

.generated-link-box {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}

.generated-link-box[hidden] {
  display: none !important;
}

.generated-link-box label {
  font-size: 14px;
  font-weight: 700;
}

#inviteSummaryBox {
  background: rgba(18, 80, 230, 0.05);
  border: 1px solid rgba(18, 80, 230, 0.16);
  border-radius: 16px;
  padding: 14px;
}

#inviteSummaryBox strong {
  display: inline-block;
  font-size: 16px;
  margin-bottom: 4px;
}

#inviteSummaryBox span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.generated-link-box__actions {
  display: grid;
  gap: 10px;
}

.empty-state {
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 16px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.empty-state[hidden] {
  display: none !important;
}

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

.invite-item {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: #fff;
}

.invite-item--awaiting {
  background: #f8fbff;
  border-color: #cfe0ff;
}

.invite-item--accepted {
  background: #f8fdf9;
  border-color: #cfead7;
}

.invite-item--canceled {
  background: #fffaf5;
  border-color: #f3d8b6;
}

.invite-item__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.invite-item__top strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}

.invite-item__top span {
  color: var(--muted);
  font-size: 13px;
}

.invite-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.invite-badge--awaiting {
  background: var(--info-bg);
  color: var(--info-text);
}

.invite-badge--accepted {
  background: var(--success-bg);
  color: var(--success-text);
}

.invite-badge--canceled {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.invite-item__meta {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  display: grid;
  gap: 4px;
}

.invite-item__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.mini-btn {
  padding: 10px 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 8px 18px rgba(18, 80, 230, 0.22);
}

.mini-btn--ghost {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--primary-dark);
  box-shadow: none;
}

.mini-btn--danger {
  background: #fee2e2;
  color: #b42318;
  border: 1px solid #fecaca;
  box-shadow: none;
}

.mini-btn--danger:hover {
  background: #fecaca;
}

@media (max-width: 640px) {
  .topbar__right-actions {
    gap: 6px;
  }

  .referral-discount-btn {
    max-width: 112px;
    padding: 9px 10px;
    font-size: 11px;
    line-height: 1.1;
    white-space: normal;
  }

  .feed-shortcuts__themes {
    height: 100%;
  }

  .feed-shortcuts__links {
    width: 100%;
    justify-self: end;
  }

  .feed-shortcuts__link {
    width: 100%;
    min-height: 58px;
    padding: 10px 8px;
    font-size: 14px;
    line-height: 1.12;
  }

  .invite-item__actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .mini-btn,
  .mini-btn--ghost,
  .mini-btn--danger {
    width: 100%;
  }

  .user-chip__text {
    min-width: 0;
  }

  .user-chip__edit-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .bottom-nav {
    width: 100%;
    bottom: 0;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    gap: 2px;
  }

  .bottom-nav__item {
    min-height: 56px;
    border-radius: 16px;
  }

  .bottom-nav__menu {
    min-width: min(260px, calc(100vw - 24px));
    right: 0;
  }
}

@media (min-width: 768px) {
  .dashboard-shell {
    max-width: 860px;
    margin: 0 auto;
  }

  .topbar {
    padding: 28px 24px 22px;
    border-bottom-left-radius: var(--radius-xl);
    border-bottom-right-radius: var(--radius-xl);
  }

  .dashboard-main {
    padding: 24px 24px 132px;
  }

  .primary-action-card {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .generated-link-box__actions {
    grid-template-columns: 1fr 1fr;
  }
}
