/* ══════════════════════════════════════════════════════════════
   ASM Generator — Stylesheet
   Modern dark-theme with glassmorphism, smooth animations
   ══════════════════════════════════════════════════════════════ */

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

/* ── CSS Custom Properties ── */
:root {
  --bg-primary: #0b0e17;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --bg-glass: rgba(30, 41, 59, 0.5);
  --bg-input: rgba(15, 23, 42, 0.8);
  --bg-hover: rgba(56, 189, 248, 0.08);

  --border-primary: rgba(56, 189, 248, 0.15);
  --border-focus: rgba(56, 189, 248, 0.5);
  --border-error: rgba(239, 68, 68, 0.6);
  --border-success: rgba(34, 197, 94, 0.6);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #38bdf8;
  --text-error: #f87171;
  --text-success: #4ade80;

  --accent-primary: #0ea5e9;
  --accent-secondary: #6366f1;
  --accent-gradient: linear-gradient(135deg, #0ea5e9, #6366f1);
  --accent-gradient-hover: linear-gradient(135deg, #38bdf8, #818cf8);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(14, 165, 233, 0.15);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;
}

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

html {
  scroll-behavior: smooth;
  font-size: 15px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Animated background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(14, 165, 233, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(99, 102, 241, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(14, 165, 233, 0.03) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── Layout ── */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

/* ── Auth Screen ── */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1000;
  background: var(--bg-body);
}

.auth-card {
  background: rgba(11, 14, 23, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 40px rgba(14, 165, 233, 0.1);
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-logo {
  height: 54px;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.2));
}

.auth-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.auth-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.auth-box {
  display: flex;
  flex-direction: column;
}

.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-primary);
}

.auth-divider span {
  padding: 0 1rem;
}

.auth-social-btns {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  background: rgba(255, 255, 255, 0.03) !important;
  color: var(--text-primary) !important;
  font-weight: 500;
  position: relative;
  overflow: hidden;
}

.social-btn:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}

/* ── Button Loading Spinner ── */
.btn.is-loading {
  color: transparent !important;
  pointer-events: none;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ── Mock Google Modal ── */
.mock-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.2s ease-out;
}

.mock-modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.google-modal-header {
  padding: 2rem 2rem 1rem;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.google-modal-header h3 {
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.google-modal-header p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.google-account-list {
  padding: 0.5rem 0;
}

.google-account-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 2rem;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.google-account-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.google-account-item .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #10b981;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.google-account-item .acc-info {
  display: flex;
  flex-direction: column;
}

.acc-info strong {
  font-size: 0.95rem;
  font-weight: 500;
}

.acc-info span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.google-modal-footer {
  padding: 1rem 2rem;
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.google-input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  transition: border-color 0.2s;
}

.google-input:focus {
  outline: none;
  border-color: #4285F4;
  box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}

.google-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: 999px;
  padding: 0.35rem 0.9rem 0.35rem 0.6rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}


@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ══════════════ Activity Log ══════════════ */
.history-commit-box {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.commit-input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.commit-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
  text-transform: uppercase;
}

.commit-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: var(--font-sans);
  transition: border-color 0.2s;
}

.commit-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.15);
}

.commit-select {
  background: var(--bg-input);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  color: var(--text-primary);
  font-size: 0.8rem;
  font-family: var(--font-sans);
  cursor: pointer;
  min-width: 110px;
}

.commit-select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Filter Chips */
.history-filters {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-primary);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-chip:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.filter-chip.active {
  background: rgba(14, 165, 233, 0.15);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.chip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.history-count {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Timeline */
.history-timeline {
  position: relative;
  padding-left: 2rem;
}

.history-timeline::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--border-primary), transparent);
  border-radius: 1px;
}

/* Date Group */
.timeline-date-group {
  margin-bottom: 0.5rem;
}

.timeline-date-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  padding: 0.35rem 0.75rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  display: inline-block;
  position: relative;
  left: -0.5rem;
}

/* Commit Entry */
.timeline-entry {
  position: relative;
  padding-bottom: 1.25rem;
  animation: fadeIn 0.3s ease-out;
}

.timeline-dot {
  position: absolute;
  left: -2rem;
  top: 0.45rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg-body);
  z-index: 1;
}

.timeline-dot.dot-ssm {
  background: #0ea5e9;
}

.timeline-dot.dot-asm {
  background: #a855f7;
}

.timeline-dot.dot-ssim {
  background: #f59e0b;
}

.timeline-dot.dot-other {
  background: #6b7280;
}

.timeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.timeline-card:hover {
  border-color: rgba(56, 189, 248, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.timeline-card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.35rem;
}

.timeline-card-header .tc-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9, #6366f1);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.65rem;
  flex-shrink: 0;
  text-transform: uppercase;
}

.timeline-card-header .tc-user {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--text-primary);
}

.timeline-card-header .tc-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: auto;
}

.timeline-card .tc-message {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  padding-left: 2.1rem;
}

.module-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.module-badge.badge-ssm {
  background: rgba(14, 165, 233, 0.15);
  color: #0ea5e9;
}

.module-badge.badge-asm {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}

.module-badge.badge-ssim {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.module-badge.badge-other {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
}

/* Empty State */
.history-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.history-empty h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.history-empty p {
  font-size: 0.85rem;
  max-width: 380px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Sidebar (Left) ── */
.sidebar {
  width: 260px;
  background: rgba(11, 14, 23, 0.95);
  border-right: 1px solid rgba(56, 189, 248, 0.1);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  backdrop-filter: blur(12px);
  z-index: 10;
}

.sidebar-header {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(56, 189, 248, 0.1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: var(--accent-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.brand-icon svg {
  width: 18px;
  height: 18px;
}

.brand-text h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.brand-text p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.2;
}

.sidebar-nav {
  padding: 1.5rem 0.75rem;
  flex: 1;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  padding: 0 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 0.25rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  opacity: 0.7;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: rgba(14, 165, 233, 0.15);
  color: var(--text-accent);
  font-weight: 600;
}

.nav-item.active svg {
  opacity: 1;
}

.sidebar-footer {
  padding: 1.25rem;
  border-top: 1px solid rgba(56, 189, 248, 0.1);
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.sidebar-footer .sub {
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ── Main Content (Right) ── */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
  background: var(--bg-secondary);
}

.module-view {
  display: none;
  flex-direction: column;
  min-height: 100%;
  animation: fadeIn 0.3s ease;
}

.module-view.active {
  display: flex;
}

.page-header {
  padding: 2rem 3rem 1.5rem;
  background: rgba(17, 24, 39, 0.8);
  border-bottom: 1px solid rgba(56, 189, 248, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-titles h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  letter-spacing: -0.01em;
}

.header-titles .subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  gap: 0.75rem;
}

/* ── Sub-Tab Navigation ── */
.sub-tab-nav {
  display: flex;
  gap: 2rem;
  padding: 0 3rem;
  border-bottom: 1px solid rgba(56, 189, 248, 0.1);
  background: rgba(17, 24, 39, 0.6);
}

.sub-tab-btn {
  padding: 1rem 0;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: -1px;
}

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

.sub-tab-btn.active {
  color: var(--text-accent);
  border-bottom-color: var(--accent-primary);
  font-weight: 600;
}

.module-body {
  padding: 2rem 3rem 4rem;
  flex: 1;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

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

/* ── Card / Glass Panel ── */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  padding: 1.8rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
  transition: border-color var(--transition-normal);
}

.card:hover {
  border-color: rgba(56, 189, 248, 0.25);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title svg {
  width: 18px;
  height: 18px;
  color: var(--accent-primary);
}

/* ── Form Styles ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group label .required {
  color: var(--text-error);
  margin-left: 2px;
}

input,
select,
textarea {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: rgba(11, 14, 23, 0.5);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  transition: all var(--transition-fast);
  outline: none;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

input.error,
select.error {
  border-color: var(--border-error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

input::placeholder {
  color: var(--text-muted);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  padding-right: 2rem;
}

textarea {
  resize: vertical;
  min-height: 60px;
  font-size: 0.85rem;
}

/* ── Days of Operation Toggle Buttons ── */
.days-toggle-group {
  display: flex;
  gap: 0.35rem;
}

.day-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.day-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 44px;
  padding: 0.4rem 0;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.day-btn span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  font-weight: 700;
  background: rgba(14, 165, 233, 0.15);
  color: var(--accent-primary);
  border-radius: var(--radius-sm);
  margin-bottom: 0.25rem;
  transition: all var(--transition-fast);
}

.day-btn small {
  font-size: 0.7rem;
  font-weight: 500;
}

.day-btn:hover span {
  background: rgba(14, 165, 233, 0.25);
}

.day-toggle:checked+.day-btn span {
  background: var(--accent-primary);
  color: white;
  box-shadow: var(--shadow-glow);
}

.day-toggle:checked+.day-btn small {
  color: var(--text-primary);
}

/* ── Routing Legs ── */
.legs-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.leg-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
  animation: slideIn 0.2s ease;
  background: rgba(15, 23, 42, 0.4);
  padding: 0.8rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(56, 189, 248, 0.08);
}

.leg-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-primary);
  background: rgba(14, 165, 233, 0.1);
  border-radius: 50%;
  margin-bottom: 0.35rem;
  flex-shrink: 0;
}

.leg-row .form-group {
  min-width: 0;
}

.leg-row .form-group.leg-grid {
  flex: 1 1 100px;
  min-width: 80px;
}

.leg-row .form-group label {
  font-size: 0.65rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leg-controls {
  display: flex;
  align-items: flex-end;
  flex-shrink: 0;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.65rem 1.3rem;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
  white-space: nowrap;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  color: #fff;
  background: var(--accent-gradient);
  box-shadow: var(--shadow-sm), var(--shadow-glow);
}

.btn-primary:hover {
  background: var(--accent-gradient-hover);
  box-shadow: var(--shadow-md), 0 0 30px rgba(14, 165, 233, 0.25);
  transform: translateY(-1px);
}

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

.btn-secondary {
  color: var(--text-primary);
  background: var(--bg-glass);
  border: 1px solid var(--border-primary);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-focus);
}

.btn-danger {
  color: var(--text-error);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.78rem;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ── File Upload Zone ── */
.upload-zone {
  border: 2px dashed var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  background: var(--bg-input);
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--accent-primary);
  background: rgba(14, 165, 233, 0.05);
  box-shadow: var(--shadow-glow);
}

.upload-zone svg {
  width: 40px;
  height: 40px;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.upload-zone p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.upload-zone .hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.upload-zone input[type="file"] {
  display: none;
}

/* ── Drop Zone (SSM & ASM CSV) ── */
.drop-zone {
  border: 2px dashed var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  background: var(--bg-input);
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--accent-primary);
  background: rgba(14, 165, 233, 0.05);
  box-shadow: var(--shadow-glow);
}

.drop-zone svg {
  width: 36px;
  height: 36px;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.drop-zone p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.drop-zone .hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.drop-zone input[type="file"] {
  display: none;
}

/* ── Preview Table ── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-primary);
  margin-top: 1rem;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.preview-table th {
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 0.7rem;
  padding: 0.6rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--border-primary);
  white-space: nowrap;
}

.preview-table td {
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid rgba(56, 189, 248, 0.06);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  white-space: nowrap;
}

.preview-table tr:hover td {
  background: var(--bg-hover);
}

.preview-table tr.row-error td {
  background: rgba(239, 68, 68, 0.06);
}

.preview-table .status-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 600;
  font-family: var(--font-sans);
  text-transform: uppercase;
}

.status-badge.valid {
  color: var(--text-success);
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.status-badge.invalid {
  color: var(--text-error);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ── Output Section ── */
.output-section {
  animation: fadeIn 0.4s ease;
}

.output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.output-header .info {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.output-header .info span {
  color: var(--accent-primary);
  font-weight: 600;
}

.asm-output {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.7;
  color: #e2e8f0;
  background: #0a0f1a;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.5rem;
  white-space: pre;
  overflow-x: auto;
  min-height: 100px;
  max-height: 500px;
  overflow-y: auto;
}

/* ── Alerts / Messages ── */
.alert {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.83rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  animation: slideIn 0.3s ease;
}

.alert svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-error {
  color: var(--text-error);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
  color: var(--text-success);
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.alert-info {
  color: var(--text-accent);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.15);
}

.error-list {
  list-style: none;
  padding: 0;
}

.error-list li {
  padding: 0.2rem 0;
  font-size: 0.8rem;
}

.error-list li::before {
  content: '• ';
  color: var(--text-error);
  font-weight: bold;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 0.7rem 1.2rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-success);
  border-radius: var(--radius-md);
  color: var(--text-success);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2s forwards;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Stats Bar ── */
.stats-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.stat-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-primary);
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.stat-chip .value {
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Separator ── */
.separator {
  height: 1px;
  background: var(--border-primary);
  margin: 1.5rem 0;
}

/* ── Animations ── */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(20px);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .app-container {
    flex-direction: column;
    height: 100vh;
    overflow: auto;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid rgba(56, 189, 248, 0.1);
    flex-shrink: 0;
  }

  .sidebar-nav {
    display: flex;
    overflow-x: auto;
    padding: 1rem;
    gap: 0.5rem;
  }

  .nav-section-title {
    display: none;
  }

  .nav-item {
    margin: 0;
    white-space: nowrap;
    width: auto;
  }

  .main-content {
    overflow: visible;
  }

  .page-header {
    padding: 1.5rem;
  }

  .sub-tab-nav {
    padding: 0 1.5rem;
  }

  .module-body {
    padding: 1.5rem;
  }
}

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

  .form-grid {
    grid-template-columns: 1fr;
  }

  .leg-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
  }

  .leg-badge {
    grid-column: 1 / -1;
  }

  .btn-row {
    flex-direction: column;
  }

  .days-toggle-group {
    flex-wrap: wrap;
  }

  .output-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .card {
    padding: 1.2rem;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions .btn {
    flex: 1;
  }
}