/* === Dashboard === */

.dash {
  min-height: 100vh;
  background: var(--bg);
}

/* Navbar */
.navbar {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar__inner {
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  text-decoration: none;
}

.navbar__brand:hover {
  text-decoration: none;
}

.navbar__right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.navbar__user {
  font-size: 14px;
  color: var(--text-secondary);
}

.navbar__balance {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
}

/* Main content */
.dash__content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px;
}

/* Tabs nav */
.dash-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
  overflow-x: auto;
}

.dash-tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  font-family: var(--font);
}

.dash-tab:hover {
  color: var(--text);
}

.dash-tab--active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.dash-section {
  display: none;
}

.dash-section--active {
  display: block;
}

/* Overview section */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.stat-card__label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.stat-card__value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.stat-card__hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Plans grid */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.plan-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}

.plan-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.plan-card--recommended {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.plan-card__badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 12px;
  border-radius: 100px;
}

.plan-card__name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.plan-card__price {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary);
  margin: 12px 0 4px;
}

.plan-card__price span {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
}

.plan-card__tokens {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.plan-card .btn {
  margin-top: 8px;
}

/* Token costs */
.costs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.costs-table th,
.costs-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.costs-table th {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 13px;
}

.costs-table td:last-child {
  text-align: right;
  font-weight: 600;
  color: var(--primary);
}

/* Usage / History table */
.usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.usage-table th,
.usage-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.usage-table th {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 13px;
  background: var(--bg);
}

.usage-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* BYOK Keys section */
.keys-list {
  margin-bottom: 20px;
}

.key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.key-row__info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.key-row__provider {
  font-weight: 600;
  font-size: 14px;
}

.key-row__hint {
  font-size: 13px;
  color: var(--text-muted);
  font-family: monospace;
}

.key-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.key-form .form-group {
  flex: 1;
  margin-bottom: 0;
}

.key-form .btn {
  flex-shrink: 0;
  height: 42px;
}

/* Download section */
.download-section {
  text-align: center;
  padding: 40px 20px;
}

.download-section h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

.download-section p {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: 14px;
}

.install-steps {
  text-align: left;
  max-width: 500px;
  margin: 20px auto 0;
}

.install-steps li {
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Autopost section */
.topic-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
}

.topic-row__info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.topic-row__text {
  font-size: 14px;
  font-weight: 500;
}

.topic-row__actions {
  flex-shrink: 0;
  margin-left: 8px;
}

.day-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
}

.day-checkbox input[type="checkbox"] {
  accent-color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
  .overview-grid {
    grid-template-columns: 1fr;
  }

  .plans-grid {
    grid-template-columns: 1fr;
  }

  .navbar__user {
    display: none;
  }

  .key-form {
    flex-direction: column;
  }

  .key-form .btn {
    width: 100%;
  }

  .dash-tabs {
    gap: 0;
  }

  .dash-tab {
    padding: 10px 14px;
    font-size: 13px;
  }
}
