/* ===================================================================
   ACARS Portal — Global Stylesheet
   Design language: clean military/ops aesthetic with SMS-thread UX
   =================================================================== */

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

:root {
  --bg-dark:        #0d1117;
  --bg-panel:       #161b22;
  --bg-sidebar:     #0d1117;
  --bg-input:       #21262d;
  --bg-hover:       #1c2128;
  --bg-selected:    #1f2d3d;

  --border:         #30363d;
  --border-light:   #21262d;

  --text-primary:   #e6edf3;
  --text-secondary: #7d8590;
  --text-muted:     #484f58;

  --blue:           #1d6fb0;
  --blue-light:     #2d8cde;
  --blue-bubble:    #1a6db5;
  --blue-monitor:   #0d4a80;

  --grey-bubble:    #21262d;
  --grey-border:    #373e47;

  --green:          #3fb950;
  --yellow:         #d29922;
  --red:            #da3633;
  --orange:         #d18616;

  --badge-bg:       #da3633;
  --badge-text:     #fff;

  --dispatch-color: #2d8cde;
  --monitor-color:  #b08000;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Consolas", monospace;

  --sidebar-width:  280px;
  --topbar-height:  52px;
  --inputbar-height: 80px;
}

html, body { height: 100%; font-family: var(--font); background: var(--bg-dark); color: var(--text-primary); }

/* ------------------------------------------------------------------ */
/* Login page                                                            */
/* ------------------------------------------------------------------ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
}

.login-card {
  width: 380px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 36px 32px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo .logo-icon {
  font-size: 2.4rem;
  display: block;
  margin-bottom: 8px;
}
.login-logo h1 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}
.login-logo .logo-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: var(--font);
  transition: border-color 0.15s;
  outline: none;
}
.form-group input:focus { border-color: var(--blue-light); }
.form-group input::placeholder { color: var(--text-muted); }

.btn-primary {
  width: 100%;
  padding: 11px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 8px;
}
.btn-primary:hover { background: var(--blue-light); }
.btn-primary:disabled { background: var(--text-muted); cursor: not-allowed; }

.login-error {
  display: none;
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(218, 54, 51, 0.15);
  border: 1px solid rgba(218, 54, 51, 0.4);
  border-radius: 6px;
  color: #ff6b6b;
  font-size: 0.85rem;
  text-align: center;
}
.login-error.visible { display: block; }

.lockout-msg {
  display: none;
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(210, 153, 34, 0.15);
  border: 1px solid rgba(210, 153, 34, 0.4);
  border-radius: 6px;
  color: var(--yellow);
  font-size: 0.85rem;
  text-align: center;
}
.lockout-msg.visible { display: block; }

/* ------------------------------------------------------------------ */
/* Main app layout                                                       */
/* ------------------------------------------------------------------ */
.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Top bar */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
  z-index: 10;
}
.topbar-logo {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar-logo .logo-icon { font-size: 1.2rem; }
.topbar-spacer { flex: 1; }
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.user-display { color: var(--text-primary); font-weight: 600; }
.role-badge {
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.role-badge.dispatch { background: rgba(45, 140, 222, 0.2); color: var(--dispatch-color); border: 1px solid rgba(45, 140, 222, 0.35); }
.role-badge.monitor  { background: rgba(176, 128, 0, 0.2);  color: var(--monitor-color);  border: 1px solid rgba(176, 128, 0, 0.35);  }

.btn-logout {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* Connection status dot */
.conn-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}
.conn-dot.connected    { background: var(--green); box-shadow: 0 0 6px var(--green); }
.conn-dot.disconnected { background: var(--red); }
.conn-dot.connecting   { background: var(--yellow); }
.conn-status-text { font-size: 0.75rem; color: var(--text-secondary); }

/* Body (sidebar + main) */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ------------------------------------------------------------------ */
/* Sidebar                                                               */
/* ------------------------------------------------------------------ */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.aircraft-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}
.aircraft-list::-webkit-scrollbar { width: 4px; }
.aircraft-list::-webkit-scrollbar-track { background: transparent; }
.aircraft-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.aircraft-item {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.1s;
  border-radius: 0;
  gap: 10px;
  position: relative;
}
.aircraft-item:hover    { background: var(--bg-hover); }
.aircraft-item.selected { background: var(--bg-selected); border-right: 3px solid var(--blue-light); }

.aircraft-icon {
  font-size: 1.1rem;
  opacity: 0.7;
  flex-shrink: 0;
}
.aircraft-info { flex: 1; min-width: 0; }
.aircraft-tail-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}
.aircraft-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.aircraft-last-msg.no-msgs { color: var(--text-muted); font-style: italic; }
.aircraft-tail {
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-primary);
  letter-spacing: 0.05em;
}
.aircraft-last-msg {
  font-size: 0.72rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.unread-badge {
  background: var(--badge-bg);
  color: var(--badge-text);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* ------------------------------------------------------------------ */
/* Main chat panel                                                       */
/* ------------------------------------------------------------------ */
.main-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-dark);
}

.panel-header {
  height: var(--topbar-height);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
}
.panel-aircraft-icon { font-size: 1.3rem; }
.panel-aircraft-tail {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
}
.panel-aircraft-status {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* No-selection placeholder */
.no-selection {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 12px;
}
.no-selection .ns-icon { font-size: 3rem; opacity: 0.4; }
.no-selection .ns-text { font-size: 0.9rem; }

/* Message thread */
.message-thread {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.message-thread::-webkit-scrollbar { width: 6px; }
.message-thread::-webkit-scrollbar-track { background: transparent; }
.message-thread::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Date separator */
.date-separator {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 8px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.date-separator::before, .date-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

/* Message row */
.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 72%;
  gap: 3px;
}
.msg-row.uplink   { align-self: flex-end;   align-items: flex-end; }
.msg-row.downlink { align-self: flex-start; align-items: flex-start; }

.msg-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 0 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.msg-sender { font-weight: 600; color: var(--text-secondary); }
.msg-role-tag {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.05em;
}
.msg-role-tag.dispatch { background: rgba(45, 140, 222, 0.2); color: var(--dispatch-color); }
.msg-role-tag.monitor  { background: rgba(176, 128, 0, 0.2);  color: var(--monitor-color);  }

.msg-bubble {
  padding: 9px 14px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.45;
  word-break: break-word;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* Uplink (outgoing) — right side, blue */
.msg-row.uplink .msg-bubble {
  background: var(--blue-bubble);
  color: #fff;
  border-bottom-right-radius: 4px;
}
/* Monitor uplink — darker blue */
.msg-row.uplink.monitor-msg .msg-bubble {
  background: var(--blue-monitor);
  border: 1px solid rgba(45, 140, 222, 0.3);
}

/* Downlink (incoming) — left side, grey */
.msg-row.downlink .msg-bubble {
  background: var(--grey-bubble);
  color: var(--text-primary);
  border: 1px solid var(--grey-border);
  border-bottom-left-radius: 4px;
}

/* Status indicator */
.msg-status {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.55);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  padding-right: 4px;
}
.msg-status .status-icon { font-size: 0.75rem; }
.status-queued    { color: var(--text-muted); }
.status-sent      { color: rgba(255,255,255,0.5); }
.status-delivered { color: var(--green); }
.status-error     { color: var(--red); }
.status-rejected  { color: var(--red); font-weight: 600; }
.status-failed    { color: #ff8c00; font-weight: 600; } /* orange = timeout/DFN */

.msg-status[title] { cursor: help; }

/* ------------------------------------------------------------------ */
/* Input bar                                                             */
/* ------------------------------------------------------------------ */
.input-bar {
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  padding: 12px 16px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  flex-shrink: 0;
}
.input-wrapper { flex: 1; position: relative; }
.msg-input {
  width: 100%;
  padding: 10px 14px 26px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-mono);
  resize: none;
  min-height: 52px;
  max-height: 120px;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.15s;
}
.msg-input:focus { border-color: var(--blue-light); }
.msg-input::placeholder { color: var(--text-muted); font-family: var(--font); }
.msg-input.warn { border-color: var(--yellow) !important; }
.msg-input.error { border-color: var(--red) !important; }

.char-counter {
  position: absolute;
  bottom: 6px;
  right: 10px;
  font-size: 0.68rem;
  color: var(--text-muted);
  pointer-events: none;
}
.char-counter.warn  { color: var(--yellow); }
.char-counter.error { color: var(--red); font-weight: 700; }

.btn-send {
  padding: 10px 20px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  height: 52px;
  transition: background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-send:hover    { background: var(--blue-light); }
.btn-send:disabled { background: var(--text-muted); cursor: not-allowed; }

/* Block split hint */
.block-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  padding: 4px 0 0 2px;
  height: 16px;
}
.block-hint.warn  { color: var(--yellow); }
.block-hint.error { color: var(--red); }

/* ------------------------------------------------------------------ */
/* Loading / empty states                                               */
/* ------------------------------------------------------------------ */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 0.85rem;
  gap: 10px;
}
.spinner-icon {
  animation: spin 1s linear infinite;
  font-size: 1.2rem;
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.empty-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: 8px;
  padding: 40px;
}
.empty-thread .et-icon { font-size: 2.5rem; opacity: 0.4; }
.empty-thread .et-text { font-size: 0.85rem; }

/* ------------------------------------------------------------------ */
/* Toast notifications                                                  */
/* ------------------------------------------------------------------ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}
.toast {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  backdrop-filter: blur(8px);
  animation: toastIn 0.2s ease;
  pointer-events: auto;
  max-width: 320px;
}
.toast.info    { background: rgba(29, 111, 176, 0.9); color: #fff; }
.toast.success { background: rgba(63, 185, 80, 0.9);  color: #fff; }
.toast.error   { background: rgba(218, 54, 51, 0.9);  color: #fff; }
.toast.warning { background: rgba(210, 153, 34, 0.9); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ */
/* OOOI timeline events                                                 */
/* ------------------------------------------------------------------ */
.oooi-event {
  display: flex;
  justify-content: center;
  margin: 12px 0;
  padding: 0;
}
.oooi-line {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 80%;
}
.oooi-icon { font-size: 1rem; }
.oooi-text { color: var(--text-secondary); font-weight: 500; letter-spacing: 0.02em; }
.oooi-time { color: var(--text-muted); font-size: 0.72rem; }

/* ------------------------------------------------------------------ */
/* Utilities                                                            */
/* ------------------------------------------------------------------ */
.hidden { display: none !important; }

/* ------------------------------------------------------------------ */
/* Back button + mobile title (desktop: always hidden)                 */
/* ------------------------------------------------------------------ */
.back-btn   { display: none; }
.mobile-title { display: none; }

/* ------------------------------------------------------------------ */
/* Mobile responsive — max-width: 768px                               */
/* ------------------------------------------------------------------ */
@media (max-width: 768px) {

  /* ----- Top bar ----- */
  .topbar {
    padding: 0 10px;
    gap: 6px;
  }

  /* Hide verbose connection text; keep dot */
  .conn-status-text { display: none; }

  /* Compress user info — hide name & role badge */
  .user-display { display: none; }
  .role-badge   { display: none; }

  /* Shrink logo text on mobile */
  .topbar-logo { font-size: 0.82rem; letter-spacing: 0.04em; }

  /* When thread is open on mobile, swap logo for back+title */
  .app-layout.thread-open .topbar-logo { display: none; }

  .back-btn {
    display: none; /* stays hidden until thread-open */
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 0 12px;
    cursor: pointer;
    min-height: 44px;
    white-space: nowrap;
    transition: border-color 0.15s, color 0.15s;
    flex-shrink: 0;
  }
  .app-layout.thread-open .back-btn { display: flex; }
  .back-btn:active { border-color: var(--blue-light); color: var(--text-primary); }

  .mobile-title {
    display: none; /* stays hidden until thread-open */
    font-size: 0.95rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    letter-spacing: 0.06em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
  }
  .app-layout.thread-open .mobile-title { display: block; }

  /* ----- App body: stack children, each fills the container ----- */
  .app-body {
    position: relative;
    overflow: hidden;
  }

  /* Sidebar: absolute, full area */
  .sidebar {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%;
    min-width: 0;
    border-right: none;
    height: 100%;
    z-index: 2;
  }
  .sidebar.mobile-hidden { display: none !important; }

  /* Main panel: absolute, full area */
  .main-panel {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 2;
  }
  .main-panel.mobile-hidden { display: none !important; }

  /* Hide "no aircraft selected" placeholder — users tap from list */
  .no-selection { display: none !important; }

  /* ----- Touch-friendly sizing ----- */

  /* Aircraft list items: easy tap targets */
  .aircraft-item {
    min-height: 56px;
    padding: 12px 16px;
  }

  /* Prevent iOS auto-zoom on textarea focus (must be ≥16px) */
  .msg-input {
    font-size: 16px;
  }

  /* Send button: tall enough for thumbs */
  .btn-send {
    min-height: 48px;
    padding: 10px 16px;
  }

  /* Logout button minimum target */
  .btn-logout { min-height: 44px; }

  /* Wider message bubbles on narrow screens */
  .msg-row { max-width: 88%; }

  /* ----- Input bar on mobile ----- */
  .input-bar {
    padding: 10px 12px;
    gap: 8px;
  }

  /* ----- Toast: move above the input bar ----- */
  .toast-container {
    bottom: 80px;
    right: 12px;
    left: 12px;
  }
  .toast { max-width: 100%; }
}

/* ── Change Password button ─────────────────────────────────────── */
.btn-change-pw {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: #ccc;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  margin-right: 6px;
  transition: border-color 0.15s, color 0.15s;
}
.btn-change-pw:hover { border-color: #fff; color: #fff; }

.btn-map {
  background: transparent;
  border: 1px solid rgba(74, 144, 217, 0.5);
  color: #4a90d9;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  margin-right: 2px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.btn-map:hover {
  border-color: #4a90d9;
  background: rgba(74, 144, 217, 0.12);
  color: #7ab8f5;
}

/* ── Modal overlay ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal-box {
  background: #1e2330;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 28px 32px;
  width: 340px;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.modal-box h3 {
  margin: 0 0 20px;
  font-size: 1.1rem;
  color: #e0e6f0;
}
.modal-field {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.modal-field label {
  font-size: 0.78rem;
  color: #8899aa;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.modal-field input {
  background: #11151f;
  border: 1px solid #333;
  border-radius: 4px;
  color: #e0e6f0;
  padding: 7px 10px;
  font-size: 0.9rem;
  outline: none;
}
.modal-field input:focus { border-color: #4a90d9; }
.modal-error {
  color: #e05555;
  font-size: 0.82rem;
  margin-bottom: 12px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
.btn-primary {
  background: #2a5db0;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 7px 16px;
  cursor: pointer;
  font-size: 0.88rem;
}
.btn-primary:hover { background: #3570cc; }
.btn-secondary {
  background: transparent;
  color: #aaa;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 7px 16px;
  cursor: pointer;
  font-size: 0.88rem;
}
.btn-secondary:hover { color: #fff; border-color: #888; }

/* ------------------------------------------------------------------ */
/* Scheduled Message Pending Bubble (dispatch page)                     */
/* ------------------------------------------------------------------ */

.sched-pending-bubble {
  background: #161b22;
  border: 1px dashed #1c3a5e;
  border-radius: 8px;
  padding: 8px 12px;
  margin: 4px 0;
  opacity: 0.85;
}

.sched-bubble-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.sched-clock-badge {
  font-size: 0.72rem;
  color: #4a90d9;
  background: rgba(74, 144, 217, 0.12);
  border: 1px solid rgba(74, 144, 217, 0.3);
  border-radius: 3px;
  padding: 1px 6px;
}

.sched-sender {
  font-size: 0.72rem;
  color: #7d8590;
}

.sched-bubble-content {
  font-size: 0.82rem;
  color: #7ab8f5;
  font-style: italic;
  word-break: break-word;
  margin-bottom: 4px;
}

.sched-bubble-meta {
  font-size: 0.68rem;
}

.sched-countdown {
  color: #4a90d9;
}

/* ── Send button countdown state ──────────────────────────────────── */
.btn-send.btn-send-countdown {
  background: #5a3a00;
  border: 1px solid #cc7700;
  color: #ffaa33;
  animation: dispatch-countdown-pulse 1s ease-in-out infinite;
}
@keyframes dispatch-countdown-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.6; }
}

/* ── Schedule toggle ─────────────────────────────────────────────── */
.dispatch-schedule-meta {
  display: flex;
  align-items: center;
  margin-top: 2px;
}
.dispatch-schedule-toggle {
  background: none;
  border: none;
  color: #555;
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0;
}
.dispatch-schedule-toggle:hover,
.dispatch-schedule-toggle.active { color: #4a90d9; }

/* ── Schedule row ────────────────────────────────────────────────── */
.dispatch-schedule-row {
  margin-top: 5px;
  padding: 8px 10px;
  background: #0d1a2d;
  border: 1px solid #1c3a5e;
  border-radius: 6px;
}
.dispatch-schedule-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.dsr-label   { font-size: 0.78rem; color: #7d8590; }
.dsr-divider { font-size: 0.72rem; color: #444; }
.dsr-delay-input {
  width: 54px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 4px;
  color: #e0e6f0;
  padding: 3px 6px;
  font-size: 0.82rem;
  text-align: center;
}
.dsr-time-input {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 4px;
  color: #e0e6f0;
  padding: 3px 6px;
  font-size: 0.82rem;
}
.dsr-confirm-btn {
  background: #1c3a5e;
  border: 1px solid #2a5db0;
  color: #7ab8f5;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 0.78rem;
  cursor: pointer;
}
.dsr-confirm-btn:hover { background: #2a5db0; color: #fff; }
.dsr-cancel-btn {
  background: none; border: none;
  color: #555; cursor: pointer;
  font-size: 0.9rem; padding: 0 4px;
}
.dsr-cancel-btn:hover { color: #e05555; }

/* ── Dispatch pending scheduled items ────────────────────────────── */
.dispatch-sched-pending {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}
.dispatch-sched-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #0d1a2d;
  border: 1px solid #1c3a5e;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 0.75rem;
}
.dispatch-sched-clock  { flex-shrink: 0; }
.dispatch-sched-preview {
  flex: 1;
  color: #7ab8f5;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dispatch-sched-time   { color: #4a90d9; white-space: nowrap; flex-shrink: 0; }
.dispatch-sched-cancel-btn {
  background: none;
  border: 1px solid #333;
  border-radius: 3px;
  color: #666;
  cursor: pointer;
  font-size: 0.68rem;
  padding: 1px 6px;
  flex-shrink: 0;
}
.dispatch-sched-cancel-btn:hover { border-color: #e05555; color: #e05555; }

/* ------------------------------------------------------------------ */
/* Login page — mobile responsive                                       */
/* ------------------------------------------------------------------ */
@media (max-width: 480px) {
  .login-card {
    width: 100%;
    max-width: 100vw;
    margin: 0 16px;
    padding: 28px 20px 24px;
    border-radius: 10px;
  }
  .login-logo h1 { font-size: 1.15rem; }
  .login-logo .logo-icon { font-size: 2rem; }

  /* iOS auto-zoom prevention */
  .form-group input { font-size: 16px; }

  /* Ensure login footer links are readable */
  .login-footer {
    text-align: center;
    font-size: 0.72rem;
    padding: 0 8px;
  }
}
