﻿/* ==========================================================================
   LoopCart 鈥?Mobile-First Design System
   ========================================================================== */

/* --------------------------------------------------------------------------
   Design Tokens (CSS Custom Properties)
   -------------------------------------------------------------------------- */
:root {
  /* Colors 鈥?iOS-inspired clean palette */
  --color-bg:        #F7F4F2;
  --color-surface:   #FFFFFF;
  --color-primary:   #2C2C2E;
  --color-accent:    #FF6B4A;
  --color-accent-hover:   #E8503A;
  --color-accent-light:   #FFF0EC;
  --color-success:   #34C759;
  --color-warning:   #FF9500;
  --color-danger:    #FF3B30;

  --color-text:      #1C1C1E;
  --color-text-secondary: #6E6E73;
  --color-text-tertiary:  #AEAEB2;
  --color-border:    #E8E5E2;
  --color-divider:   #F0EDEA;
  --color-input-bg:  #FAF8F7;

  /* Typography */
  --font-sans:  -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  --font-mono:  "SF Mono", "SFMono-Regular", "Menlo", "Consolas", monospace;

  /* Font sizes 鈥?modular scale */
  --text-xs:   clamp(0.6875rem, 0.65rem + 0.17vw, 0.75rem);  /* 11-12px */
  --text-sm:   clamp(0.75rem,   0.7rem  + 0.22vw, 0.8125rem); /* 12-13px */
  --text-base: clamp(0.875rem,  0.8rem  + 0.33vw, 0.9375rem); /* 14-15px */
  --text-md:   clamp(0.9375rem, 0.85rem + 0.39vw, 1.0625rem); /* 15-17px */
  --text-lg:   clamp(1.125rem,  1rem    + 0.56vw, 1.375rem);  /* 18-22px */
  --text-xl:   clamp(1.375rem,  1.15rem + 1vw,    1.75rem);   /* 22-28px */
  --text-2xl:  clamp(1.75rem,   1.4rem  + 1.56vw, 2.125rem);  /* 28-34px */

  /* Spacing 鈥?4px base grid */
  --space-1:  0.25rem;   /* 4px  */
  --space-2:  0.5rem;    /* 8px  */
  --space-3:  0.75rem;   /* 12px */
  --space-4:  1rem;      /* 16px */
  --space-5:  1.25rem;   /* 20px */
  --space-6:  1.5rem;    /* 24px */
  --space-8:  2rem;      /* 32px */
  --space-10: 2.5rem;    /* 40px */
  --space-12: 3rem;      /* 48px */

  /* Radii */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-pill: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);

  /* Transitions */
  --ease-out: cubic-bezier(0.25, 0.1, 0.25, 1);
  --duration-fast: 150ms;
  --duration-base: 250ms;
}

/* --------------------------------------------------------------------------
   Reset & Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
h1 { font-size: var(--text-2xl); font-weight: 700; line-height: 1.2; }
h2 { font-size: var(--text-xl);  font-weight: 600; line-height: 1.25; }
h3 { font-size: var(--text-lg);  font-weight: 600; line-height: 1.3; }
h4 { font-size: var(--text-base); font-weight: 600; }

p  { margin-bottom: var(--space-3); }
a  { color: var(--color-accent); text-decoration: none; }
a:active { opacity: 0.6; }
@media (hover: hover) { a:hover { color: var(--color-accent-hover); } }

/* --------------------------------------------------------------------------
   Layout Containers
   -------------------------------------------------------------------------- */
.container {
  padding: 0 var(--space-4);
  width: 100%;
}

.page {
  padding: var(--space-4) 0 var(--space-12);
}

/* --------------------------------------------------------------------------
   Header / Top Bar
   -------------------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 44px;
}

.topbar-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
}

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

.topbar a {
  color: var(--color-accent);
  font-size: var(--text-md);
  font-weight: 500;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-accent);
  font-size: var(--text-md);
  padding: var(--space-2) 0;
  min-height: 44px;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

@media (hover: hover) {
  .card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
  }
}

.card:active {
  transform: scale(0.985);
  box-shadow: none;
}

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

.card-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.35;
  flex: 1;
}

.card-meta {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-1);
}

.card-body {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.card-footer {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-divider);
}

/* --------------------------------------------------------------------------
   Status Badges
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.badge-active   { background: #E8F8EE; color: #1A7F3E; }
.badge-inactive { background: #F0EDEA; color: var(--color-text-secondary); }
.badge-success  { background: #E8F8EE; color: #1A7F3E; }
.badge-error    { background: #FFEBEB; color: #CC1A1A; }
.badge-warning  { background: #FFF3E0; color: #B86500; }
.badge-info     { background: #E8F0FE; color: #1A5FCC; }
.badge-pill     { background: var(--color-divider); color: var(--color-text-secondary); }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.form-group {
  margin-bottom: var(--space-4);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  color: var(--color-text);
  background: var(--color-input-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
  -webkit-appearance: none;
  min-height: 44px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(255, 107, 74, 0.12);
  outline: none;
  background: var(--color-surface);
}

@media (hover: hover) {
  .form-input:hover,
  .form-select:hover,
  .form-textarea:hover {
    border-color: var(--color-accent);
  }
}

.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--color-divider);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-tertiary);
}

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

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238E8E93' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--text-sm);
  color: var(--color-danger);
  margin-top: var(--space-1);
}

/* Conditional form sections */
.conditional-field {
  display: none;
  padding: var(--space-3);
  background: var(--color-divider);
  border-radius: var(--radius-sm);
  margin-top: var(--space-2);
}

.conditional-field.active {
  display: block;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  font-weight: 500;
  line-height: 1;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  min-height: 44px;
  min-width: 44px;
  white-space: nowrap;
  -webkit-appearance: none;
  user-select: none;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
@media (hover: hover) { .btn:hover { opacity: 0.9; } }

.btn-primary {
  background: var(--color-accent);
  color: #FFFFFF;
}
.btn-primary:active { background: var(--color-accent-hover); }
@media (hover: hover) { .btn-primary:hover { background: var(--color-accent-hover); } }

.btn-danger {
  background: var(--color-danger);
  color: #FFFFFF;
}
.btn-danger:active { background: #D6301F; }
@media (hover: hover) { .btn-danger:hover { background: #D6301F; } }

.btn-success {
  background: var(--color-success);
  color: #FFFFFF;
}
.btn-success:active { background: #2DA84E; }
@media (hover: hover) { .btn-success:hover { background: #2DA84E; } }

.btn-outline {
  background: transparent;
  color: var(--color-accent);
  border: 1px solid var(--color-border);
}
.btn-outline:active { background: var(--color-divider); }
@media (hover: hover) { .btn-outline:hover { background: var(--color-divider); } }

.btn-ghost {
  background: transparent;
  color: var(--color-accent);
}
.btn-ghost:active { background: rgba(255, 107, 74, 0.08); }
@media (hover: hover) { .btn-ghost:hover { background: rgba(255, 107, 74, 0.08); } }

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  min-height: 32px;
  border-radius: var(--radius-pill);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-group {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  font-size: var(--text-lg);
}

button:focus-visible,
.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Login Screen
   -------------------------------------------------------------------------- */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: var(--space-6);
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-10) var(--space-6);
  box-shadow: var(--shadow-md);
  text-align: center;
}

.login-logo {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: -0.5px;
  margin-bottom: var(--space-1);
}

.login-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-8);
}

.login-form {
  text-align: left;
}

.login-form .btn {
  margin-top: var(--space-3);
  width: 100%;
}

#login-error {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-danger);
  min-height: 24px;
  margin-top: var(--space-3);
  transition: opacity var(--duration-fast);
}

/* --------------------------------------------------------------------------
   Reminder Card List
   -------------------------------------------------------------------------- */
#reminders-list {
  padding-bottom: var(--space-4);
}

.reminder-card {
  display: flex;
  flex-direction: column;
  min-height: 140px;
  cursor: pointer;
  padding: var(--space-5) var(--space-4);
}

@media (min-width: 768px) {
  .reminder-card {
    padding: var(--space-6) var(--space-5);
  }
}

.reminder-card .card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  min-height: 1.5em;
  margin-bottom: var(--space-3);
}

.reminder-card .card-title {
  flex: 1;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-meta {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  min-height: 28px;
  margin-bottom: var(--space-2);
}

.reminder-platform {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  background: var(--color-accent-light);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  color: var(--color-accent);
  font-weight: 600;
}

.reminder-next {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: auto;
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-border);
}

.reminder-next strong {
  color: var(--color-accent);
  font-weight: 700;
  font-size: 1.1em;
}

.reminder-category {
  display: inline-flex;
  padding: 3px 10px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Empty State
   -------------------------------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-4);
  text-align: center;
  margin: 0 auto;
  max-width: 480px;
}

.empty-icon {
  font-size: 48px;
  line-height: 1;
  margin-bottom: var(--space-4);
  opacity: 0.4;
}

.empty-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.empty-desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-6);
  max-width: 260px;
}

/* --------------------------------------------------------------------------
   Detail Page
   -------------------------------------------------------------------------- */
.detail-section {
  padding: 0 var(--space-4);
}

.detail-section + .detail-section {
  margin-top: var(--space-6);
}

.detail-section-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-3);
  padding: 0 var(--space-4);
}

.detail-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  min-height: 44px;
}

.detail-info-row:last-child {
  border-bottom: none;
}

.detail-info-label {
  font-size: var(--text-md);
  color: var(--color-text-secondary);
}

.detail-info-value {
  font-size: var(--text-md);
  font-weight: 500;
  color: var(--color-text);
  text-align: right;
  max-width: 60%;
  word-break: break-all;
}

.detail-info-link {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.action-bar {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-4);
  flex-wrap: wrap;
}

.action-bar .btn {
  flex: 1;
  min-width: 0;
}

/* Notification history in detail */
.notification-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  min-height: 44px;
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.notification-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.notification-dot.success { background: var(--color-success); }
.notification-dot.error   { background: var(--color-danger); }

.notification-time {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

/* --------------------------------------------------------------------------
   Settings
   -------------------------------------------------------------------------- */
.settings-group {
  padding: 0 var(--space-4);
  margin-bottom: var(--space-6);
}

.settings-group-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-2);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-divider);
  min-height: 44px;
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-label {
  font-size: var(--text-md);
  color: var(--color-text);
}

.settings-value {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.settings-status {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-indicator.online  { background: var(--color-success); }
.status-indicator.offline { background: var(--color-danger); }
.status-indicator.unknown { background: var(--color-text-tertiary); }

/* --------------------------------------------------------------------------
   Log Page 鈥?Table
   -------------------------------------------------------------------------- */
#logs-list {
  padding-bottom: var(--space-4);
}

.log-item {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}

.log-item:last-child {
  border-bottom: none;
}

.log-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-1);
}

.log-provider {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  font-weight: 500;
}

.log-time {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.log-detail {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

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

/* --------------------------------------------------------------------------
   Toast / Message
   -------------------------------------------------------------------------- */
.toast {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  text-align: center;
  margin: var(--space-3) var(--space-4);
}

.toast-error {
  background: #FFEBEB;
  color: var(--color-danger);
}

.toast-success {
  background: #E8F8EE;
  color: #1A7F3E;
}

.toast-info {
  background: var(--color-divider);
  color: var(--color-text-secondary);
}

/* --------------------------------------------------------------------------
   Loading
   -------------------------------------------------------------------------- */
.htmx-indicator {
  opacity: 0;
  transition: opacity var(--duration-fast);
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.loading-center {
  display: flex;
  justify-content: center;
  padding: var(--space-8);
}

/* --------------------------------------------------------------------------
   Utility Classes
   -------------------------------------------------------------------------- */
.text-center   { text-align: center; }
.text-right    { text-align: right; }
.text-sm       { font-size: var(--text-sm); }
.text-xs       { font-size: var(--text-xs); }
.text-secondary { color: var(--color-text-secondary); }
.text-danger   { color: var(--color-danger); }
.text-accent   { color: var(--color-accent); }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hidden { display: none !important; }

/* --------------------------------------------------------------------------
   Touch target minimums
   -------------------------------------------------------------------------- */
button,
a,
input,
select,
textarea,
[role="button"] {
  touch-action: manipulation;
}

/* --------------------------------------------------------------------------
   Print / Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  body {
    background: #fff;
    color: #000;
    max-width: none;
  }
  .topbar,
  .action-bar,
  .btn {
    display: none;
  }
}

/* ==========================================================================
   Skeleton Loading
   ========================================================================== */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

#skeleton-loading {
  padding: var(--space-2) 0;
}

.skeleton-card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin: var(--space-3) var(--space-4);
  box-shadow: var(--shadow-sm);
}

.skeleton-line {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    var(--color-divider) 25%,
    var(--color-border) 50%,
    var(--color-divider) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  margin-bottom: var(--space-2);
}

.skeleton-line-title {
  width: 60%;
  height: 18px;
}

.skeleton-line-meta {
  width: 40%;
}

.skeleton-line-short {
  width: 80%;
  margin-bottom: 0;
}

/* ==========================================================================
   Empty State (Enhanced)
   ========================================================================== */
.empty-icon-svg {
  color: var(--color-accent);
  opacity: 0.8;
  margin-bottom: var(--space-4);
  animation: emptyPulse 2s ease-in-out infinite;
}

@keyframes emptyPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.05); }
}

.empty-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.empty-desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-6);
  max-width: 260px;
  line-height: 1.5;
}

/* ==========================================================================
   Card Hover Micro-interaction
   ========================================================================== */
.reminder-card {
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.reminder-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   Reduced Motion 鈥?Skeleton & Empty State
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .skeleton-line {
    animation: none;
    background: var(--color-divider);
  }
  .empty-icon-svg {
    animation: none;
  }
  .reminder-card {
    transition: none;
  }
  .reminder-card:hover {
    transform: none;
  }
}

/* ==========================================================================
   Detail Page 鈥?Optimized
   ========================================================================== */

/* Warm accent & muted badges */
.badge-accent {
  background: var(--color-accent-light);
  color: var(--color-accent-hover);
}
.badge-muted {
  background: var(--color-divider);
  color: var(--color-text-secondary);
}

/* Detail action buttons 鈥?hierarchy via flex ratio */
.action-bar .btn-primary {
  flex: 2;
}
.action-bar .btn-outline,
.action-bar .btn-success {
  flex: 1;
}
.action-bar .btn-ghost {
  flex: 0 1 auto;
}
.action-bar .btn-danger {
  flex: 0 1 auto;
}

/* Loading state on action buttons */
.btn.htmx-request {
  pointer-events: none;
  position: relative;
}
.btn.htmx-request::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin .6s linear infinite;
  margin-left: 8px;
  display: inline-block;
  vertical-align: middle;
}

/* For outline/ghost buttons, use accent spinner color */
.btn-outline.htmx-request::after,
.btn-ghost.htmx-request::after {
  border-color: rgba(255,107,74,.25);
  border-top-color: var(--color-accent);
}

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

/* Purchase records */
.purchase-record-item {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-divider);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.purchase-record-item:last-child {
  border-bottom: none;
}
.purchase-record-time {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}
.purchase-record-price {
  font-weight: 600;
  color: var(--color-accent);
}

/* Detail info rows 鈥?enhanced */
.detail-info-row {
  gap: var(--space-4);
}
@media (hover: hover) {
  .detail-info-row:hover {
    background: var(--color-divider);
  }
}

/* htmx indicator dot animation */
.htmx-indicator {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,.6);
  margin-left: 4px;
  vertical-align: middle;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
}
.btn.htmx-request .htmx-indicator {
  opacity: 1;
  animation: indicator-blink .8s ease-in-out infinite;
}
@keyframes indicator-blink {
  0%, 100% { opacity: 0.3; }
  50%      { opacity: 1; }
}

/* ==========================================================================
   Log Skeleton
   ========================================================================== */
#logs-skeleton .skeleton-log {
  padding: 12px var(--space-4);
  margin: 0 var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}

#logs-skeleton .skeleton-log .sk-line {
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(
    90deg,
    #F0EDEA 25%,
    #E8E5E2 50%,
    #F0EDEA 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  margin-bottom: 6px;
}

#logs-skeleton .skeleton-log .sk-line:last-child {
  margin-bottom: 0;
  width: 50%;
}

/* ==========================================================================
   Log Item Visual Distinction
   ========================================================================== */
.log-item {
  transition: background var(--duration-fast) var(--ease-out);
}

@media (hover: hover) {
  .log-item:hover {
    background: var(--color-divider);
  }
}

.log-status-success {
  color: var(--color-success);
}

.log-status-fail {
  color: var(--color-danger);
}

.notification-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.notification-dot.success {
  background: var(--color-success);
}

.notification-dot.error {
  background: var(--color-danger);
}

/* ==========================================================================
   Reduced Motion 鈥?Log Skeleton
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  #logs-skeleton .skeleton-log .sk-line {
    animation: none;
    background: var(--color-divider);
  }
}

/* ==========================================================================
   Settings Page Optimization 鈥?Task 5
   ========================================================================== */

/* Settings status card */
.settings-status { display:inline-flex; align-items:center; gap:8px; }
.status-indicator { width:10px; height:10px; border-radius:50%; flex-shrink:0; }
.status-indicator.configured { background:var(--color-success); }
.status-indicator.not-configured { background:var(--color-text-tertiary); }
.status-indicator.connected { background:var(--color-accent); }
.status-indicator.disconnected { background:var(--color-warning); }

/* Settings rows hover */
@media (hover:hover) { .settings-row:hover { background:var(--color-divider); } }
.settings-row { padding:12px 0; border-bottom:1px solid var(--color-divider); transition:background var(--duration-fast) var(--ease-out); }

/* Settings group card */
.settings-group { margin-bottom:var(--space-6); }

/* ==========================================================================
   Toggle Switch (纯 CSS，触控目标 ≥44px)
   ========================================================================== */
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.toggle-slider {
  position: relative;
  width: 44px;
  height: 26px;
  background: var(--color-text-tertiary);
  border-radius: var(--radius-pill);
  transition: background var(--duration-fast) var(--ease-out);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: var(--color-surface);
  border-radius: 50%;
  transition: transform var(--duration-fast) var(--ease-out);
  box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-slider {
  background: var(--color-accent);
}

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

.toggle.disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ==========================================================================
   Channel Table — 通知渠道三列表格
   ========================================================================== */
.channel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-base);
}

.channel-table thead th {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}

.channel-table tbody tr {
  border-bottom: 1px solid var(--color-divider);
  transition: background var(--duration-fast) var(--ease-out);
}

.channel-table tbody tr:last-child {
  border-bottom: none;
}

@media (hover: hover) {
  .channel-table tbody tr:hover {
    background: var(--color-accent-light);
  }
}

.channel-table td {
  padding: var(--space-3);
  vertical-align: middle;
  line-height: 1.4;
}

.channel-table .col-name {
  font-weight: 600;
  color: var(--color-text);
  min-width: 80px;
  white-space: nowrap;
}

.channel-table .col-config {
  min-width: 140px;
}

.channel-table .col-toggle {
  text-align: center;
  width: 64px;
  min-width: 64px;
}

/* Config status link */
.channel-config-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: background var(--duration-fast) var(--ease-out);
}

.channel-config-status.configured {
  color: var(--color-success);
  background: color-mix(in srgb, var(--color-success) 10%, transparent);
}

.channel-config-status.unconfigured {
  color: var(--color-text-secondary);
  background: var(--color-input-bg);
}

@media (hover: hover) {
  .channel-config-status.configured:hover {
    background: color-mix(in srgb, var(--color-success) 20%, transparent);
  }
  .channel-config-status.unconfigured:hover {
    background: var(--color-border);
  }
}

.channel-config-status::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.channel-config-status.configured::before {
  background: var(--color-success);
}

.channel-config-status.unconfigured::before {
  background: var(--color-text-tertiary);
}

/* Device key in config column */
.col-config .device-key-masked {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

/* Mobile */
@media (max-width: 480px) {
  .channel-table .col-name {
    min-width: 60px;
    font-size: var(--text-sm);
  }
  .channel-table .col-config {
    min-width: 100px;
  }
  .channel-table td {
    padding: var(--space-2) var(--space-2);
  }
  .channel-config-status {
    font-size: var(--text-xs);
  }
}

/* ==========================================================================
   Toast 鈥?Floating Overlay (override inline toast)
   ========================================================================== */
.toast {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text);
  text-align: left;
  font-weight: 400;
  margin: 0;
  max-width: calc(100vw - 32px);
}

.toast.show {
  opacity: 1;
  pointer-events: auto;
  animation: toastSlideDown 0.3s var(--ease-out) forwards;
}

@keyframes toastSlideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.toast-error {
  border-left: 4px solid var(--color-danger);
}
.toast-info {
  border-left: 4px solid var(--color-accent);
}
.toast-success {
  border-left: 4px solid var(--color-success);
}

.toast-body {
  flex: 1;
}

/* ==========================================================================
   Conditional Field 鈥?max-height Transition
   ========================================================================== */
.conditional-field {
  display: block;
  max-height: 0;
  overflow: hidden;
  padding: 0;
  margin-top: 0;
  transition: max-height 0.3s var(--ease-out), padding 0.3s, margin 0.3s, opacity 0.2s;
  opacity: 0;
}

.conditional-field.active {
  max-height: 200px;
  opacity: 1;
  padding: var(--space-3);
  margin-top: var(--space-2);
}

/* ==========================================================================
   Field Error 鈥?Visual Feedback
   ========================================================================== */
.form-group.has-error .form-input,
.form-group.has-error .form-select,
.form-group.has-error .form-textarea {
  border-color: var(--color-danger);
}
.form-group.has-error .form-label {
  color: var(--color-danger);
}
.form-error-msg {
  font-size: var(--text-xs);
  color: var(--color-danger);
  margin-top: 4px;
  display: none;
}
.form-group.has-error .form-error-msg {
  display: block;
}

/* ==========================================================================
   Reduced Motion 鈥?Toast & Conditional Field
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: none;
  }
  .toast.show {
    animation: none;
  }
  .conditional-field {
    transition: none;
  }
}

/* ==========================================================================
   Login Page
   ========================================================================== */
.login-wrapper {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.login-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-6);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.login-logo {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: var(--space-2);
}

.login-welcome {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-6);
}

.login-form {
  text-align: left;
}

.login-form .btn {
  margin-top: var(--space-3);
}

.token-hint {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: var(--space-2);
  text-align: center;
}

#login-error.toast {
  position: static;
  transform: none;
  margin: var(--space-3) 0 0;
}

/* Login input focus/hover */
.login-form .form-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-light);
  outline: none;
}

@media (hover: hover) {
  .login-form .form-input:hover {
    border-color: var(--color-accent);
  }
}

/* ==========================================================================
   Admin Page
   ========================================================================== */
.admin-page { max-width:640px; margin:0 auto; padding:var(--space-4); }
.admin-page h2 { font-size:var(--text-lg); margin:var(--space-6) 0 var(--space-3); }
.admin-create-row { display:flex; gap:var(--space-2); }
.admin-create-row input { flex:1; }
.user-list { margin-top:var(--space-2); }
.user-item { display:flex; align-items:center; gap:var(--space-2); padding:10px 0; border-bottom:1px solid var(--color-border); }
.user-item:last-child { border-bottom:none; }
.user-name { font-weight:600; min-width:80px; font-size:var(--text-base); }
.user-token { font-family:var(--font-mono); font-size:var(--text-xs); color:var(--color-text-secondary); flex:1; word-break:break-all; }
.user-time { font-size:var(--text-xs); color:var(--color-text-tertiary); min-width:100px; white-space:nowrap; }
.empty { text-align:center; color:var(--color-text-tertiary); padding:var(--space-8) 0; }

/* Admin list header */
.admin-list-header { display:flex; gap:var(--space-2); padding:var(--space-2) 0; font-size:var(--text-xs); color:var(--color-text-secondary); border-bottom:2px solid var(--color-border); font-weight:600; }
.admin-col-name { min-width:80px; }
.admin-col-token { flex:1; }
.admin-col-time { min-width:100px; }
.admin-col-actions { min-width:50px; }

/* ==========================================================================
   Responsive 鈥?PC (min-width: 768px)
   ========================================================================== */
@media (min-width: 768px) {
  body {
    max-width: 768px;
  }

  /* Home: 2-column card grid */
  #reminders-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
    padding: 0 var(--space-4);
  }
  #reminders-list .card {
    margin: 0;
  }
  #reminders-list .loading-center {
    grid-column: 1 / -1;
  }
  #reminders-list .empty-state {
    grid-column: 1 / -1;
  }
  #skeleton-loading {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
    padding: 0 var(--space-4);
  }
  #skeleton-loading .skeleton-card {
    margin: 0;
  }

  /* Admin */
  .admin-page {
    max-width: 800px;
  }

  /* Topbar wider */
  .topbar {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }

  /* Empty state centered */
  .empty-state {
    max-width: 400px;
    margin: var(--space-8) auto;
  }
}

/* ==================================================================
   Smart Add Reminder — Two-Step Wizard (T5)
   ================================================================== */

/* Paste container */
.paste-container {
  max-width: 400px;
  margin: var(--space-10) auto 0;
  padding: 0 var(--space-4);
  text-align: center;
  transition: opacity var(--duration-base) var(--ease-out),
              transform var(--duration-base) var(--ease-out);
}

.paste-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-4);
  line-height: 1;
}

.paste-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.paste-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-6);
}

.paste-input {
  display: block;
  width: 100%;
  padding: var(--space-4);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  resize: vertical;
  min-height: 140px;
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

.paste-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(255, 107, 74, 0.15);
}

.paste-input::placeholder {
  color: var(--color-text-tertiary);
  font-size: var(--text-sm);
  line-height: 1.9;
}

.paste-hint {
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  transition: opacity 0.2s var(--ease-out);
}

.paste-success {
  background: #E8F8EE;
  color: #1A7F3E;
}

.paste-warn {
  background: #FFF3E0;
  color: #CC7A00;
}

/* Step transitions */
.step-exit {
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
}

.step-enter {
  animation: stepSlideIn var(--duration-base) var(--ease-out);
}

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

/* Recognized field highlight */
.form-input.recognized,
.form-select.recognized {
  border-color: var(--color-success);
  background: #F4FDF6;
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.1);
}

/* Cover preview */
.cover-preview {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

/* Manual entry button (outline style matching design system) */
#manual-btn {
  margin-top: var(--space-4);
}

.btn-outline {
  display: inline-block;
  padding: var(--space-2) var(--space-5);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-accent);
  background: transparent;
  border: 2px solid var(--color-accent);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}

.btn-outline:hover {
  background: var(--color-accent);
  color: #fff;
}

/* Mobile responsive */
@media (max-width: 480px) {
  .paste-container {
    max-width: 100%;
    margin-top: var(--space-6);
    padding: 0 var(--space-3);
  }

  .paste-input {
    min-height: 120px;
    font-size: var(--text-sm);
  }

  .cover-preview {
    width: 90px;
    height: 90px;
  }
}

/* ==================================================================
   Detail page — 口令展示区 (detail.html)
   ================================================================== */
.kouling-display {
  width: 100%;
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-2);
  resize: none;
  outline: none;
  cursor: text;
  line-height: 1.6;
  box-sizing: border-box;
}

/* Shake animation (login token, 口令 validation) */
.shake { animation: shake .4s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 50%{transform:translateX(6px)} 75%{transform:translateX(-4px)} }
.input-error { border-color: #ff3b30 !important; background: #fff5f5 !important; }

/* 口令编辑态 */
.kouling-editing {
  background: #fff !important;
  color: var(--color-text) !important;
  border-color: var(--color-accent) !important;
  box-shadow: 0 0 0 2px rgba(255, 107, 74, 0.15);
}

/* ==================================================================
   Detail Page Layout — Redesigned (T6)
   ================================================================== */

/* Product info block — single fluid surface, no nested cards */
.detail-product {
  padding: var(--space-5) var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  margin: 0 var(--space-4) var(--space-4);
}
.detail-name {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-3);
  line-height: 1.4;
}
.detail-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}
.meta-badge {
  display: inline-flex;
  padding: 3px 10px;
  background: var(--color-accent-light);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  color: var(--color-accent);
  font-weight: 600;
}
.meta-badge-subtle {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
}
.detail-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-accent);
  font-size: var(--text-sm);
  font-weight: 500;
  text-decoration: none;
  margin-bottom: var(--space-3);
}
.detail-link:active { opacity: 0.6; }
@media (hover: hover) { .detail-link:hover { text-decoration: underline; text-underline-offset: 3px; } }
.detail-link-disabled {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-3);
}
.detail-notes {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  margin-top: var(--space-2);
}
.kouling-block {
  margin-bottom: var(--space-3);
}
.kouling-block .kouling-display {
  width: 100%;
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  resize: none;
  line-height: 1.6;
  box-sizing: border-box;
}
.btn-copy {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 12px;
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-sans);
  min-height: 32px;
}
.btn-copy:hover { background: var(--color-border); }
.btn-copy:active { transform: scale(0.97); }

/* Schedule block — same surface treatment, key-value rows */
.detail-schedule {
  padding: var(--space-5) var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  margin: 0 var(--space-4) var(--space-4);
}
.schedule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-divider);
  min-height: 44px;
}
.schedule-row:last-child { border-bottom: none; }
.schedule-label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  flex-shrink: 0;
}
.schedule-value {
  font-size: var(--text-sm);
  color: var(--color-text);
  font-weight: 500;
  text-align: right;
}
.schedule-emphasis {
  color: var(--color-accent);
  font-weight: 700;
  font-size: var(--text-base);
}
.schedule-next {
  padding: var(--space-3) 0;
}
.schedule-meta {
  padding-top: var(--space-3);
}
.schedule-meta .schedule-label,
.schedule-meta .schedule-value {
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
  font-weight: 400;
}

/* Action stack — vertical primary + horizontal secondary row */
.action-stack {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin: 0 var(--space-4);
}
.action-stack .btn-primary {
  width: 100%;
  padding: 14px;
  font-size: var(--text-base);
  font-weight: 600;
}
.action-row {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  flex-wrap: wrap;
}
.action-row .btn {
  min-height: 44px;
  min-width: 44px;
  padding: 8px 16px;
  font-size: var(--text-sm);
}

/* ==================================================================
   Edit Page Form Layout — Redesigned (T6)
   ================================================================== */
.form-section {
  padding: var(--space-4);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  margin: 0 var(--space-4) var(--space-4);
}
.form-heading {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-divider);
}
.form-field {
  margin-bottom: var(--space-4);
}
.form-field:last-child {
  margin-bottom: 0;
}
.form-row {
  display: flex;
  gap: var(--space-3);
}
.form-row .form-field {
  margin-bottom: 0;
}

/* field-level error states (matching .form-group.has-error) */
.form-field.has-error .form-input,
.form-field.has-error .form-select,
.form-field.has-error .form-textarea {
  border-color: var(--color-danger);
}
.form-field.has-error .form-label {
  color: var(--color-danger);
}

/* Recognized field highlight */
.form-input.recognized,
.form-select.recognized {
  border-color: var(--color-success);
  background: #f4fdf6;
}

/* Submit button spacing */
.form-section + .btn-block {
  margin: 0 var(--space-4) var(--space-8);
}

/* Time input — full area opens picker, hide clock icon */
input[type="time"].form-input {
  min-height: 44px;
  font-size: var(--text-base);
  position: relative;
  cursor: pointer;
}
input[type="time"].form-input::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* Kouling update button */
#kouling-update-btn {
  border: 1.5px solid var(--color-accent);
  color: var(--color-accent);
  background: transparent;
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: all var(--duration-fast) var(--ease-out);
}
#kouling-update-btn:hover {
  background: var(--color-accent);
  color: #fff;
}

