/* ============================================
   Evergrowth Admin · Shared Styles
   ============================================
   Used by login.html, setup.html, index.html
   Matches the chart design system exactly.
*/

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

:root {
  /* Brand colors */
  --platinate-blue: #1237E0;
  --night: #141414;
  --indigo: #7371FC;
  --ice-blue: #8FEDFF;
  --tea-green: #CAF1C8;
  --pink: #E85B81;

  /* Neutrals */
  --bg: #F8F8F8;
  --white: #FFFFFF;
  --line: #E4E4E4;
  --line-dark: #B5B5B5;
  --muted: #6B6B6B;

  /* Typography */
  --font-body: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-mono: 'Space Mono', 'Courier New', monospace;

  /* Spacing */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-pill: 100px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: var(--font-body);
  color: var(--night);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--platinate-blue);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/* ============================================
   Auth pages (login + setup)
   ============================================ */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 3px solid var(--platinate-blue);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  width: 100%;
  max-width: 420px;
  padding: 40px 36px 32px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  justify-content: center;
}
.auth-brand-logo {
  width: 44px;
  height: 44px;
}
.auth-brand-text {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--night);
}

.auth-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--platinate-blue);
  margin-bottom: 8px;
  text-align: center;
}
.auth-title {
  font-family: var(--font-body);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--night);
  margin-bottom: 6px;
  text-align: center;
}
.auth-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 28px;
  text-align: center;
  line-height: 1.4;
}

.field {
  margin-bottom: 16px;
}
.field-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.field-readonly {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--night);
  padding: 11px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.field-pw-wrap {
  position: relative;
}
.field-pw-wrap .input {
  padding-right: 42px;
}
.pw-toggle {
  position: absolute;
  right: 1px;
  top: 1px;
  bottom: 1px;
  width: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  cursor: pointer;
  color: var(--line-dark);
  transition: color 0.15s ease;
}
.pw-toggle:hover {
  color: var(--night);
}
.pw-toggle svg {
  width: 18px;
  height: 18px;
}

.input,
.textarea {
  width: 100%;
  padding: 11px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--night);
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease;
}
.input:focus,
.textarea:focus {
  border-color: var(--platinate-blue);
}
.input::placeholder,
.textarea::placeholder {
  color: var(--line-dark);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--line-dark);
  background: var(--white);
  color: var(--night);
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover {
  border-color: var(--night);
  background: var(--bg);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--platinate-blue);
  color: var(--white);
  border-color: var(--platinate-blue);
}
.btn-primary:hover {
  background: var(--night);
  border-color: var(--night);
}
.btn-danger {
  background: var(--white);
  color: var(--pink);
  border-color: var(--pink);
}
.btn-danger:hover {
  background: var(--pink);
  color: var(--white);
}
.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 10px;
}

.auth-submit {
  margin-top: 8px;
}

.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  margin-top: 14px;
  display: none;
}
.alert.show { display: block; }
.alert-error {
  background: rgba(232, 91, 129, 0.08);
  border: 1px solid rgba(232, 91, 129, 0.3);
  color: #B53661;
}
.alert-success {
  background: rgba(202, 241, 200, 0.4);
  border: 1px solid var(--tea-green);
  color: #2d5e29;
}

.auth-footer {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ============================================
   Dashboard
   ============================================ */

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

.topnav {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topnav-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topnav-logo {
  width: 28px;
  height: 28px;
}
.topnav-title {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--night);
}
.topnav-title-divider {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--line-dark);
  margin: 0 4px;
}
.topnav-title-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--platinate-blue);
}
.topnav-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.topnav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--night);
}
.topnav-avatar {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-pill);
  background: var(--indigo);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 700;
}

.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px;
}

.tabs {
  display: flex;
  gap: 2px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 4px;
  margin-bottom: 24px;
  width: fit-content;
}
.tab {
  padding: 8px 18px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  background: transparent;
}
.tab:hover { color: var(--night); }
.tab.active {
  background: var(--platinate-blue);
  color: var(--white);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.search-input {
  padding: 9px 12px;
  font-family: var(--font-body);
  font-size: 13px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  width: 280px;
  max-width: 100%;
  outline: none;
  background: var(--white);
}
.search-input:focus { border-color: var(--platinate-blue); }
.count-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 12px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.plan-row {
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 3px solid var(--platinate-blue);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: box-shadow 0.15s ease;
}
.plan-row:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.plan-row-main {
  flex: 1;
  min-width: 0;
}
.plan-row-title {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--night);
  margin-bottom: 4px;
}
.plan-row-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.plan-row-meta-divider { color: var(--line-dark); }

.plan-row-stats {
  display: flex;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.plan-row-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.plan-row-stat-value {
  font-size: 15px;
  color: var(--night);
  letter-spacing: 0;
}

.plan-row-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.empty-state {
  background: var(--white);
  border: 1px dashed var(--line-dark);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
}
.empty-state-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.empty-state-body {
  font-size: 14px;
  color: var(--muted);
}

/* Team list */
.team-row {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.team-row-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-pill);
  background: var(--indigo);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.team-row-main {
  flex: 1;
  min-width: 0;
}
.team-row-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--night);
  display: flex;
  align-items: center;
  gap: 8px;
}
.team-row-name-self {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--platinate-blue);
  background: rgba(18, 55, 224, 0.08);
  padding: 2px 6px;
  border-radius: var(--radius-pill);
}
.team-row-name-pending {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg);
  padding: 2px 6px;
  border-radius: var(--radius-pill);
}
.team-row-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.team-row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.modal-overlay.show {
  display: flex;
}
.modal {
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 3px solid var(--platinate-blue);
  border-radius: var(--radius);
  width: 100%;
  max-width: 440px;
  padding: 28px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}
.modal-title {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 700;
  color: var(--night);
  margin-bottom: 6px;
}
.modal-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

/* Loader */
.loader {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--platinate-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.full-loader {
  display: flex;
  justify-content: center;
  padding: 48px;
}

/* Section spacing */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-header-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Responsive */
@media (max-width: 720px) {
  .main { padding: 20px 16px; }
  .topnav { padding: 12px 16px; }
  .plan-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }
  .plan-row-actions { width: 100%; }
  .plan-row-actions .btn { flex: 1; }
  .detail-stats { grid-template-columns: repeat(2, 1fr); }
  .detail-header { flex-direction: column; align-items: flex-start; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar-right { flex-wrap: wrap; }
  input[type="date"].input-sm { width: 100%; }
  select.input-sm { width: 100%; }
}

/* ============================================
   Archive & filter additions
   ============================================ */
.plan-row.archived {
  opacity: 0.55;
  border-top-color: var(--line-dark);
}
.plan-row-archived-pill {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg);
  padding: 2px 6px;
  border-radius: var(--radius-pill);
}
.protection-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
  color: #fff;
}
.protection-badge-pin { background: #7371FC; }
.protection-badge-email { background: #1237E0; }
.protection-badge-both { background: #E85B81; }

/* Pinned plan row */
.plan-row.pinned {
  border-top-color: var(--indigo);
  background: #fafaff;
}
.plan-row-pinned-pill {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--indigo);
  background: rgba(115, 113, 252, 0.1);
  padding: 2px 6px;
  border-radius: var(--radius-pill);
}

/* Icon-only action buttons */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 32px;
  padding: 5px 8px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.btn-icon:hover {
  color: var(--platinate-blue);
  border-color: var(--platinate-blue);
}
.btn-icon-active {
  color: var(--indigo);
  border-color: var(--indigo);
  background: rgba(115, 113, 252, 0.08);
}
.btn-icon-active:hover {
  color: var(--muted);
  border-color: var(--line);
  background: var(--white);
}
.btn-icon svg {
  flex-shrink: 0;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.input-sm {
  padding: 7px 10px;
  font-size: 12px;
  width: auto;
  min-width: 0;
}
select.input-sm {
  width: 150px;
  appearance: auto;
}
input[type="date"].input-sm {
  width: 140px;
}

/* ============================================
   Plan detail view
   ============================================ */
.detail-header {
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 3px solid var(--platinate-blue);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.detail-header-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--night);
  margin-bottom: 4px;
}
.detail-header-meta {
  font-size: 12px;
  color: var(--muted);
}
.detail-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.detail-stat-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}
.detail-stat-value {
  font-family: var(--font-body);
  font-size: 24px;
  font-weight: 700;
  color: var(--night);
  margin-bottom: 4px;
}
.detail-stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-section {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-bottom: 16px;
}

.detail-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 120px;
  padding-top: 8px;
}
.chart-bar {
  flex: 1;
  background: var(--platinate-blue);
  border-radius: 2px 2px 0 0;
  min-height: 2px;
  transition: opacity 0.15s ease;
  cursor: default;
}
.chart-bar:hover {
  opacity: 0.7;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.detail-table th {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.detail-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--night);
}
.detail-table tr:last-child td {
  border-bottom: none;
}

.detail-recent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.detail-recent-row:last-child {
  border-bottom: none;
}

/* ============================================
   Activity log
   ============================================ */
.activity-row {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.activity-row-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--indigo);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.activity-row-main {
  flex: 1;
  min-width: 0;
}
.activity-row-text {
  font-size: 13px;
  color: var(--night);
  line-height: 1.4;
}
.activity-row-text strong {
  font-weight: 600;
}
.activity-row-time {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ============================================
   Role badges
   ============================================ */
.role-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  vertical-align: middle;
}
.role-owner {
  background: rgba(18, 55, 224, 0.1);
  color: var(--platinate-blue);
}
.role-admin {
  background: rgba(115, 113, 252, 0.1);
  color: var(--indigo);
}
.role-viewer {
  background: var(--bg);
  color: var(--muted);
}

/* ============================================
   Analytics period selector
   ============================================ */
.analytics-period {
  display: inline-flex;
  gap: 2px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 3px;
}
.period-btn {
  padding: 5px 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border: none;
  background: transparent;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
}
.period-btn:hover { color: var(--night); }
.period-btn.active {
  background: var(--platinate-blue);
  color: var(--white);
}

/* ============================================
   Analytics grid (top plans + referrers)
   ============================================ */
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

/* Ranked list (top plans) */
.analytics-rank {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  transition: background 0.1s ease;
}
.analytics-rank:last-child { border-bottom: none; }
.analytics-rank:hover { background: var(--bg); }
.rank-num {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}
.rank-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: var(--night);
}
.rank-value {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}

/* Recent plans row */
.recent-plans-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.recent-plan-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}
.recent-plan-card:hover {
  border-color: var(--platinate-blue);
  box-shadow: 0 2px 8px rgba(18, 55, 224, 0.08);
}
.recent-plan-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--night);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-plan-meta {
  font-size: 11px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Stat card subtitle */
.stat-subtitle {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ============================================
   Bulk operations bar
   ============================================ */
.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--night);
  color: var(--white);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}
.bulk-bar-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.bulk-bar-actions {
  display: flex;
  gap: 8px;
}
.bulk-bar .btn {
  border-color: rgba(255,255,255,0.3);
  color: var(--white);
  background: transparent;
}
.bulk-bar .btn:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--white);
}
.bulk-bar .btn-danger {
  border-color: var(--pink);
  color: var(--pink);
}
.bulk-bar .btn-danger:hover {
  background: var(--pink);
  color: var(--white);
}

/* Plan row checkbox */
.plan-row-checkbox {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}
.plan-row-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--platinate-blue);
  cursor: pointer;
}

/* ============================================
   Plan metadata edit form
   ============================================ */
.detail-edit-form {
  background: var(--white);
  border: 1px solid var(--platinate-blue);
  border-radius: var(--radius-sm);
  padding: 20px;
  margin-bottom: 16px;
}
.detail-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.detail-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* ============================================
   Notification toggles
   ============================================ */
.notif-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--night);
  padding: 8px 0;
  cursor: pointer;
}
.notif-toggle + .notif-toggle {
  border-top: 1px solid var(--line);
}
.notif-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--platinate-blue);
  cursor: pointer;
}

/* ============================================
   Settings page
   ============================================ */
.settings-section {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  margin-bottom: 16px;
}
.settings-section-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.settings-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
}
.settings-row + .settings-row {
  border-top: 1px solid var(--line);
}
.settings-row-label {
  flex: 1;
  min-width: 0;
}
.settings-row-label > div:first-child {
  font-size: 14px;
  font-weight: 500;
  color: var(--night);
}
.settings-row-input {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.settings-suffix {
  font-size: 12px;
  color: var(--muted);
}
.settings-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ============================================
   Export dropdown
   ============================================ */
.export-dropdown {
  position: relative;
}
.export-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  z-index: 50;
  min-width: 220px;
  padding: 4px;
}
.export-dropdown-menu button {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--night);
  background: none;
  border: none;
  border-radius: 4px;
  text-align: left;
  cursor: pointer;
  transition: background 0.1s ease;
}
.export-dropdown-menu button:hover {
  background: var(--bg);
}

/* ============================================
   Responsive additions
   ============================================ */
@media (max-width: 720px) {
  .analytics-grid { grid-template-columns: 1fr; }
  .detail-edit-grid { grid-template-columns: 1fr; }
  .bulk-bar { flex-direction: column; gap: 10px; text-align: center; }
  .bulk-bar-actions { width: 100%; justify-content: center; }
  .settings-row { flex-direction: column; align-items: flex-start; gap: 8px; }
  .recent-plans-row { grid-template-columns: 1fr; }
  .access-log-filters { flex-wrap: wrap; }
}

/* ============================================
   Plan detail sub-tabs
   ============================================ */
.detail-subtabs {
  display: flex;
  gap: 2px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 3px;
  margin-bottom: 20px;
  width: fit-content;
}
.detail-subtab {
  padding: 6px 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  background: transparent;
}
.detail-subtab:hover { color: var(--night); }
.detail-subtab.active {
  background: var(--platinate-blue);
  color: var(--white);
}
.detail-subtab-panel { display: none; }
.detail-subtab-panel.active { display: block; }

/* ============================================
   Access log
   ============================================ */
.access-log-filters {
  display: flex;
  gap: 8px;
  align-items: center;
}
.access-log-filters select.input-sm {
  width: 130px;
}
.access-log-filters input[type="date"].input-sm {
  width: 130px;
}
.access-log-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.access-log-pagination-btns {
  display: flex;
  gap: 6px;
}
.al-event-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--muted);
}
.al-result-success { color: #2d5e29; background: rgba(202,241,200,0.4); }
.al-result-failed { color: #B53661; background: rgba(232,91,129,0.08); }
.al-result-blocked { color: #8b4513; background: rgba(255,165,0,0.1); }
.al-result-expired { color: var(--muted); background: var(--bg); }

/* Share links table */
.sl-status-active { color: #2d5e29; }
.sl-status-revoked { color: var(--muted); }
.sl-status-expired { color: #8b4513; }
