@import url('variables.css');

* {
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  color: var(--ink);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
}

body.app-surface,
body.auth-surface {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--font);
  letter-spacing: 0;
  background:
    radial-gradient(circle at 14% 4%, rgba(109, 91, 214, 0.12), transparent 29%),
    radial-gradient(circle at 86% 2%, rgba(175, 169, 236, 0.14), transparent 31%),
    linear-gradient(180deg, var(--white) 0%, var(--surface) 48%, var(--white) 100%);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 19px;
  font-weight: 700;
  text-decoration: none;
}

.brand-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: var(--white);
  background: var(--accent);
  box-shadow: 0 12px 24px rgba(109, 91, 214, 0.22);
}

.app-button,
.btn,
.btn-primary {
  border-radius: var(--radius-sm);
  font-weight: 800;
  letter-spacing: 0;
}

.btn,
.btn-primary,
.app-button.primary,
.plan-card button {
  border: 0;
  color: var(--white);
  background: var(--accent);
  box-shadow: 0 12px 24px rgba(109, 91, 214, 0.18);
  padding: 12px 20px;
  min-height: 44px;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn:hover,
.btn-primary:hover,
.app-button.primary:hover,
.plan-card button:hover {
  background: var(--accent-dark);
  opacity: 1;
}

button, input, textarea, select {
  font-family: inherit;
}

.app-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 10px 15px;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  background: var(--white);
  text-decoration: none;
  cursor: pointer;
}

.auth-surface {
  display: grid;
  place-items: center;
  padding: 28px;
}

.auth-shell {
  display: grid;
  grid-template-rows: 1fr;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  width: min(1040px, 100%);
  min-height: 650px;
  overflow: hidden;
  border: 1px solid rgba(17, 24, 39, 0.09);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 32px 80px rgba(17, 24, 39, 0.13);
}

.auth-visual {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 34px;
  background:
    linear-gradient(90deg, rgba(17, 24, 39, 0.055) 1px, transparent 1px),
    linear-gradient(180deg, rgba(17, 24, 39, 0.055) 1px, transparent 1px),
    linear-gradient(135deg, #fdfefe 0%, #eefbf6 48%, #fff2d8 100%);
  background-size: 42px 42px, 42px 42px, auto;
}

.auth-copy {
  max-width: 500px;
}

.auth-kicker {
  display: inline-flex;
  margin-bottom: 18px;
  padding: 7px 11px;
  border: 1px solid rgba(5, 150, 105, 0.22);
  border-radius: var(--radius-full);
  color: var(--accent-dark);
  background: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  font-weight: 800;
}

.auth-copy h1 {
  margin: 0 0 18px;
  max-width: 560px;
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1.03;
  letter-spacing: 0;
}

.auth-copy p {
  margin: 0;
  max-width: 470px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.auth-preview {
  margin-top: 32px;
  overflow: hidden;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 24px 54px rgba(17, 24, 39, 0.15);
}

.auth-preview-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.auth-preview-bar span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
}

.auth-preview-bar span:nth-child(2) {
  background: var(--warning);
}

.auth-preview-bar span:nth-child(3) {
  background: var(--success);
}

.auth-preview-body {
  display: grid;
  grid-template-columns: 0.82fr 1.18fr;
  gap: 16px;
  padding: 18px;
}

.preview-menu,
.preview-panel {
  min-height: 190px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 14px;
}

.preview-menu div,
.preview-row {
  height: 13px;
  margin-bottom: 12px;
  border-radius: var(--radius-full);
  background: var(--line-light);
}

.preview-menu div:first-child {
  width: 68%;
  background: rgba(109, 91, 214, 0.28);
}

.preview-row {
  height: 48px;
  border-radius: 10px;
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--line);
}

.auth-panel {
  display: flex;
  align-items: center;
  padding: 34px;
}

.auth-card {
  width: 100%;
}

.auth-card .logo {
  margin-bottom: 26px;
  text-align: left;
}

.auth-card .logo h1 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 28px;
  letter-spacing: 0;
}

.auth-card .logo p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.tab {
  min-height: 40px;
  padding: 10px;
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  box-shadow: none;
}

.tab.active {
  color: var(--white);
  background: var(--accent);
  box-shadow: 0 8px 18px rgba(109, 91, 214, 0.25);
}

.form-group label {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}

.form-group input,
.form-group textarea,
.form-group select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(109, 91, 214, 0.1);
}

.error,
.success {
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.error {
  color: var(--danger-dark);
  background: var(--danger-soft);
  border-color: var(--danger-border);
}

.success {
  color: var(--success-dark);
  background: var(--success-soft);
  border-color: var(--success-border);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 12px 24px;
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.05);
  backdrop-filter: blur(14px);
}

.app-header-inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(1200px, 100%);
  margin: 0 auto;
}

.header .user,
.app-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.header .user span,
.app-user span {
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 700;
}

.top-link,
.header button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-soft) !important;
  background: var(--white) !important;
  box-shadow: none;
  text-decoration: none !important;
  font-size: 13px;
  font-weight: 800;
}

.header button:hover,
.top-link:hover {
  border-color: var(--accent);
  color: var(--accent-dark) !important;
}

.container.app-container {
  width: min(1200px, 100%);
  max-width: 1200px;
  margin: auto;
  padding: 28px 24px 48px;
}

.client-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 22px;
}

.client-hero-main,
.client-panel {
  border: 1px solid rgba(17, 24, 39, 0.09);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 50px rgba(17, 24, 39, 0.08);
}

.client-hero-main {
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(17, 24, 39, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(17, 24, 39, 0.045) 1px, transparent 1px),
    linear-gradient(135deg, var(--white) 0%, #eefbf6 58%, #fff4dc 100%);
  background-size: 40px 40px, 40px 40px, auto;
}

.client-kicker {
  display: inline-flex;
  margin-bottom: 13px;
  padding: 6px 10px;
  border: 1px solid rgba(5, 150, 105, 0.2);
  border-radius: var(--radius-full);
  color: var(--accent-dark);
  background: var(--white);
  font-size: 12px;
  font-weight: 900;
}

.client-hero h2 {
  margin: 0 0 12px;
  max-width: 720px;
  color: var(--ink);
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.08;
  letter-spacing: 0;
}

.client-hero p {
  max-width: 660px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.client-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.client-panel {
  padding: 20px;
}

.client-panel h3 {
  margin: 0 0 14px;
  font-size: 15px;
}

.section-list {
  display: grid;
  gap: 9px;
}

.section-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--white);
  text-decoration: none;
  font-weight: 800;
}

.section-link span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.section-link:hover {
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(109, 91, 214, 0.08);
}

.billing-section,
.bot-card,
.usage-card,
.modal-content,
.credential-item,
.plan-card {
  border: 1px solid rgba(17, 24, 39, 0.09);
  border-radius: 12px;
  box-shadow: 0 12px 34px rgba(17, 24, 39, 0.06);
}

.billing-section {
  background: rgba(255, 255, 255, 0.92);
}

.current-plan,
.bot-chip {
  border-color: rgba(29, 158, 117, 0.2);
  color: var(--accent-dark);
  background: var(--success-soft);
}

.usage-card {
  background: var(--white);
}

.usage-card .value,
.plan-card .price {
  color: var(--accent-dark);
}

.progress-fill,
input:checked + .toggle-slider {
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
}

.plan-card.current {
  border-color: var(--accent);
  box-shadow: 0 18px 38px rgba(109, 91, 214, 0.12);
  background: var(--success-soft);
}

.actions {
  padding-top: 6px;
}

.actions h2,
.billing-header h2 {
  color: var(--ink);
  letter-spacing: 0;
}

.btn-small {
  min-height: 32px;
  border-radius: var(--radius-sm);
  font-weight: 800;
}

.btn-small.primary {
  border-color: var(--accent);
  background: var(--accent);
}

.btn-small.primary:hover {
  background: var(--accent-dark);
}

.empty {
  grid-column: 1 / -1;
  border: 2px dashed var(--line);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(109, 91, 214, 0.02) 0%, rgba(255, 255, 255, 0.9) 100%);
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}

.empty h3 {
  font-size: 20px;
  color: var(--ink-soft);
  margin-bottom: 12px;
  font-weight: 600;
}

.empty p {
  font-size: 15px;
  color: var(--muted);
  margin: 0;
}

.empty::before {
  content: "🤖";
  display: block;
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.modal {
  padding: 20px;
  background: rgba(17, 24, 39, 0.54);
  backdrop-filter: blur(8px);
}

.modal-content {
  padding: 24px;
}

.modal-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
}

/* Smooth Transitions */
* {
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Button Hover Effects */
.app-button,
.btn,
.btn-primary {
  position: relative;
  overflow: hidden;
}

.app-button::before,
.btn::before,
.btn-primary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.app-button:hover::before,
.btn:hover::before,
.btn-primary:hover::before {
  width: 300px;
  height: 300px;
}

/* Focus States */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Fade In Animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in-up {
  animation: fadeInUp 0.5s ease-out;
}

/* Stagger Animation for Lists */
.bot-card:nth-child(1) { animation-delay: 0s; }
.bot-card:nth-child(2) { animation-delay: 0.1s; }
.bot-card:nth-child(3) { animation-delay: 0.2s; }
.bot-card:nth-child(4) { animation-delay: 0.3s; }
.bot-card:nth-child(5) { animation-delay: 0.4s; }
.bot-card:nth-child(6) { animation-delay: 0.5s; }

[data-tooltip] {
  position: relative;
  cursor: help; /* indicate tooltip availability */
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  padding: 8px 12px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  border-radius: 6px;
  white-space: normal;
  max-width: 200px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-8px);
}

.client-hero {
  grid-template-columns: 1fr;
}

.auth-visual {
  min-height: 430px;
}

/* Bot Cards Grid */
.bots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.bot-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(0, 0, 0, 0.06);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.bot-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
  opacity: 0;
  transition: opacity 0.3s;
}

.bot-card:hover {
  box-shadow: 0 12px 32px rgba(109, 91, 214, 0.12);
  transform: translateY(-4px);
  border-color: rgba(109, 91, 214, 0.2);
}

.bot-card:hover::before {
  opacity: 1;
}

.bot-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 10px;
}

.bot-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}

.bot-status {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.bot-status.active {
  background: var(--success-soft);
  color: var(--success);
}

.bot-status.inactive {
  background: var(--danger-soft);
  color: var(--danger);
}

.bot-description {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
  min-height: 18px;
  line-height: 1.5;
}

.bot-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.bot-chip {
  background: var(--accent-pale);
  color: var(--accent-dark);
  border-radius: var(--radius-full);
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--accent-pale);
}

.bot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn-small {
  padding: 8px 14px;
  border: 1px solid var(--line);
  background: var(--white);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
}

.btn-small:hover {
  background: var(--surface);
  border-color: var(--line);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-small.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(109, 91, 214, 0.2);
}

.btn-small.primary:hover {
  background: var(--accent-dark);
  box-shadow: 0 4px 12px rgba(109, 91, 214, 0.3);
}

.btn-small.danger {
  color: var(--danger);
  border-color: var(--danger-border);
}

.btn-small.danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger-border);
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease-out;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--line);
}

.modal-header h3 {
  font-size: 22px;
  margin: 0;
  color: var(--ink);
  font-weight: 700;
}

.modal-close {
  background: var(--surface);
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--muted);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--surface-hover);
  color: var(--ink-soft);
  transform: rotate(90deg);
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 14px;
  min-height: 42px;
  background: var(--white);
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(109, 91, 214, 0.1);
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
}

/* Embed Code Display */
.embed-code {
  background: var(--night);
  color: var(--night-muted);
  padding: 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  margin-top: 12px;
}

/* Billing Section */
.billing-section {
  background: white;
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.billing-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.billing-header h2 {
  font-size: 22px;
  color: var(--ink);
  margin: 0;
  font-weight: 700;
}

.current-plan {
  display: inline-block;
  padding: 8px 16px;
  background: var(--success-soft);
  color: var(--accent-dark);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  border: 1px solid rgba(29, 158, 117, 0.2);
  box-shadow: 0 2px 4px rgba(29, 158, 117, 0.1);
}

.usage-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.usage-card {
  background: linear-gradient(135deg, var(--white) 0%, var(--surface) 100%);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--line);
  transition: all 0.3s;
  box-shadow: var(--shadow-sm);
}

.usage-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(109, 91, 214, 0.2);
}

.usage-card h4 {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.usage-card .value {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent-dark);
  margin-bottom: 6px;
  line-height: 1;
}

.usage-card .limit {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.progress-bar {
  width: 100%;
  height: 10px;
  background: var(--line);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 10px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
  border-radius: var(--radius-full);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-fill.warning {
  background: linear-gradient(90deg, var(--warning) 0%, #d97706 100%);
}

.progress-fill.danger {
  background: linear-gradient(90deg, var(--danger) 0%, #dc2626 100%);
}

/* Plan Cards */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.plan-card {
  background: white;
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.plan-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 100%);
  opacity: 0;
  transition: opacity 0.3s;
}

.plan-card:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(109, 91, 214, 0.15);
  transform: translateY(-4px);
}

.plan-card:hover::before {
  opacity: 1;
}

.plan-card.current {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--white) 0%, var(--success-soft) 100%);
  box-shadow: 0 4px 16px rgba(109, 91, 214, 0.12);
}

.plan-card.current::before {
  opacity: 1;
}

.plan-card h3 {
  font-size: 20px;
  color: var(--ink);
  margin-bottom: 12px;
  font-weight: 700;
}

.plan-card .price {
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 8px;
  line-height: 1;
}

.plan-card .price span {
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
}

.plan-card .features {
  list-style: none;
  margin: 20px 0;
  padding: 0;
}

.plan-card .features li {
  font-size: 14px;
  color: var(--ink-soft);
  padding: 8px 0;
  padding-left: 24px;
  position: relative;
  line-height: 1.5;
}

.plan-card .features li:before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 900;
  font-size: 16px;
}

.plan-card button {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(109, 91, 214, 0.2);
}

.plan-card button:hover {
  background: var(--accent-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(109, 91, 214, 0.3);
}

.plan-card.current button {
  background: var(--muted);
  cursor: default;
  box-shadow: none;
}

.plan-card.current button:hover {
  background: var(--muted);
  transform: none;
}

/* Warning Banner */
.warning-banner {
  background: linear-gradient(135deg, var(--warning-soft) 0%, var(--warning-border) 100%);
  border: 2px solid var(--warning-border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 24px;
  display: flex;
  align-items: start;
  gap: 14px;
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.2);
}

.warning-banner .icon {
  font-size: 24px;
  flex-shrink: 0;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.warning-banner .content {
  flex: 1;
}

.warning-banner .content strong {
  display: block;
  color: var(--warning-dark);
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 700;
}

.warning-banner .content p {
  color: var(--warning-dark);
  font-size: 14px;
  margin: 0;
  line-height: 1.5;
}

.warning-banner a {
  color: var(--warning-dark);
  text-decoration: underline;
  font-weight: 700;
  transition: color 0.2s;
}

.warning-banner a:hover {
  color: var(--warning-dark);
}

/* Credentials Management */
.credentials-list {
  margin-top: 20px;
}

.credential-item {
  background: linear-gradient(135deg, var(--white) 0%, var(--surface) 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
  transition: all 0.3s;
  box-shadow: var(--shadow-sm);
}

.credential-item:hover {
  border-color: rgba(109, 91, 214, 0.3);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.credential-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.credential-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}

.credential-provider {
  background: var(--accent-pale);
  color: var(--accent-dark);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.credential-meta {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.credential-stats {
  display: flex;
  gap: 18px;
  font-size: 13px;
  margin-bottom: 10px;
  font-weight: 600;
}

.credential-stat {
  display: flex;
  align-items: center;
  gap: 5px;
}

.credential-stat.success {
  color: var(--accent);
}

.credential-stat.error {
  color: var(--danger);
}

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

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--line);
  transition: .3s;
  border-radius: 24px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .toggle-slider {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  box-shadow: 0 2px 8px rgba(109, 91, 214, 0.3);
}

input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.toggle-slider:hover {
  background-color: var(--muted);
}

input:checked + .toggle-slider:hover {
  background: linear-gradient(135deg, var(--accent-dark) 0%, var(--accent) 100%);
}

.priority-input {
  width: 70px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  transition: all 0.2s;
}

.priority-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(109, 91, 214, 0.1);
}

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

.spinning {
  animation: spin 0.8s linear infinite;
}

/* Loading States */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(109, 91, 214, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-spinner.large {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

/* Skeleton Screens */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 0%, var(--line) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  background: white;
  border-radius: 16px;
  padding: 24px;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.skeleton-line {
  height: 16px;
  margin-bottom: 12px;
  border-radius: 4px;
}

.skeleton-line.short { width: 60%; }
.skeleton-line.medium { width: 80%; }

.skeleton-circle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

/* Loading Overlay */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: inherit;
}

.loading-overlay .loading-spinner {
  width: 32px;
  height: 32px;
  border-width: 4px;
}

@media (max-width: 479px) {
  .auth-surface { padding: 14px; }
  .auth-shell {
    border-radius: 12px;
    grid-template-rows: auto 1fr;
    grid-template-columns: 1fr;
  }
  .auth-visual, .auth-panel, .client-hero-main { padding: 22px; }
  .auth-preview-body { grid-template-columns: 1fr; }
  .container.app-container { padding: 18px 14px 36px; }
  .header .user, .app-user, .client-hero-actions, .actions { width: 100%; }
  .top-link, .header button, .app-button, .btn-primary {
    width: 100%;
    justify-content: center;
  }
  .actions { align-items: stretch; flex-direction: column; gap: 12px; }
  .bots-grid { grid-template-columns: 1fr; }
  .usage-stats { grid-template-columns: 1fr; }
  .plans-grid { grid-template-columns: 1fr; }
  .bot-card { padding: 20px; }
  .modal-content { padding: 20px; border-radius: 12px; }
  .modal-header h3 { font-size: 18px; }
  .form-group input, .form-group textarea, .form-group select { font-size: 16px; }
  .btn-small { padding: 10px 14px; font-size: 13px; min-height: 44px; }
  .client-hero h2 { font-size: 28px; }
  .billing-section { padding: 20px; }
  .billing-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .usage-card { padding: 18px; }
  .plan-card { padding: 20px; }
  .credential-item { padding: 14px; }
  .warning-banner { padding: 16px; flex-direction: column; gap: 10px; }
  .warning-banner .icon { font-size: 28px; }
  .bot-actions { flex-direction: column; }
  .bot-actions .btn-small { width: 100%; }
  .modal { padding: 10px; align-items: flex-end; }
  .modal-content { max-height: 85vh; border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .toggle-switch { width: 50px; height: 28px; }
  .toggle-slider:before { height: 22px; width: 22px; }
  input:checked + .toggle-slider:before { transform: translateX(22px); }
}

/* ============================================
   EXTENDED COMPONENTS FOR SITE UNIFICATION
   ============================================ */

/* Navigation Grid (bot-manage.html) */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.nav-card {
  display: block;
  padding: 24px;
  border: 1px solid rgba(17, 24, 39, 0.09);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 34px rgba(17, 24, 39, 0.06);
  text-decoration: none;
  color: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.nav-card:hover {
  border-color: var(--accent);
  box-shadow: 0 18px 38px rgba(109, 91, 214, 0.12);
  transform: translateY(-2px);
}

.nav-card-icon { font-size: 32px; margin-bottom: 14px; display: block; }

.nav-card-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}

.nav-card-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

/* Data Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.data-table thead {
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-hover) 100%);
  border-bottom: 2px solid var(--line);
}

.data-table th {
  padding: 14px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  padding: 16px;
  border-bottom: 1px solid var(--surface);
  font-size: 14px;
  color: var(--ink);
}

.data-table tbody tr { transition: background 0.2s; }
.data-table tbody tr:hover { background: var(--surface); }
.data-table tbody tr:last-child td { border-bottom: none; }

.table-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.table-badge.active {
  background: var(--success-soft);
  color: var(--accent-dark);
}

.table-badge.inactive {
  background: var(--danger-soft);
  color: var(--danger);
}

.table-badge.pending {
  background: var(--warning-soft);
  color: var(--warning-dark);
}

.table-badge.processing {
  background: var(--info-soft);
  color: var(--info-dark);
}

/* Filter Panel */
.filter-panel {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(17, 24, 39, 0.09);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 12px 34px rgba(17, 24, 39, 0.06);
  position: sticky;
  top: 80px;
}

.filter-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--line);
}

.filter-panel-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  margin: 0;
}

.filter-panel-body { display: grid; gap: 16px; }

.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

/* Code Block */
.code-block {
  background: linear-gradient(135deg, var(--night) 0%, var(--night-line) 100%);
  color: var(--night-muted);
  padding: 20px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.code-block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.code-block-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--night-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.code-block-copy {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: var(--white);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.code-block-copy:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--accent);
}

/* Stat Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: linear-gradient(135deg, var(--white) 0%, var(--surface) 100%);
  border: 1px solid rgba(17, 24, 39, 0.09);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 12px 34px rgba(17, 24, 39, 0.06);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card:hover {
  border-color: var(--accent);
  box-shadow: 0 18px 38px rgba(109, 91, 214, 0.12);
  transform: translateY(-2px);
}
