/* ============================================================
   Illypad Component Library — illypad.css
   ------------------------------------------------------------
   All components use .il-* namespace.
   All values read from CSS variables defined in _tokens.css.
   To restyle the app, edit _tokens.css, never this file.
   ============================================================ */

/* ----------------------------------------------------------
   RESET + BASE
---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: var(--font-body);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }


/* ============================================================
   LAYOUT — app shell (sidebar + main)
============================================================ */
.il-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.il-sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width var(--duration-slow) var(--ease);
  overflow: hidden;
}
.il-sidebar.collapsed {
  width: var(--sidebar-w-collapsed);
}
.il-sidebar.collapsed .il-nav-item span,
.il-sidebar.collapsed .il-sidebar-section-label,
.il-sidebar.collapsed .il-sidebar-badge-name,
.il-sidebar.collapsed .il-sidebar-badge-sub,
.il-sidebar.collapsed .il-sidebar-logo span,
.il-sidebar.collapsed .il-nav-count {
  display: none;
}
.il-sidebar.collapsed .il-sidebar-header,
.il-sidebar.collapsed .il-sidebar-badge {
  justify-content: center;
}

.il-sidebar-header {
  padding: var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.il-sidebar-logo {
  font-family: var(--font-head);
  font-size: var(--text-md);
  font-weight: var(--weight-extrabold);
  color: var(--sidebar-text-active);
  letter-spacing: var(--tracking-tight);
}
.il-sidebar-logo span { color: var(--accent-subtle); }

.il-sidebar-badge {
  margin: var(--sp-4);
  padding: var(--sp-3);
  background: var(--sidebar-badge-bg);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
  transition: background var(--duration) var(--ease);
}
.il-sidebar-badge:hover {
  background: rgba(255, 255, 255, 0.06);
}
.il-sidebar-badge-dot {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text-inverse);
}
.il-sidebar-badge-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--sidebar-text-active);
}
.il-sidebar-badge-sub {
  font-size: var(--text-xs);
  color: var(--sidebar-text);
}

.il-sidebar-nav {
  padding: var(--sp-3) var(--sp-2);
  flex: 1;
  overflow-y: auto;
}
.il-sidebar-section-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--sidebar-text);
  padding: var(--sp-4) var(--sp-3) var(--sp-2);
}

.il-nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  color: var(--sidebar-text);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  position: relative;
  margin-bottom: 1px;
  border: 1.5px solid transparent;
  text-decoration: none;
}
.il-nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--sidebar-icon);
  transition: color var(--duration) var(--ease);
}
.il-nav-item:hover {
  color: var(--sidebar-text-hover);
  background: rgba(255, 255, 255, 0.04);
}
.il-nav-item:hover svg { color: var(--sidebar-text-hover); }
.il-nav-item.active {
  color: var(--sidebar-text-active);
  background: var(--sidebar-active-bg);
  border-color: rgba(99, 102, 241, 0.2);
}
.il-nav-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background: var(--sidebar-active-border);
  border-radius: 0 2px 2px 0;
}
.il-nav-item.active svg { color: var(--sidebar-icon-active); }
.il-nav-count {
  margin-left: auto;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent-subtle);
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

.il-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.il-topbar {
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--topbar-border);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 0 var(--sp-8);
  flex-shrink: 0;
}
.il-content {
  flex: 1;
  padding: var(--sp-8);
  overflow-y: auto;
}
.il-page-header {
  margin-bottom: var(--sp-6);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
}
.il-page-title {
  font-family: var(--font-head);
  font-size: var(--text-2xl);
  font-weight: var(--weight-extrabold);
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
}
.il-page-sub {
  font-size: var(--text-base);
  color: var(--text-muted);
  margin-top: var(--sp-1);
}


/* ============================================================
   BUTTONS
============================================================ */
.il-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: var(--weight-medium);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
  outline: none;
  user-select: none;
}
.il-btn:focus-visible { box-shadow: 0 0 0 3px var(--accent-subtle); }
.il-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.il-btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
  box-shadow: var(--shadow-accent);
}
.il-btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}
.il-btn-primary:active { transform: translateY(0); }

.il-btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}
.il-btn-secondary:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

.il-btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.il-btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.il-btn-danger {
  background: var(--red-light);
  color: var(--red-text);
  border-color: transparent;
}
.il-btn-danger:hover {
  background: var(--red);
  color: var(--text-inverse);
}

.il-btn-sm {
  font-size: 0.8125rem;
  padding: 0.375rem 0.75rem;
}
.il-btn-sm svg { width: 13px; height: 13px; }

.il-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.il-btn-loading {
  position: relative;
  pointer-events: none;
  color: transparent !important;
}
.il-btn-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: var(--text-inverse);
  border-radius: 50%;
  animation: il-spin 0.7s linear infinite;
}
@keyframes il-spin { to { transform: rotate(360deg); } }


/* ============================================================
   FORM CONTROLS
============================================================ */
.il-input-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.il-label {
  font-size: 0.8125rem;
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  letter-spacing: var(--tracking-normal);
}
.il-input {
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--text-base);
  padding: 0.5625rem 0.875rem;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color var(--duration) var(--ease),
              box-shadow var(--duration) var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
.il-input::placeholder { color: var(--text-muted); }
.il-input:hover { border-color: var(--border-strong); }
.il-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.il-input:disabled {
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: not-allowed;
}
.il-input.error { border-color: var(--red); }
.il-input.error:focus { box-shadow: 0 0 0 3px var(--red-light); }

.il-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.il-hint.error { color: var(--red-text); }

.il-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: var(--leading-relaxed);
}
.il-select {
  cursor: pointer;
  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'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
  padding-right: var(--sp-10);
}
.il-char-count {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: right;
}
.il-char-count.warning { color: var(--yellow); }
.il-char-count.over { color: var(--red); font-weight: var(--weight-semibold); }


/* ============================================================
   BADGES
============================================================ */
.il-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  white-space: nowrap;
}
.il-badge svg { width: 10px; height: 10px; }
.il-badge-default { background: var(--bg-elevated); color: var(--text-secondary); }
.il-badge-accent  { background: var(--accent-light); color: var(--accent-text); }
.il-badge-green   { background: var(--green-light); color: var(--green-text); }
.il-badge-red     { background: var(--red-light); color: var(--red-text); }
.il-badge-yellow  { background: var(--yellow-light); color: var(--yellow-text); }
.il-badge-blue    { background: var(--blue-light); color: var(--blue-text); }
.il-badge-purple  { background: var(--purple-light); color: var(--purple-text); }
.il-badge-outline {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
}


/* ============================================================
   CARDS
============================================================ */
.il-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration) var(--ease),
              transform var(--duration) var(--ease);
}
.il-card-hover:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.il-card-title {
  font-family: var(--font-head);
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--sp-1);
}
.il-card-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.il-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-sm);
}
.il-stat-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  margin-bottom: var(--sp-3);
}
.il-stat-value {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: var(--weight-extrabold);
  color: var(--text-primary);
  letter-spacing: -0.04em;
  line-height: 1;
}
.il-stat-delta {
  font-size: 0.8125rem;
  font-weight: var(--weight-medium);
  margin-top: var(--sp-2);
  display: flex;
  align-items: center;
  gap: 3px;
}
.il-stat-delta.up { color: var(--green); }
.il-stat-delta.down { color: var(--red); }


/* ============================================================
   NAVIGATION CONTROLS — tabs, toggle
============================================================ */
.il-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-elevated);
  padding: 3px;
  border-radius: calc(var(--radius) + 3px);
  width: fit-content;
}
.il-tab {
  font-size: 0.8125rem;
  font-weight: var(--weight-medium);
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius);
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  transition: all var(--duration) var(--ease);
}
.il-tab:hover { color: var(--text-primary); }
.il-tab.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  font-weight: var(--weight-semibold);
}

.il-toggle-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
}
.il-toggle {
  width: 40px;
  height: 22px;
  background: var(--border-strong);
  border-radius: var(--radius-full);
  position: relative;
  transition: background var(--duration) var(--ease);
  cursor: pointer;
  border: none;
  padding: 0;
  flex-shrink: 0;
}
.il-toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--bg-surface);
  border-radius: 50%;
  transition: transform var(--duration) var(--ease-spring);
  box-shadow: var(--shadow-xs);
}
.il-toggle.on { background: var(--accent); }
.il-toggle.on::after { transform: translateX(18px); }
.il-toggle-label {
  font-size: var(--text-base);
  color: var(--text-primary);
  user-select: none;
}


/* ============================================================
   MODALS
============================================================ */
.il-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--sp-6);
  animation: il-fade-in var(--duration) var(--ease);
}
@keyframes il-fade-in { from { opacity: 0; } to { opacity: 1; } }

.il-modal {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  padding: var(--sp-8);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: il-modal-in var(--duration-slow) var(--ease);
}
@keyframes il-modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.il-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-6);
  gap: var(--sp-4);
}
.il-modal-title {
  font-family: var(--font-head);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}
.il-modal-close {
  background: var(--bg-elevated);
  border: none;
  border-radius: var(--radius-sm);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--duration) var(--ease);
}
.il-modal-close:hover { background: var(--border); }
.il-modal-close svg { width: 14px; height: 14px; color: var(--text-muted); }
.il-modal-body {
  color: var(--text-secondary);
  font-size: var(--text-base);
  margin-bottom: var(--sp-6);
  line-height: var(--leading-relaxed);
}
.il-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
}


/* ============================================================
   TOASTS
============================================================ */
.il-toast-container {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  z-index: 1100;
  pointer-events: none;
}
.il-toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4) var(--sp-5);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  max-width: 360px;
  pointer-events: auto;
  animation: il-toast-in var(--duration-slow) var(--ease-spring);
}
@keyframes il-toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}
.il-toast.il-toast-leaving {
  animation: il-toast-out var(--duration-slow) var(--ease) forwards;
}
@keyframes il-toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}
.il-toast-icon { width: 18px; height: 18px; flex-shrink: 0; }
.il-toast-msg {
  flex: 1;
  color: var(--text-primary);
  font-weight: var(--weight-medium);
}
.il-toast-sub {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: var(--weight-normal);
  display: block;
  margin-top: 2px;
}
.il-toast.success .il-toast-icon { color: var(--green); }
.il-toast.error   .il-toast-icon { color: var(--red); }
.il-toast.warning .il-toast-icon { color: var(--yellow); }
.il-toast.info    .il-toast-icon { color: var(--accent); }


/* ============================================================
   UTILITY
============================================================ */
.il-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--text-inverse);
  flex-shrink: 0;
}
.il-avatar-sm { width: 24px; height: 24px; font-size: var(--text-xs); }
.il-avatar-lg { width: 40px; height: 40px; font-size: 0.875rem; }

.il-skeleton {
  background: linear-gradient(90deg,
    var(--bg-elevated) 25%,
    var(--border) 50%,
    var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: il-shimmer 1.4s infinite;
  border-radius: var(--radius);
}
@keyframes il-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.il-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-16) var(--sp-8);
  text-align: center;
  gap: var(--sp-4);
}
.il-empty-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
}
.il-empty-icon svg { width: 24px; height: 24px; color: var(--accent); }
.il-empty-title {
  font-family: var(--font-head);
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
}
.il-empty-body {
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 280px;
  line-height: var(--leading-relaxed);
}

.il-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.il-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.il-progress-label {
  font-size: 0.8125rem;
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
}
.il-progress-pct {
  font-size: 0.8125rem;
  font-weight: var(--weight-semibold);
  color: var(--accent);
}
.il-progress-track {
  height: 6px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.il-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease);
}

.il-search-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0.375rem var(--sp-4);
  font-size: 0.875rem;
  color: var(--text-muted);
  width: 240px;
  transition: border-color var(--duration) var(--ease),
              background var(--duration) var(--ease);
}
.il-search-bar:focus-within {
  border-color: var(--accent);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.il-search-bar svg { width: 14px; height: 14px; flex-shrink: 0; }
.il-search-bar input {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  flex: 1;
  font-family: var(--font-body);
  font-size: 0.875rem;
}
.il-search-bar input::placeholder { color: var(--text-muted); }

.il-divider {
  height: 1px;
  background: var(--border);
  border: none;
  margin: var(--sp-4) 0;
}

.il-cmd-palette {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  z-index: 1200;
  animation: il-fade-in var(--duration) var(--ease);
}
.il-cmd-palette-box {
  width: 100%;
  max-width: 560px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}
.il-cmd-palette-input {
  width: 100%;
  padding: var(--sp-5) var(--sp-6);
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-md);
  border-bottom: 1px solid var(--border);
}
.il-cmd-palette-input::placeholder { color: var(--text-muted); }
.il-cmd-palette-results {
  max-height: 360px;
  overflow-y: auto;
  padding: var(--sp-2);
}
.il-cmd-palette-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.il-cmd-palette-item:hover,
.il-cmd-palette-item.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}


/* ============================================================
   COMPOSE-SPECIFIC
============================================================ */
.il-post-type-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  padding: var(--sp-3) var(--sp-2);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
}
.il-post-type-btn svg { width: 18px; height: 18px; }
.il-post-type-btn:hover {
  border-color: var(--accent-subtle);
  color: var(--accent);
}
.il-post-type-btn.active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent-text);
}
.il-post-type-btn.active svg { color: var(--accent); }

.il-platform-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  font-size: 0.8125rem;
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
}
.il-platform-btn svg { width: 14px; height: 14px; }
.il-platform-btn:hover { border-color: var(--border-strong); }
.il-platform-btn.active-ig {
  border-color: var(--ig-brand);
  background: var(--ig-brand-bg);
  color: var(--ig-brand-text);
}
.il-platform-btn.active-fb {
  border-color: var(--fb-brand);
  background: var(--fb-brand-bg);
  color: var(--fb-brand-text);
}

.il-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-8);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  background: var(--bg-surface);
  text-align: center;
}
.il-upload-zone:hover {
  border-color: var(--accent-subtle);
  background: var(--accent-light);
}
.il-upload-zone svg { width: 28px; height: 28px; color: var(--text-muted); }
.il-upload-zone-label {
  font-size: 0.875rem;
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
}
.il-upload-zone-sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.il-phone-frame {
  width: 220px;
  margin: 0 auto;
  flex-shrink: 0;
}
.il-phone-shell {
  background: var(--phone-shell);
  border-radius: 36px;
  padding: 10px;
  box-shadow: 0 0 0 2px var(--phone-bezel), var(--shadow-xl);
  position: relative;
}
.il-phone-notch {
  width: 90px;
  height: 22px;
  background: var(--phone-shell);
  border-radius: 0 0 14px 14px;
  margin: 0 auto 6px;
  position: relative;
  z-index: 2;
}
.il-phone-screen {
  background: var(--bg-surface);
  border-radius: 28px;
  overflow: hidden;
}

.il-location-check-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  margin-bottom: var(--sp-2);
}
.il-location-check-item:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}
.il-location-check-item.checked {
  border-color: var(--accent);
  background: var(--accent-light);
}
.il-location-check-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}
.il-location-check-name {
  font-size: 0.875rem;
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}
.il-location-check-handle {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-left: auto;
}

.il-bulk-count-banner {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--green-light);
  color: var(--green-text);
  border-radius: var(--radius);
  border: 1px solid var(--green);
  font-size: 0.875rem;
  font-weight: var(--weight-semibold);
}
.il-bulk-count-banner svg { width: 16px; height: 16px; flex-shrink: 0; }

.il-token-warning {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--yellow-light);
  color: var(--yellow-text);
  border-radius: var(--radius);
  border: 1px solid var(--yellow);
  font-size: 0.875rem;
}
.il-token-warning svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
}

.il-story-toggle-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.il-first-comment {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-surface);
  overflow: hidden;
}
.il-first-comment-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: var(--weight-semibold);
  color: var(--text-secondary);
  user-select: none;
}
.il-first-comment-header:hover { background: var(--bg-elevated); }
.il-first-comment-header svg {
  width: 14px;
  height: 14px;
  transition: transform var(--duration) var(--ease);
}
.il-first-comment.open .il-first-comment-header svg {
  transform: rotate(90deg);
}
.il-first-comment-body {
  padding: 0 var(--sp-4) var(--sp-4);
  display: none;
}
.il-first-comment.open .il-first-comment-body { display: block; }


/* ============================================================
   DARK MODE — variables already flip in _tokens.css, but add
   a few component-specific dark-only tweaks here.
============================================================ */
@media (prefers-color-scheme: dark) {
  .il-toggle::after { background: var(--text-primary); }
  .il-upload-zone:hover { background: rgba(99, 102, 241, 0.12); }
  .il-platform-btn.active-ig { background: rgba(225, 48, 108, 0.15); color: var(--ig-brand); }
  .il-platform-btn.active-fb { background: rgba(24, 119, 242, 0.15); color: var(--fb-brand); }
  .il-bulk-count-banner { background: rgba(16, 185, 129, 0.15); color: var(--green); }
  .il-token-warning { background: rgba(245, 158, 11, 0.15); color: var(--yellow); }
}
