/* SENDLY — design system per design.md ("Crypto Blue"): fintech-grade,
   DM Sans + JetBrains Mono, #0052FF primary, flat surfaces (no gradients).
   design.md only specifies a light palette; the dark variant below keeps the
   same brand hues (primary/success/error) adapted for dark surfaces so the
   existing light/dark toggle keeps working. */

:root {
  /* Border radius (design.md § Border Radius) */
  --radius-xs: 4px; /* chips (small), inline elements */
  --radius-chip: 6px; /* chips */
  --radius-sm: 8px; /* buttons, inputs, table containers */
  --radius-md: 12px; /* cards, panels, dropdowns */
  --radius-lg: 16px; /* modals, onboarding cards, hero sections */
  --radius-pill: 9999px; /* avatars, status dots */

  /* Spacing (design.md § Spacing — base unit 4px) */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-6: 48px;
  --space-card: 20px;

  --font-ui: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, monospace;

  /* Elevation (design.md § Elevation) */
  --shadow-1: 0 1px 3px rgba(5, 15, 26, 0.06);
  --shadow-2: 0 4px 12px rgba(5, 15, 26, 0.08);
  --shadow-3: 0 12px 24px rgba(5, 15, 26, 0.12);

  /* Light theme — exact values from design.md § Colors */
  --bg-primary: #f9fafb;
  --hero-bg: #f9fafb;
  --surface-card: #ffffff;
  --surface-card-hover: #f9fafb;
  --surface-sunken: #f3f4f6;
  --surface-muted: #f3f4f6;
  --input-bg: #f3f4f6;
  --text-primary: #050f1a;
  --text-secondary: #5b616e;
  --text-tertiary: #8a919e;
  --placeholder: #8a919e;
  --border-subtle: #d1d5db;
  --color-primary: #0052ff;
  --color-primary-hover: #003ecb;
  --color-primary-tint: rgba(0, 82, 255, 0.1);
  --success: #05b169;
  --success-bg: #e6f6ef;
  --warning: #f0ad4e;
  --warning-bg: #fdf3e7;
  --error: #df2935;
  --error-bg: #fdecee;
  --btn-primary-bg: var(--color-primary);
  --btn-primary-bg-hover: var(--color-primary-hover);
  --btn-primary-text: #ffffff;
  --btn-secondary-bg: var(--surface-card);
  --btn-secondary-text: var(--text-primary);
}

:root[data-theme="dark"] {
  --bg-primary: #0a0d12;
  --hero-bg: #0a0d12;
  --surface-card: #12161d;
  --surface-card-hover: #171c24;
  --surface-sunken: #171c24;
  --surface-muted: #1d2128;
  --input-bg: #171c24;
  --text-primary: #f5f7fa;
  --text-secondary: #98a2b3;
  --text-tertiary: #6b7280;
  --placeholder: #667085;
  --border-subtle: #262b33;
  --color-primary: #2e6bff;
  --color-primary-hover: #5285ff;
  --color-primary-tint: rgba(46, 107, 255, 0.16);
  --success: #16c784;
  --success-bg: #10301f;
  --warning: #f0ad4e;
  --warning-bg: #3a2b12;
  --error: #ff5a5f;
  --error-bg: #3a1418;
  --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-3: 0 12px 24px rgba(0, 0, 0, 0.45);
  --btn-primary-bg: var(--color-primary);
  --btn-primary-bg-hover: var(--color-primary-hover);
  --btn-primary-text: #ffffff;
  --btn-secondary-bg: var(--surface-card);
  --btn-secondary-text: var(--text-primary);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #0a0d12;
    --hero-bg: #0a0d12;
    --surface-card: #12161d;
    --surface-card-hover: #171c24;
    --surface-sunken: #171c24;
    --surface-muted: #1d2128;
    --input-bg: #171c24;
    --text-primary: #f5f7fa;
    --text-secondary: #98a2b3;
    --text-tertiary: #6b7280;
    --placeholder: #667085;
    --border-subtle: #262b33;
    --color-primary: #2e6bff;
    --color-primary-hover: #5285ff;
    --color-primary-tint: rgba(46, 107, 255, 0.16);
    --success: #16c784;
    --success-bg: #10301f;
    --warning: #f0ad4e;
    --warning-bg: #3a2b12;
    --error: #ff5a5f;
    --error-bg: #3a1418;
    --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-2: 0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-3: 0 12px 24px rgba(0, 0, 0, 0.45);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-user-select: none;
  user-select: none;
}

/* First-load entrance: a soft, staggered "shimmer in" for the page chrome. */

@keyframes sendly-intro-fade {
  from {
    opacity: 0;
    transform: translateY(10px);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes sendly-intro-card {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.intro-fade,
.intro-card {
  animation-duration: 0.6s;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  animation-fill-mode: both;
}

.intro-fade {
  animation-name: sendly-intro-fade;
}

.intro-card {
  animation-name: sendly-intro-card;
  animation-duration: 0.7s;
}

.intro-d1 {
  animation-delay: 0.04s;
}
.intro-d2 {
  animation-delay: 0.1s;
}
.intro-d3 {
  animation-delay: 0.16s;
}
.intro-d4 {
  animation-delay: 0.22s;
}
.intro-d5 {
  animation-delay: 0.28s;
}

@media (prefers-reduced-motion: reduce) {
  .intro-fade,
  .intro-card {
    animation: none;
  }
}

/* Text people actually need to select/edit stays selectable. */
input,
textarea,
.code-cell,
.mock-note code {
  -webkit-user-select: text;
  user-select: text;
}

/* Theme switch animation: circular reveal expanding from the toggle button.
   Falls back to the plain color transitions above in browsers without
   View Transitions support (Safari/Firefox) or with reduced-motion set. */
@supports (view-transition-name: root) {
  ::view-transition-old(root) {
    animation: none;
  }

  ::view-transition-new(root) {
    animation: sendly-theme-reveal 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  }
}

@keyframes sendly-theme-reveal {
  from {
    clip-path: circle(0px at var(--vt-x, 50%) var(--vt-y, 50%));
  }
  to {
    clip-path: circle(var(--vt-r, 150%) at var(--vt-x, 50%) var(--vt-y, 50%));
  }
}

@media (prefers-reduced-motion: reduce) {
  @supports (view-transition-name: root) {
    ::view-transition-new(root) {
      animation: none;
    }
  }
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
}

input,
.card,
.auth-card,
.hero,
.badge,
.icon-btn-logout,
.copy-btn,
.btn-secondary {
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

/* Theme toggle */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease,
    transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-toggle:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.theme-toggle:active {
  transform: scale(0.86);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
}

.theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="light"] .theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="light"] .theme-toggle .icon-sun {
  display: block;
}

/* Layout: brand hero (desktop only) + form column */

.page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}

.hero {
  display: none;
  position: relative;
  padding: var(--space-6);
  background: var(--hero-bg);
  flex-direction: column;
  justify-content: space-between;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hero-mark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.hero-mark svg {
  color: var(--color-primary);
}

.hero-copy h1 {
  font-size: clamp(20px, 2.3vw, 32px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  white-space: nowrap;
  margin: 0 0 var(--space-2);
}

.hero-copy p {
  color: var(--text-secondary);
  font-size: 16px;
  max-width: 380px;
  margin: 0;
}

.hero-footer {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.form-column {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-2);
  position: relative;
}

.form-column-topbar {
  position: fixed;
  top: var(--space-2);
  right: var(--space-2);
  z-index: 20;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: var(--space-card);
}

.auth-card-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: var(--space-3);
}

.auth-card-brand-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
}

.auth-card-brand-name svg {
  color: var(--color-primary);
  flex-shrink: 0;
}

/* Tabs */

.tabs {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: var(--space-3);
}

.tab-indicator {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: var(--surface-card);
  box-shadow: var(--shadow-1);
  border-radius: var(--radius-xs);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.tabs[data-active="signup"] .tab-indicator {
  transform: translateX(100%);
}

.tab-btn {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s ease;
}

.tab-btn[aria-selected="true"] {
  color: var(--color-primary);
  font-weight: 700;
}

/* Panel crossfade: panels sit stacked/absolute only while .is-animating is
   applied (during a tab switch), so there's no flash-of-collapsed-height on
   first load and no lingering position:absolute at rest. */

.panel-viewport {
  position: relative;
}

.panel-viewport.is-animating {
  overflow: hidden;
  transition: height 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.panel {
  display: none;
  flex-direction: column;
  gap: var(--space-2);
}

.panel.is-active {
  display: flex;
}

.panel-viewport.is-animating .panel {
  display: flex;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.panel-viewport.is-animating .panel.state-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.panel-viewport.is-animating .panel.state-hidden-up {
  opacity: 0;
  transform: translateY(-8px);
}

.panel-viewport.is-animating .panel.state-hidden-down {
  opacity: 0;
  transform: translateY(8px);
}

@media (prefers-reduced-motion: reduce) {
  .panel-viewport.is-animating,
  .panel-viewport.is-animating .panel {
    transition: none !important;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field input,
.field textarea {
  height: 44px;
  background: var(--input-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0 14px;
  font-size: 16px;
  font-weight: 400;
  font-family: var(--font-ui);
  outline: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.field textarea {
  height: auto;
  padding: 10px 14px;
  resize: vertical;
  line-height: 1.4;
}

.field input.shake,
.field textarea.shake {
  animation: field-shake 0.4s ease;
}

@keyframes field-shake {
  20%,
  80% {
    transform: translateX(-1px);
  }
  35%,
  65% {
    transform: translateX(1.5px);
  }
  50% {
    transform: translateX(-2px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .field input.shake {
    animation: none;
  }
}

.field.has-error.is-blank .field-error {
  display: none;
}

.field input.is-mono {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.field input:focus,
.field textarea:focus {
  background: var(--surface-card);
  border-color: var(--color-primary);
  border-width: 2px;
  box-shadow: 0 0 0 4px var(--color-primary-tint);
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--placeholder);
}

.file-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  background: var(--input-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0 14px 0 6px;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.file-picker:focus-within {
  background: var(--surface-card);
  border-color: var(--color-primary);
  border-width: 2px;
  box-shadow: 0 0 0 4px var(--color-primary-tint);
}

.file-picker-button {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-xs);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.file-picker-button:hover {
  background: var(--surface-card-hover);
  border-color: var(--text-secondary);
}

.file-picker-button:active {
  transform: translateY(1px);
}

.file-picker-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  color: var(--text-tertiary);
}

.file-picker-name.has-file {
  color: var(--text-primary);
  font-weight: 500;
}

.field-hint {
  font-size: 12px;
  color: var(--text-secondary);
}

.field-error {
  font-size: 12px;
  color: var(--error);
  display: none;
}

.field.has-error input {
  border-color: var(--error);
}

.field.has-error .field-error {
  display: block;
}

.btn-primary {
  min-width: 100px;
  height: 44px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  font-weight: 700;
  font-size: 15px;
  padding: 0 20px;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.05s ease;
}

.btn-primary:hover {
  background: var(--btn-primary-bg-hover);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-secondary {
  min-width: 100px;
  height: 44px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  font-weight: 700;
  font-size: 15px;
  padding: 0 20px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

.btn-secondary:hover {
  background: var(--surface-card-hover);
  border-color: var(--text-secondary);
}

.btn-secondary:active {
  transform: translateY(1px);
}

.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.banner {
  display: none;
  align-items: flex-start;
  gap: 10px;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  border-left: 4px solid transparent;
}

.banner.is-visible {
  display: flex;
}

.banner-error {
  background: var(--error-bg);
  color: var(--error);
  border-left-color: var(--error);
}

.banner-success {
  background: var(--success-bg);
  color: var(--success);
  border-left-color: var(--success);
}

/* Toast popups (reuse .banner-error / .banner-success for color, add float + motion) */

.toast-container {
  position: fixed;
  top: var(--space-2);
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 360px;
  padding: 0 var(--space-2);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 500;
  border-left: 4px solid transparent;
  box-shadow: var(--shadow-3);
  animation: sendly-toast-in 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.toast.is-leaving {
  animation: sendly-toast-out 0.2s ease forwards;
}

@keyframes sendly-toast-in {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes sendly-toast-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast,
  .toast.is-leaving {
    animation: none;
  }
}

.mock-note {
  margin-top: var(--space-3);
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
}

.mock-note code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 1px 6px;
  color: var(--text-primary);
}

.spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: var(--btn-primary-text);
  display: inline-block;
  animation: spin 0.6s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Tablet+ */
@media (min-width: 640px) {
  .form-column {
    padding: var(--space-4);
  }

  .auth-card {
    padding: var(--space-4);
  }
}

/* Desktop: show hero panel */
@media (min-width: 1024px) {
  .page {
    grid-template-columns: 1.1fr 1fr;
  }

  .hero {
    display: flex;
  }
}

/* ---------- Admin / dashboard shell ---------- */

.admin-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-3) var(--space-2) var(--space-6);
}

.admin-topbar {
  width: 100%;
  max-width: 920px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0 var(--space-3);
  gap: var(--space-2);
  flex-wrap: wrap;
}

.admin-topbar .hero-mark {
  font-size: 18px;
}

/* Dashboard-only: align the logo with where it sits on the login hero panel
   (near the true left edge) instead of the centered 920px admin bar. */
.dashboard-topbar {
  max-width: none;
  padding-left: var(--space-6);
  padding-right: var(--space-6);
}

.admin-main {
  width: 100%;
  max-width: 920px;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
  padding: var(--space-card);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  flex-wrap: wrap;
}

.card-header h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.card-header p {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
}

thead th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 14px;
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--surface-card-hover);
}

.code-cell {
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.badge {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--radius-chip);
  font-size: 13px;
  font-weight: 500;
}

.badge-unused {
  color: var(--success);
  background: var(--success-bg);
}

.badge-used {
  color: var(--text-secondary);
  background: var(--surface-muted);
}

.badge-credits {
  color: var(--color-primary);
  background: var(--color-primary-tint);
  font-weight: 700;
  font-family: var(--font-mono);
}

.badge-credits.is-low {
  color: var(--error);
  background: var(--error-bg);
}

.credit-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.credit-buy-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--color-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-1);
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

.credit-buy-btn svg {
  flex-shrink: 0;
}

.credit-buy-btn:hover {
  background: var(--color-primary-hover);
  box-shadow: var(--shadow-2);
}

.credit-buy-btn:active {
  transform: translateY(1px);
  box-shadow: var(--shadow-1);
}

.credit-modal-caption {
  font-size: 13px;
  color: var(--text-secondary);
  margin: -8px 0 6px;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}

.credit-package-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}

.credit-package {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.credit-package.is-selected {
  border-color: var(--color-primary);
  background: var(--color-primary-tint);
}

.credit-package-radio {
  position: relative;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border-subtle);
  background: var(--surface-card);
  transition: border-color 0.15s ease;
}

.credit-package.is-selected .credit-package-radio {
  border-color: var(--color-primary);
}

.credit-package.is-selected .credit-package-radio::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--color-primary);
}

.credit-package-amount {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}

.credit-package-amount small {
  font-weight: 500;
  font-size: 12px;
  color: var(--text-secondary);
}

.credit-package-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-primary);
  background: var(--color-primary-tint);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.credit-package-save {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--success);
  background: var(--success-bg);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}

.credit-package-price {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 72px;
  text-align: right;
}

.credit-package.is-selected .credit-package-price {
  color: var(--color-primary);
}

.credit-package:not(:has(.credit-package-save)) .credit-package-price {
  margin-left: auto;
}

.credit-waiting-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: var(--surface-card-hover);
  border: 1px solid var(--border-subtle);
}

.credit-waiting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.credit-waiting-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.credit-waiting-value {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.credit-waiting-copy {
  cursor: pointer;
}

.credit-waiting-copy:hover {
  color: var(--color-primary);
}

.credit-waiting-amount {
  color: var(--color-primary);
  font-size: 16px;
}

@keyframes sendly-step-in {
  from {
    opacity: 0;
    transform: translateX(18px) scale(0.98);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
    filter: blur(0);
  }
}

.credit-step-in {
  animation: sendly-step-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  .credit-step-in {
    animation: none;
  }
}


.credit-line-value {
  color: var(--color-primary);
  font-family: var(--font-mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: inline-block;
}

.credit-line.is-low .credit-line-value {
  color: var(--error);
}

@keyframes credit-value-pulse {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.25);
  }
  100% {
    transform: scale(1);
  }
}

.credit-line-value.is-updating {
  animation: credit-value-pulse 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-reduced-motion: reduce) {
  .credit-line-value.is-updating {
    animation: none;
  }
}

.table-wrap th:last-child,
.table-wrap td:last-child {
  text-align: right;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 0;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease,
    transform 0.05s ease;
}

.copy-btn svg {
  flex-shrink: 0;
}

.copy-btn .icon-check {
  display: none;
}

.copy-btn.is-copied .icon-copy {
  display: none;
}

.copy-btn.is-copied .icon-check {
  display: block;
}

.copy-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.copy-btn:active {
  transform: scale(0.9);
}

.copy-btn.is-copied {
  color: var(--success);
  border-color: var(--success);
}

.copy-btn.is-error {
  color: var(--error);
  border-color: var(--error);
}

.empty-state {
  padding: var(--space-4);
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
}

@media (min-width: 640px) {
  .kpi-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

.kpi {
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-2);
}

.kpi-label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.kpi-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 28px;
  font-weight: 700;
  margin-top: 4px;
  color: var(--text-primary);
}

.kpi-value.is-accent {
  color: var(--color-primary);
}

.kpi-value.is-alert {
  color: var(--error);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.icon-btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.icon-btn-logout:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.icon-btn-logout.is-icon-only {
  width: 36px;
  height: 36px;
  padding: 0;
  gap: 0;
  justify-content: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Account link boxes (mock — no real Kakao SDK/API involved) */

.account-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

.account-card,
.account-box {
  width: 100%;
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-card);
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.account-card {
  position: relative;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-1);
  animation: sendly-intro-card 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: box-shadow 0.6s ease;
  align-items: flex-start;
  justify-content: flex-start;
  text-align: left;
  gap: 4px;
  padding-top: var(--space-2);
  padding-right: 44px;
  cursor: pointer;
}

.account-card.is-new {
  box-shadow: 0 0 0 3px var(--color-primary-tint), var(--shadow-2);
}

.account-card-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-card);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 0;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.account-card-delete:hover {
  color: var(--error);
  border-color: var(--error);
  background: var(--error-bg);
}

@media (prefers-reduced-motion: reduce) {
  .account-card {
    animation: none;
  }
}

.account-name {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
}

.account-id {
  font-size: 13px;
  color: var(--text-secondary);
}

.account-add-btn {
  border: 2px dashed var(--border-subtle);
  background: transparent;
  color: var(--color-primary);
  font-weight: 700;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.05s ease;
}

.account-add-btn:active {
  transform: scale(0.98);
}

.account-add-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Modal (account add) */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 15, 26, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  z-index: 50;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.modal-overlay.is-visible {
  opacity: 1;
}

.modal {
  width: 100%;
  max-width: 400px;
  max-height: calc(100vh - (var(--space-2) * 2));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  padding: var(--space-card);
}

.modal::-webkit-scrollbar {
  width: 8px;
}

.modal::-webkit-scrollbar-track {
  background: transparent;
}

.modal::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: var(--radius-pill);
}

.modal::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

.modal.modal-lg {
  max-width: 520px;
}

.modal.is-closing {
  animation: sendly-modal-out 0.18s ease both;
}

@keyframes sendly-modal-out {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(6px) scale(0.97);
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal-overlay {
    transition: none;
  }
  .modal.is-closing {
    animation: none;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}

.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.modal-close:hover {
  background: var(--surface-card-hover);
  color: var(--text-primary);
}

.modal-close:active {
  transform: scale(0.88) rotate(90deg);
}

.modal form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.modal.modal-lg .modal-header {
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-subtle);
}

.modal.modal-lg form {
  gap: var(--space-3);
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}

.field-row {
  display: flex;
  gap: var(--space-2);
}

.field-row .field {
  flex: 1;
  min-width: 0;
}

.input-with-suffix {
  position: relative;
}

.input-with-suffix input {
  width: 100%;
  padding-right: 36px;
}

/* Hide the native number-input spinner so it doesn't collide with our
   in-field unit suffix (초/개). */
.input-with-suffix input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.input-with-suffix input[type="number"]::-webkit-outer-spin-button,
.input-with-suffix input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.input-suffix {
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-tertiary);
  pointer-events: none;
}

.target-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: var(--space-2);
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease;
}

.target-section.has-error {
  border-color: var(--error);
}

.target-section.shake {
  animation: field-shake 0.4s ease;
}

@media (prefers-reduced-motion: reduce) {
  .target-section.shake {
    animation: none;
  }
}

.target-section .target-section-error {
  display: none;
  margin-top: -4px;
}

.target-section.has-error .target-section-error {
  display: block;
}

.target-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.target-section-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.target-section-caption {
  font-size: 12px;
  color: var(--text-secondary);
}

.target-controls {
  display: flex;
  gap: 8px;
}

.target-search-input {
  height: 40px;
  width: 100%;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0 14px;
  font-size: 14px;
  font-family: var(--font-ui);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.target-search-input::placeholder {
  color: var(--placeholder);
}

.target-search-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-tint);
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.control-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

.target-search-input {
  padding-left: 36px;
}

/* Custom dropdown (sort control, 전송 타입 picker) — native <select> popups
   can't be restyled cross-browser, so this is a button trigger + our own
   menu instead. */

.dropdown {
  position: relative;
  flex-shrink: 0;
}

/* Fixed width so the trigger doesn't resize as the selected label's text
   length changes (기본 순서 / 인원 많은 순서 / 인원 적은 순서). */
#sort-dropdown {
  width: 150px;
}

#sort-dropdown .dropdown-trigger {
  width: 100%;
  justify-content: space-between;
}

.dropdown.dropdown-block {
  flex-shrink: initial;
}

.dropdown-block .dropdown-trigger {
  width: 100%;
  justify-content: space-between;
}

.dropdown-block .dropdown-menu {
  left: 0;
  right: 0;
  min-width: 0;
}

.dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0 12px;
  font-size: 14px;
  font-family: var(--font-ui);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dropdown-trigger:focus-visible,
.dropdown-trigger[aria-expanded="true"] {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-tint);
}

.dropdown-trigger .control-icon-inline {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.dropdown-trigger-label {
  white-space: nowrap;
}

.dropdown-trigger-label.is-placeholder {
  color: var(--placeholder);
}

.field.has-error .dropdown-trigger {
  border-color: var(--error);
}

.dropdown-trigger.shake {
  animation: field-shake 0.4s ease;
}

@media (prefers-reduced-motion: reduce) {
  .dropdown-trigger.shake {
    animation: none;
  }
}

.dropdown-chevron {
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.dropdown-trigger[aria-expanded="true"] .dropdown-chevron {
  transform: rotate(180deg);
}

/* The intro-fade/intro-card entrance animation makes every card its own
   stacking context, so a dropdown menu inside one card can't paint above a
   later sibling card no matter its own z-index — bump the whole card instead.
   Earlier cards get a higher z-index than later ones so each dropdown can
   still paint over every card below it on the page. */
#grant-credits-card {
  position: relative;
  z-index: 3;
}

#unlimited-plan-card {
  position: relative;
  z-index: 2;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 10;
  min-width: 160px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2);
  opacity: 0;
  transform: translateY(-6px) scale(0.98);
  pointer-events: none;
  transform-origin: top right;
  transition: opacity 0.15s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.15s cubic-bezier(0.22, 1, 0.36, 1);
}

.dropdown-menu.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.dropdown-option {
  padding: 9px 10px;
  border-radius: var(--radius-xs);
  font-size: 14px;
  color: var(--text-primary);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.1s ease;
}

.dropdown-option:hover {
  background: var(--surface-card-hover);
}

.dropdown-option.is-selected {
  color: var(--color-primary);
  font-weight: 700;
  background: var(--color-primary-tint);
}

.dropdown-menu-searchable {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dropdown-search {
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-ui);
  outline: none;
  transition: border-color 0.15s ease;
}

.dropdown-search:focus {
  border-color: var(--color-primary);
}

.dropdown-options-list {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 220px;
  overflow-y: auto;
}

.dropdown-empty {
  padding: 12px 10px;
  font-size: 13px;
  color: var(--text-tertiary);
  text-align: center;
}


@media (prefers-reduced-motion: reduce) {
  .dropdown-menu,
  .dropdown-chevron {
    transition: none;
  }
}

.target-room-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
}

.target-room-list::-webkit-scrollbar {
  width: 8px;
}

.target-room-list::-webkit-scrollbar-track {
  background: transparent;
}

.target-room-list::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: var(--radius-pill);
}

.target-room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.target-room-item:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--color-primary-tint);
  animation: sendly-select-pop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes sendly-select-pop {
  0% {
    transform: scale(0.97);
  }
  50% {
    transform: scale(1.015);
  }
  100% {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .target-room-item:has(input:checked) {
    animation: none;
  }
}

.target-room-item-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.target-room-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1.5px solid var(--border-subtle);
  border-radius: 4px;
  background: var(--surface-card);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.target-room-item input[type="checkbox"]:checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
  animation: sendly-checkbox-pop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.target-room-item input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  animation: sendly-checkmark-in 0.15s ease 0.05s both;
}

.target-room-item input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--surface-sunken), 0 0 0 4px var(--color-primary-tint);
}

@keyframes sendly-checkbox-pop {
  0% {
    transform: scale(0.75);
  }
  60% {
    transform: scale(1.15);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes sendly-checkmark-in {
  from {
    opacity: 0;
    transform: rotate(45deg) scale(0.4);
  }
  to {
    opacity: 1;
    transform: rotate(45deg) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .target-room-item input[type="checkbox"]:checked,
  .target-room-item input[type="checkbox"]:checked::after {
    animation: none;
  }
}

.target-room-item-count {
  flex-shrink: 0;
  min-width: 72px;
  text-align: left;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-secondary);
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

#credit-modal .modal-actions {
  margin-top: 20px;
}

.modal-actions .btn-secondary,
.modal-actions .btn-primary,
.modal-actions .btn-danger {
  flex: 1;
  min-width: 0;
}

.modal-code {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  padding: 4px 0;
}

.modal-code-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 6px;
  border-radius: var(--radius-pill);
  background: var(--color-primary-tint);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: sendly-code-icon-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both,
    sendly-code-icon-pulse 1.4s ease-out 0.45s 2;
}

.modal-code-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
  margin: 0;
}

.modal-code-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 4px;
}

.code-display {
  display: flex;
  gap: 8px;
  margin: 4px 0 6px;
}

.code-digit {
  width: 48px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 26px;
  color: var(--color-primary);
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  opacity: 0;
  animation: sendly-code-digit-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.modal-code-waiting {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 4px;
}

.modal-code-waiting .spinner {
  border-color: var(--border-subtle);
  border-top-color: var(--color-primary);
  margin-right: 0;
}

.code-digit:nth-child(1) {
  animation-delay: 0.08s;
}
.code-digit:nth-child(2) {
  animation-delay: 0.15s;
}
.code-digit:nth-child(3) {
  animation-delay: 0.22s;
}
.code-digit:nth-child(4) {
  animation-delay: 0.29s;
}

@keyframes sendly-code-digit-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes sendly-code-icon-pop {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes sendly-code-icon-pulse {
  0% {
    box-shadow: 0 0 0 0 var(--color-primary-tint);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(0, 0, 0, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal-code-icon,
  .code-digit {
    animation: none;
    opacity: 1;
  }
}

/* Dashboard views: account list vs. selected-account chicken screen are two
   fully separate "tabs" — only one is shown at a time (mock — localStorage
   only, keyed by account id). */

.dashboard-view {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  margin: 0 auto;
}

#accounts-view {
  max-width: 480px;
}

#chicken-view {
  max-width: 760px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 0;
  cursor: pointer;
}

.back-btn:hover {
  color: var(--text-primary);
}

.back-btn svg {
  flex-shrink: 0;
}

.selected-account-row {
  display: flex;
  align-items: stretch;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.selected-account-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 200px;
  padding: 0 14px;
  background: var(--surface-sunken);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.selected-account-bar .label {
  color: var(--text-secondary);
}

.selected-account-bar .name {
  font-weight: 700;
  color: var(--text-primary);
}

.section-tabs {
  display: flex;
  gap: var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}

.section-tab {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  padding: 10px 2px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.section-tab[aria-selected="true"] {
  color: var(--color-primary);
  font-weight: 700;
  border-bottom-color: var(--color-primary);
}

.chicken-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-2);
}

.chicken-list .empty-state {
  grid-column: 1 / -1;
}

.chicken-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-card);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
  font-size: 15px;
  animation: sendly-intro-card 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.chicken-item.is-new {
  box-shadow: 0 0 0 3px var(--color-primary-tint), var(--shadow-2);
}

.chicken-item-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.chicken-item-name {
  font-weight: 700;
  font-size: 17px;
  color: var(--text-primary);
}

.chicken-item-meta {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chicken-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-subtle);
}

.chicken-item-action {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease,
    transform 0.05s ease;
}

.chicken-item-action:hover {
  color: var(--text-primary);
  background: var(--surface-card-hover);
  border-color: var(--text-secondary);
}

.chicken-item-action:active {
  transform: translateY(1px);
}

.chicken-item-action svg {
  flex-shrink: 0;
}

.chicken-item-action-danger:hover {
  color: var(--error);
  border-color: var(--error);
  background: var(--error-bg);
}

.chicken-item-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-subtle);
}

.chicken-item-toggle-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.chicken-item-toggle-label.is-running {
  color: var(--success);
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  cursor: pointer;
}

.switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  width: 40px;
  height: 24px;
  background: var(--border-subtle);
  border-radius: var(--radius-pill);
  transition: background-color 0.15s ease;
}

.switch-thumb {
  display: block;
  width: 20px;
  height: 20px;
  margin: 2px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-1);
  transition: transform 0.15s ease;
}

.switch-input:checked ~ .switch-track {
  background: var(--success);
}

.switch-input:checked ~ .switch-track .switch-thumb {
  transform: translateX(16px);
}

.switch-input:focus-visible ~ .switch-track {
  box-shadow: 0 0 0 4px var(--color-primary-tint);
}

.switch-input:disabled ~ .switch-track {
  opacity: 0.5;
  cursor: not-allowed;
}

.chicken-add-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-danger {
  min-width: 100px;
  height: 44px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--error);
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
  padding: 0 20px;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.05s ease;
}

.btn-danger:hover {
  background: #c11f2a;
}

.btn-danger:active {
  transform: translateY(1px);
}

.btn-danger:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.delete-warning {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 var(--space-2);
}

.delete-warning strong {
  color: var(--text-primary);
}

@media (prefers-reduced-motion: reduce) {
  .chicken-item {
    animation: none;
  }
}

.gate-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
}
