:root {
  --cto-color-primary: #298DDA;
  --cto-color-primary-hover: #1E6FAD; /* Darker primary hover */
  --cto-color-accent: #87bfea; /* Accent blue */
  --cto-color-success-bg: #F0F9F3;
  --cto-color-success-border: #84B631;
  --cto-color-success-text: #739e2b;
  --cto-color-error-bg: #FFF5F5;
  --cto-color-error-border: #E44258;
  --cto-color-error-text: #B81E3E;
  --cto-color-warning-bg: #FFF9E5;
  --cto-color-warning-border: #FFD369;
  --cto-color-warning-text: #735C0F;
  --cto-color-surface: #FFFFFF; /* Panel surface background */
  --cto-color-surface-alt: #F0F4F9; /* Status panel background */
  --cto-color-surface-muted: #FAFAFA; /* Muted surface */
  --cto-color-border-strong: #E2E6EB; /* Strong outline border */
  --cto-color-border: #E2E6EB; /* Standard border */
  --cto-color-border-muted: #D9DDE1; /* Muted border */
  --cto-color-border-input: #C8CDD3; /* Inputs border */
  --cto-color-text-strong: #162D3D; /* Headings */
  --cto-color-link: #298DDA; /* Links */
  --cto-color-link-hover: #1E6FAD; /* Links hover */
  --cto-primary-text: #162D3D;
  --cto-secondary-text: #42526E;
  --cto-subdued-text: #6B6C72;

  /* Spacing system (multiples of 4px) */
  --cto-space-100: 4px;
  --cto-space-200: 8px;
  --cto-space-300: 12px;
  --cto-space-400: 16px;
  --cto-space-500: 20px;
  --cto-space-600: 24px;
  --cto-space-800: 32px;
  --cto-space-1000: 40px;

  /* CarryTheOne-specific tokens (cto-*) */
  --cto-font-family-sans: "Madefor", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --cto-text-color: #162D3D; /* Body text */
  --cto-panel-radius: 6px; /* Control panel radius */
  --cto-dialog-radius: 6px; /* Dialog radius */
  --cto-border-radius-sm: 4px; /* Small radius */
  --cto-panel-padding: var(--cto-space-600); /* Control panel padding */
  --cto-shadow-panel: 0 1px 2px rgba(0,0,0,0.06);
  --cto-shadow-elevated: 0 2px 6px rgba(0,0,0,0.08);
  --cto-shadow-modal: 0 4px 10px rgba(0,0,0,0.12);
  --cto-shadow-strong: 0 6px 16px rgba(0,0,0,0.15);
  --cto-shadow-light: 0 1px 3px rgba(0,0,0,0.08);
  --cto-spinner-track: #f3f3f3; /* Spinner track */
  --cto-transition-fast: 0.15s ease-in-out;
  --cto-transition-med: 0.3s ease;
  --cto-content-max: 750px; /* Control panel max width */
}

html {
  font-size: 16px;
}
@media (max-width: 1280px) {
  html { font-size: 14px; };
}

body {
  font-family: var(--cto-font-family-sans);
  background: var(--cto-color-surface-alt);
  color: var(--cto-secondary-text);
  margin: 0;
  padding: 0;
}

h1 {
  font-weight: 600;
  font-size: clamp(1.625rem, 1.2rem + 1.2vw, 2rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--cto-color-text-strong);
  margin: 0 0 var(--cto-space-400);
}

p {
  margin: var(--cto-space-400) 0;
}

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

a:hover {
  text-decoration: underline;
  color: var(--cto-color-link-hover);
}

.control-panel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: var(--cto-space-200);
  text-align: center;
}

.control-panel {
  border: 1px solid var(--cto-color-border);
  box-shadow: var(--cto-shadow-panel);
  background: var(--cto-color-surface);
  padding: var(--cto-panel-padding);
  border-radius: var(--cto-panel-radius);
  box-shadow: var(--cto-shadow-panel);
  width: min(var(--cto-content-max), 100%);
  margin-block: var(--cto-space-400);
}

.control-panel h1:first-child {
  margin-top: 0;
}

.control-panel-row {
  position: relative;
  margin: var(--cto-space-400) 0;
}

#control-panel-status {
  display: inline-block;
}

#control-panel-status-loading {
  display: none;
  position: absolute;
  top: 0;
  right: -1.75rem;
  height: var(--cto-space-400);
  width: var(--cto-space-400);
  border: 2px solid var(--cto-spinner-track);
  border-top: 2px solid var(--cto-color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.button-group {
  display: flex;
  justify-content: center;
  gap: var(--cto-space-400);
  flex-wrap: wrap;
}

.logo img {
  height: var(--cto-space-1000);
  margin-bottom: var(--cto-space-600);
}

.status-panel {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  background-color: var(--cto-color-surface-alt);
  padding: var(--cto-panel-padding);
  border-radius: var(--cto-dialog-radius);
  border: 1px solid var(--cto-color-border);
  box-shadow: var(--cto-shadow-panel);
  text-align: left;
}

.status-panel .column {
  flex: 1;
  padding: 0 var(--cto-space-400);
  min-width: 200px;
}

.status-panel .action {
  text-align: right;
}

.button-menu-wrapper {
  position: relative;
  display: inline-block;
}

.button-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: #fff;
  border: 1px solid var(--cto-color-border-muted);
  border-radius: var(--cto-border-radius-sm);
  list-style: none;
  padding: var(--cto-space-100) 0;
  margin: 0;
  box-shadow: var(--cto-shadow-elevated);
  min-width: 120px;
  z-index: 10;
  display: none;
}

.button-menu li {
  padding: var(--cto-space-200) var(--cto-space-400);
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
}

.button-menu li:hover {
  background-color: #f0f4f8;
}

.button-menu li a {
  display: block;
  text-decoration: none;
  color: inherit;
  width: 100%;
  height: 100%;
}

.button-menu li a:hover {
  background-color: #f0f4f8;
}

.confirm,
.configuration-notice,
.account,
.contact-dialog,
.faqs,
.terms,
.privacy {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border: 1px solid var(--cto-color-border-muted);
  border-radius: var(--cto-dialog-radius);
  box-shadow: var(--cto-shadow-strong);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  padding: var(--cto-space-500);
  max-width: 600px;
  max-height: 80vh;
  width: 90%;
}

.confirm {
  background: var(--cto-color-surface);
  box-shadow: var(--cto-shadow-elevated);
  border: 1px solid var(--cto-color-border);
  text-align: justify;
}

.confirm-buttons {
  margin-top: var(--cto-space-400);
  display: flex;
  justify-content: center;
  gap: var(--cto-space-400);
}

.confirm-message {
  font-size: 1rem;
}

.statusConfigurationRequired {
  font-weight: 600;
  color: var(--cto-color-error-border);
}

#statusConfigurationRequiredLink {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

#statusConfigurationRequiredLink::after {
  content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAQElEQVR42qXKwQkAIAxDUUdxtO6/RBQkQZvSi8I/pL4BoGw/XPkh4XigPmsUgh0626AjRsgxHTkUThsG2T/sIlzdTsp52kSS1wAAAABJRU5ErkJggg==);
  margin-left: var(--cto-space-200);
  opacity: 0.7;
  transition: opacity var(--cto-transition-med);
}

#statusConfigurationRequiredLink:hover::after {
  opacity: 1;
}

.configuration-notice {
  background: var(--cto-color-surface);
  box-shadow: var(--cto-shadow-elevated);
  border: 1px solid var(--cto-color-border);
  max-height: 80vh;
}

.configuration-notice-title {
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: var(--cto-space-400);
  text-align: center;
}

.configuration-notice-message {
  font-size: 1rem;
  overflow-y: auto;
  margin-bottom: var(--cto-space-400);
  flex: 1 1 auto;
}

.configuration-notice-message pre {
  white-space: pre-wrap;
  overflow-y: auto;
  overflow-x: hidden;
  margin: 0;
  flex: 1 1 auto;
}

.configuration-notice-buttons {
  display: flex;
  justify-content: center;
  gap: var(--cto-space-400);
  flex-shrink: 0;
}

.contact-dialog,
.faqs,
.terms,
.privacy {
  width: 90%;
}

.faqs,
.terms,
.privacy {
  height: 75vh;
}

.contact-header,
.account-header,
.faqs-header,
.terms-header,
.privacy-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  font-size: 1.25rem;
}

.contact-close,
.account-close,
.faqs-close,
.terms-close,
.privacy-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: #666;
}

.contact-body,
.account-body,
.faqs-body,
.terms-body,
.privacy-body {
  flex: 1 1 auto;
  overflow-y: auto;
}

.contact-body p {
  margin-bottom: var(--cto-space-400);
}

.account-body {
  padding-right: var(--cto-space-400);
}

.password-req-list {
  background: var(--cto-color-surface-muted);
  border: 1px solid var(--cto-color-border);
  border-radius: var(--cto-border-radius-sm);
  padding: var(--cto-space-500) var(--cto-space-800);
  margin: var(--cto-space-400) 0;
  list-style: none;
  font-size: 1rem;
  color: var(--cto-subdued-text);
  transition: box-shadow 0.18s;
  box-shadow: var(--cto-shadow-panel);
  display: none;
}
.password-req-list.visible { display: block; }

.password-req {
  margin-bottom: var(--cto-space-200);
  display: flex;
  align-items: center;
  gap: 0.5em;
  color: var(--cto-subdued-text);
}
.password-req:last-child { margin-bottom: 0; }

.password-req.met { color: var(--cto-color-success-text); }

.password-req-icon {
  display: inline-block;
  width: 1.25em;
  height: 1.25em;
  border-radius: 50%;
  border: 2px solid var(--cto-color-border-muted);
  vertical-align: middle;
  background: var(--cto-color-surface-muted);
  transition: background 0.2s, border-color 0.2s;
  position: relative;
}

.password-req-icon.met {
  background: var(--cto-color-success-bg);
  border-color: var(--cto-color-success-border);
}

.password-req-icon.met::after {
  content: '✔';
  color: currentColor;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 1em;
  font-weight: bold;
  line-height: 1;
}

.contact-body textarea {
  width: 100%;
  height: 180px;
  padding: var(--cto-space-300);
  border: 1px solid var(--cto-color-border-input);
  border-radius: var(--cto-border-radius-sm);
  resize: vertical;
  font-family: inherit;
  font-size: 1rem;
  box-sizing: border-box;
}

.contact-footer {
  margin-top: var(--cto-space-400);
  display: flex;
  justify-content: flex-end;
}

.account-form-group {
  margin-bottom: var(--cto-space-600);
  display: flex;
  flex-direction: column;
}

.account-form-label {
  font-size: 1rem;
  font-weight: 500;
  color: var(--cto-text-color);
  margin-bottom: var(--cto-space-300);
  letter-spacing: 0.01em;
}

.account-form-input {
  appearance: none;
  width: 100%;
  padding: var(--cto-space-300) var(--cto-space-400);
  border: 1px solid var(--cto-color-border-input);
  border-radius: var(--cto-border-radius-sm);
  font-size: 1rem;
  background: #fff;
  color: var(--cto-text-color);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  box-sizing: border-box;
  font-family: var(--cto-font-family-sans);
}

.account-form-input:focus {
  border-color: var(--cto-color-primary);
  box-shadow: 0 0 0 3px rgba(17, 109, 255, 0.15);
  outline: none;
}

select.account-form-input {
  appearance: none;
  background-color: #fff;
  border: 1px solid var(--cto-color-border-input);
  border-radius: var(--cto-border-radius-sm);
  padding: var(--cto-space-300) var(--cto-space-400);
  font-size: 1rem;
  color: var(--cto-text-color);
  font-family: var(--cto-font-family-sans);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  box-sizing: border-box;
  background-image: url("data:image/svg+xml;utf8,<svg fill='gray' height='18' viewBox='0 0 20 20' width='18' xmlns='http://www.w3.org/2000/svg'><path d='M7.293 8.293a1 1 0 011.414 0L10 9.586l1.293-1.293a1 1 0 111.414 1.414l-2 2a1 1 0 01-1.414 0l-2-2a1 1 0 010-1.414z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.7em center;
  background-size: 1.1em;
  padding-right: 2.2em;
  cursor: pointer;
}

select.account-form-input:focus {
  border-color: var(--cto-color-primary);
  box-shadow: 0 0 0 3px rgba(17, 109, 255, 0.15);
  outline: none;
}

.account-form-textarea {
  appearance: none;
  width: 100%;
  padding: var(--cto-space-300) var(--cto-space-400);
  border: 1px solid var(--cto-color-border-input);
  border-radius: var(--cto-border-radius-sm);
  font-size: 1rem;
  font-family: var(--cto-font-family-sans);
  background: #fff;
  color: var(--cto-text-color);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  box-sizing: border-box;

  /* textarea specifics */
  line-height: 1.4;
  min-height: calc(5 * 1.4em + 2 * var(--cto-space-300)); /* ~5 rows + vertical padding */
  resize: vertical;       /* allow vertical resize only */
  overflow-y: auto;       /* vertical scrollbar only when needed */
  overflow-x: hidden;     /* no horizontal scroll */
  white-space: pre-wrap;  /* wrap long lines */
  word-break: break-word; /* break very long words if necessary */
}

.account-form-textarea:focus {
  border-color: var(--cto-color-primary);
  box-shadow: 0 0 0 3px rgba(17, 109, 255, 0.15);
  outline: none;
}

.account-form-button-primary {
  display: inline-block;
  background-color: var(--cto-color-primary);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  padding: var(--cto-space-300) var(--cto-space-800);
  border: none;
  border-radius: var(--cto-border-radius-sm);
  box-shadow: 0 2px 4px rgba(22, 45, 61, 0.08);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
  font-family: var(--cto-font-family-sans);
}

.account-form-button-primary:hover,
.account-form-button-primary:focus {
  background-color: var(--cto-color-primary-hover);
  box-shadow: 0 2px 4px rgba(22, 45, 61, 0.08);
  outline: none;
}

.account-form-help {
  color: var(--cto-subdued-text);
  font-size: 0.93em;
  margin-top: var(--cto-space-200);
  line-height: 1.4;
}

.account-form-divider {
  border: none;
  border-top: 1px solid var(--cto-color-border);
  margin: var(--cto-space-800) 0;
  height: 0;
  background: none;
}

.newWindowLink {
  color: var(--cto-color-link);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.newWindowLink::after {
  content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAQElEQVR42qXKwQkAIAxDUUdxtO6/RBQkQZvSi8I/pL4BoGw/XPkh4XigPmsUgh0626AjRsgxHTkUThsG2T/sIlzdTsp52kSS1wAAAABJRU5ErkJggg==);
  margin-left: var(--cto-space-200);
  opacity: 0.5;
  transition: opacity var(--cto-transition-med);
}

.newWindowLink:hover::after {
  opacity: 1;
}

.accountLink {
  font-weight: bold;
}

.faqLink {
  font-weight: bold;
}

.faq {
  color: var(--cto-color-link);
  cursor: pointer;
}

.faq + div > p:first-child {
  margin-top: 0;
}

.faq + div > p:last-child {
  margin-bottom: 0;
}

.notification-box {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 400px;
  width: 90%;
  padding: var(--cto-space-400) var(--cto-space-500);
  border-radius: var(--cto-dialog-radius);
  text-align: center;
  font-size: 1rem;
  box-shadow: var(--cto-shadow-modal);
  z-index: 9999;
  opacity: 0;
  transition: opacity var(--cto-transition-med);
}

.notification-box.success {
  box-shadow: var(--cto-shadow-panel);
  background: var(--cto-color-success-bg);
  border: 1px solid var(--cto-color-success-border);
  color: var(--cto-color-success-text);
}

.notification-box.error {
  box-shadow: var(--cto-shadow-panel);
  background: var(--cto-color-error-bg);
  border: 1px solid var(--cto-color-error-border);
  color: var(--cto-color-error-text);
}

.notification-ok-button {
  margin-top: var(--cto-space-400);
  display: flex;
  justify-content: center;
}

.notification-ok-button button {
  padding: var(--cto-space-200) var(--cto-space-400);
  background-color: var(--cto-color-primary);
  color: #fff;
  border: none;
  border-radius: var(--cto-border-radius-sm);
  cursor: pointer;
}

.notification-ok-button button:hover {
  background-color: var(--cto-color-primary-hover);
}

.cp-validation-notice {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--cto-color-warning-bg);
  color: var(--cto-color-warning-text);
  border: 1px solid var(--cto-color-warning-border);
  padding: var(--cto-space-400) var(--cto-space-500);
  border-radius: var(--cto-dialog-radius);
  box-shadow: var(--cto-shadow-light);
  z-index: 999;
  font-size: 0.95rem;
  display: none;
  animation: fadeOutNotice 4s forwards;
}

@keyframes fadeOutNotice {
  0% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; display: none; }
}

.header {
  display: flex;
  align-items: center;
  margin-bottom: var(--cto-space-200);
}

.header img {
  height: 32px;
}

.integration-desc {
  margin: var(--cto-space-200) 0;
  font-size: 1rem;
  color: #666;
}

.tabs-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--cto-color-border);
}

.tabs {
  display: flex;
}

.tab {
  padding: var(--cto-space-200) var(--cto-space-400);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab.active {
  border-bottom: 2px solid var(--cto-color-accent);
  font-weight: 600;
}

.tab-nav-buttons {
  display: flex;
  gap: var(--cto-space-200);
}

.tab-content-wrapper {
  flex-grow: 1;
  overflow-y: auto;
  padding: var(--cto-space-600);
  padding-bottom: var(--cto-space-1000);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.button-cp {
  background: linear-gradient(135deg, var(--cto-color-primary), var(--cto-color-primary-hover));
  border: none;
  border-radius: var(--cto-border-radius-sm);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  padding: var(--cto-space-200) var(--cto-space-400);
  line-height: 1.5;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease;
  font-family: inherit;
}

.button-cp:hover {
  transform: translateY(-2px);
}

.button-cp:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--cto-space-300) 0;
  border-bottom: 1px solid var(--cto-color-border);
}

.setting-label {
  flex: 1;
}

.advanced-option {
  border-left: 4px solid var(--cto-color-primary);
  padding-left: var(--cto-space-400);
  background-color: var(--cto-color-surface-muted);
}

.setting-input-group {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--cto-space-200);
}

.setting-input-group input,
.setting-input-group select {
  box-sizing: border-box;
  padding: var(--cto-space-200);
  width: 250px;
  background: #fff;
  border: 1px solid var(--cto-color-border-input);
  border-radius: var(--cto-border-radius-sm);
  font-size: 1rem;
  font-family: inherit;
}

.help-invalid-container {
  position: relative;
  display: inline-block;
}

.help-button,
.help-placeholder {
  width: 2rem;
  display: inline-block;
  text-align: center;
  font-size: 1.2em;
  line-height: 1;
  color: #999;
  background: none;
  border: none;
  cursor: pointer;
}

.help-placeholder {
  visibility: hidden;
}

.invalid {
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: var(--cto-space-100);
  font-weight: bold;
  color: var(--cto-color-error-border);
  pointer-events: none;
}

.dialog {
  display: none;
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -30%);
  background: #fff;
  padding: var(--cto-space-500);
  border: 1px solid var(--cto-color-border-muted);
  border-radius: var(--cto-border-radius-sm);
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  z-index: 1000;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  font-size: 1.25rem;
}

.dialog .close {
  cursor: pointer;
  font-weight: bold;
  color: #999;
  font-size: 1.5rem;
  line-height: 1;
  background: none;
  border: none;
}

.dialog .close:hover {
  color: #000;
}

.dialog-content {
  margin-top: var(--cto-space-400);
}

.validation-msg {
  margin-top: var(--cto-space-400);
  font-size: 0.9rem;
  font-style: italic;
}

.module-block {
  box-shadow: var(--cto-shadow-panel);
  border: 1px solid var(--cto-color-border);
  border-radius: var(--cto-border-radius-sm);
  padding: var(--cto-space-400);
  margin-bottom: var(--cto-space-400);
  background-color: var(--cto-color-surface-muted);
}

.module-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--cto-space-200);
}

.module-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.remove-module-button {
  background: none;
  border: none;
  color: #999;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  margin-left: var(--cto-space-400);
}

.remove-module-button:hover {
  color: #000;
}

.section-notes {
  margin-bottom: var(--cto-space-500);
  line-height: 1.4;
  font-size: 0.95rem;
  color: var(--cto-secondary-text);
}

.section-note {
  margin-bottom: var(--cto-space-300);
}

.overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.7);
  z-index: 9999;
  display: none;
  justify-content: center;
  align-items: center;
}

.spinner {
  border: 4px solid var(--cto-spinner-track);
  border-top: 4px solid var(--cto-color-primary);
  border-radius: 50%;
  width: var(--cto-space-1000);
  height: var(--cto-space-1000);
  animation: spin 1s linear infinite;
}

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

/* Billing page bits */
.billing-desc {
  margin: var(--cto-space-200) 0 var(--cto-space-400);
  text-align: center;
  color: var(--cto-subdued-text);
}

.billing-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--cto-space-300);
  margin: var(--cto-space-400) 0;
}

.billing-label,
.billing-input {
  flex: 0 0 auto;
}

.billing-input select {
  width: auto;
  min-width: 10ch;
}

#paypal-button-container {
  display: block;
  transition: opacity var(--cto-transition-fast);
}

@media (max-width: 480px) {
  .billing-controls {
    flex-wrap: wrap;
    row-gap: var(--cto-space-200);
  };
}

/* ===== Login form ===== */
#login-form {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.login-form-input {
  box-sizing: border-box;
  width: 100%;
  padding: var(--cto-space-200) var(--cto-space-300);
  border: 1px solid var(--cto-color-border-input);
  border-radius: var(--cto-border-radius-sm);
  font: inherit;
  background: #fff;
  color: var(--cto-text-color);
  transition: border-color var(--cto-transition-fast), box-shadow var(--cto-transition-fast);
}

.login-form-input::placeholder {
  color: #9aa0a6;
}

.login-form-input:focus {
  outline: none;
  border-color: var(--cto-color-primary);
  box-shadow: 0 0 0 3px rgba(17, 109, 255, 0.15);
}

.login-form-input:disabled {
  background: var(--cto-color-surface-alt);
  color: #9aa0a6;
  cursor: not-allowed;
}

/* Make the login form rows breathe a little on small screens */
@media (max-width: 480px) {
  .control-panel-row {
    margin: var(--cto-space-300) 0;
  }
}

/* Keep the login button comfortably tappable and full width on narrow viewports */
#login-form .button-group {
  gap: var(--cto-space-300);
}

@media (max-width: 480px) {
  #login-form .button-group .button-cp {
    width: 100%;
  }
}

/* Optional: small helper class if you want error messaging next to the form later */
.login-form-error {
  margin-top: var(--cto-space-200);
}

/* Dialogs */
.dialog {
  display: none;
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -30%);
  background: #fff;
  padding: var(--cto-space-500);
  border: 1px solid var(--cto-color-border-muted);
  border-radius: var(--cto-border-radius-sm);
  box-shadow: var(--cto-shadow-elevated);
  z-index: 1000;
}

/* Module blocks */
.module-block {
  box-shadow: var(--cto-shadow-panel);
  border: 1px solid var(--cto-color-border);
  border-radius: var(--cto-border-radius-sm);
  padding: var(--cto-space-400);
  margin-bottom: var(--cto-space-400);
  background-color: var(--cto-color-surface-muted);
}

/* FAQ tweaks */
.faq {
  color: var(--cto-color-link);
  cursor: pointer;
}

/* Overlay (already defined earlier, but here for completeness) */
.overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.7);
  z-index: 9999;
  display: none;
  justify-content: center;
  align-items: center;
}

/* Spinner (already defined earlier, repeated here for end-of-file context) */
.spinner {
  border: 4px solid var(--cto-spinner-track);
  border-top: 4px solid var(--cto-color-primary);
  border-radius: 50%;
  width: var(--cto-space-1000);
  height: var(--cto-space-1000);
  animation: spin 1s linear infinite;
}

/* Billing page */
.billing-desc {
  margin: var(--cto-space-200) 0 var(--cto-space-400);
  text-align: center;
  color: var(--cto-subdued-text);
}

/* Login form error (final confirm) */
.login-form-error {
  margin-top: var(--cto-space-200);
}

.hi-price-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--cto-space-400);
}
.hi-price-card {
  border: 1px solid var(--cto-color-border);
  border-radius: var(--cto-border-radius-sm);
  background: var(--cto-color-surface-muted);
  box-shadow: var(--cto-shadow-panel);
  padding: var(--cto-space-500);
  text-align: center;
}
.hi-price-period {
  color: var(--cto-primary-text);
  margin-bottom: var(--cto-space-200);
  font-weight: 600;
}
.hi-price-amount {
  color: var(--cto-color-text-strong);
  font-weight: 700;
  font-size: 1.25rem;
}
.hi-price-curr {
  color: var(--cto-subdued-text);
  font-size: 0.9rem;
  margin-left: 0.25ch;
}

.hi-summary {
  background: var(--cto-color-surface-alt);
  border: 1px solid var(--cto-color-border);
  border-radius: var(--cto-border-radius-sm);
  padding: var(--cto-space-500);
  margin: var(--cto-space-400) 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--cto-space-600);
}
.hi-summary-label {
  color: var(--cto-subdued-text);
  margin-bottom: var(--cto-space-100);
  font-size: 0.95rem;
}
.hi-summary-value {
  color: var(--cto-color-text-strong);
  font-weight: 600;
  font-size: 1.05rem;
}

.hi-check {
  align-items: flex-start;
  margin: var(--cto-space-300) 0;
  color: var(--cto-secondary-text);
  text-align: left;
}

#newStartDate.account-form-input {
  display: block;
  margin: 0.25rem auto;
  width: 9rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  box-sizing: border-box;
}

#dateErrorMsg.account-form-help {
  max-width: 9rem;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.hi-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  text-align: left;
}

.log-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--cto-color-surface);
  border: 1px solid var(--cto-color-border);
  border-radius: var(--cto-dialog-radius);
  box-shadow: var(--cto-shadow-strong);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  padding: var(--cto-space-500);
  max-width: 900px;
  max-height: 80vh;
  width: 90%;
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--cto-color-text-strong);
}

.log-close {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: #666;
  line-height: 1;
  padding: 0;
}
.log-close:hover { color: #000; }
.log-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(17,109,255,0.15);
  border-radius: var(--cto-border-radius-sm);
}

.log-body {
  flex: 1 1 auto;
  overflow-y: auto;
  margin-top: var(--cto-space-400);
}

.log-hint {
  margin-bottom: var(--cto-space-300);
  color: var(--cto-subdued-text);
  font-size: 0.875rem;
}

/* ===== Table ===== */
.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.log-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--cto-color-surface);
  text-align: left;
  border-bottom: 1px solid var(--cto-color-border-muted);
  padding: var(--cto-space-200) var(--cto-space-200);
  white-space: nowrap;
}

.log-table tbody td {
  padding: var(--cto-space-200) var(--cto-space-200);
  border-bottom: 1px solid var(--cto-color-border-muted);
  vertical-align: top;
}

/* light zebra striping */
.log-table tbody tr:nth-child(even) {
  background: rgba(22, 45, 61, 0.02);
}

/* Loading state */
.log-loading td {
  padding: var(--cto-space-800);
  text-align: center;
}
.log-loading-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
}
/* use the existing .spinner but size it down inside the loader row */
.log-loading .spinner {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

/* Empty state */
.log-empty td {
  text-align: center;
  padding: var(--cto-space-500);
  color: var(--cto-subdued-text);
}
.log-empty-msg { font-size: 0.9375rem; }

/* Footer */
.log-footer {
  margin-top: var(--cto-space-400);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ===== Utilities ===== */
.log-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.log-dim {
  color: var(--cto-subdued-text);
}

/* ===== Status badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  line-height: 1;
  border: 1px solid;
  white-space: nowrap;
}

.badge--ok {
  color: var(--cto-color-success-text);
  border-color: var(--cto-color-success-border);
  background: var(--cto-color-success-bg);
}

.badge--fail {
  color: var(--cto-color-error-text);
  border-color: var(--cto-color-error-border);
  background: var(--cto-color-error-bg);
}

.badge-dot {
  width: .5em;
  height: .5em;
  border-radius: 50%;
  background: currentColor;
}
