/* ========================================
   BASE STYLES
   ======================================== */
/* THEME: Minimalist Black & White
   - Clean black/white color scheme
   - Subtle grey borders (#e0e0e0) on cards
   - Cards for content grouping with consistent padding
   - Links for navigation (underline on hover)
   - Buttons only for form submissions
   - No heavy buttons or CTAs
   - Consistent spacing using design tokens
   ======================================== */
:root {
  --topic-gap: 15px;
  
  /* Design System Tokens */
  /* Colors - slightly warmed up grays */
  --card-border: #e8e8e8;
  --card-background: #ffffff;
  --hover-background: #fafafa;
  --divider: #f0f0f0;
  --border-color: #f0f0f0;
  --text-primary: #1a1a1a;
  --text-secondary: #555;
  --text-muted: #888;
  --accent-color: #000;
  --accent-blue: #007bff;
  --accent-blue-hover: #0056b3;
  
  /* Button colors */
  --btn-primary: #000;
  --btn-primary-hover: #333;
  --btn-danger: #c00;
  --btn-danger-hover: #a00;
  --btn-success: #1a7f37;
  --btn-success-hover: #156b2d;
  
  /* Spacing - consistent scale */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --item-padding: 16px;
  
  /* Borders */
  --border-radius: 6px;
  --border-width: 1px;
  
  /* Shadows */
  --shadow-sm: none;
  --shadow-md: 0 4px 6px rgba(0,0,0,0.04), 0 2px 4px rgba(0,0,0,0.06);
  
  /* Typography */
  --line-height: 1.6;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
}

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  font-family: "Nunito Sans", serif;
  font-size: 14px;
  box-sizing: border-box;
  overflow-x: hidden;
}

*, *:before, *:after {
  box-sizing: inherit;
}

/* Links - minimalist style with hover underline */
a {
  color: #000;
  text-decoration: none;
  font-size: 0.9em;
  font-weight: bold;
  transition: opacity var(--transition-fast);
}

a:hover {
  text-decoration: underline;
}

a:visited {
  color: #000;
}

/* External links - same color as other links for consistency */
a[target="_blank"],
a[rel*="noopener"] {
  color: var(--text-primary);
}

a[target="_blank"]:visited,
a[rel*="noopener"]:visited {
  color: var(--text-primary);
}

/* Buttons - slim, consistent padding */
button {
  display: inline-block;
  background: var(--btn-primary);
  color: #fff;
  border: 1px solid var(--btn-primary);
  border-radius: var(--border-radius);
  padding: 6px 12px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
  text-decoration: none;
  transition: all var(--transition-fast);
}

button:hover {
  background: var(--btn-primary-hover);
  border-color: var(--btn-primary-hover);
}

/* .btn class for links styled as buttons */
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--btn-primary);
  color: #fff !important;
  border: 1px solid var(--btn-primary);
  border-radius: var(--border-radius);
  padding: 6px 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: normal;
  line-height: 1.4;
  text-decoration: none;
  transition: all var(--transition-fast);
  height: 36px;
  box-sizing: border-box;
}

a.btn:hover {
  background: var(--btn-primary-hover);
  border-color: var(--btn-primary-hover);
  color: #fff !important;
  text-decoration: none;
}

/* Button variants */
.btn-link {
  background: transparent;
  color: var(--text-primary);
  border: none;
  padding: 8px 12px;
  text-decoration: none;
  display: inline-block;
}
.btn-link:hover {
  background: var(--hover-background);
}

.btn-danger {
  background: var(--btn-danger);
  border-color: var(--btn-danger);
}
.btn-danger:hover {
  background: var(--btn-danger-hover);
  border-color: var(--btn-danger-hover);
}

.btn-success {
  background: var(--btn-success);
  border-color: var(--btn-success);
}
.btn-success:hover {
  background: var(--btn-success-hover);
  border-color: var(--btn-success-hover);
}

/* Search bar - unified across all pages */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.search-bar input {
  flex: 1;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid var(--card-border, #e0e0e0);
  border-radius: var(--border-radius, 6px);
  min-width: 0;
}
.search-bar input:focus {
  outline: none;
  border-color: var(--text-muted, #999);
}
.search-bar button {
  flex-shrink: 0;
}

input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
}

input {
  width: 100%;
  padding: 10px;
  border-radius: 5px;
  border: 1px solid #e0e0e0;
  box-sizing: border-box;
}

select {
  padding: 5px;
  border-radius: 5px;
  background: white;
}

textarea:focus, input:focus {
  outline: none;
}

code {
  background: #f9f9f9;
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 0.9em;
}

pre {
  background: #f9f9f9;
  padding: 15px;
  border-radius: 5px;
  overflow-x: auto;
}

pre code {
  padding: 0;
  background: none;
  border-radius: 0;
  font-size: inherit;
  white-space: pre-wrap;
}

table {
  width: 100%;
}

table, td, th {
  text-align: left;
}

th {
  border-bottom: 1px solid darkgrey;
}

td {
  border-bottom: 1px solid darkgrey;
  padding: 5px 25px 5px 0;
}

/* ========================================
   MICRO DIALOG
   ======================================== */
/* ========================================
   HEADER & NAVIGATION
   ======================================== */
/* ========================================
   HEADER & NAVIGATION
   ======================================== */
#head {
  background: white;
  width: 100%;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 40px;
  border-bottom: 1px solid #e0e0e0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  box-sizing: border-box;
}

#menu-toggle {
  display: none;
  position: absolute;
  left: 15px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  width: 36px;
  height: 34px;
  flex-direction: column;
  justify-content: space-between;
  align-items: stretch;
  box-sizing: border-box;
}

#menu-toggle span {
  display: block;
  height: 2px;
  width: 20px;
  background: var(--text-primary);
  border-radius: 1px;
}

#menu-toggle:hover {
  background: var(--hover-background);
  border-radius: var(--border-radius);
}

#brand {
  flex: 0 0 auto;
}

#brand a {
  color: black;
  font-weight: bold;
  text-decoration: none;
  font-size: 1.2em;
}

#nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 150;
}

#nav-container {
  position: fixed;
  left: 0;
  top: 50px;
  width: 220px;
  height: calc(100vh - 50px);
  padding: 12px 25px 25px;
  background: white;
  border-right: 1px solid #e0e0e0;
  z-index: 200;
  display: flex;
  flex-direction: column;
}

#nav-search form {
  display: flex;
}

#nav-search input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid #ddd;
  border-radius: var(--border-radius);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: #f7f7f7;
}

#nav-search input:focus {
  border-color: #aaa;
  background: #fff;
}

#nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
  overflow-y: auto;
  position: relative;
}

#nav a {
  color: var(--text-primary);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  padding: 10px 14px;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  transition: all var(--transition-fast);
}

#nav a:hover {
  background: var(--hover-background);
  color: var(--text-primary);
}

#nav a.active {
  background: var(--hover-background);
  font-weight: var(--font-weight-semibold);
}

#nav img {
  height: 24px;
  width: 24px;
  margin-right: 16px;
  filter: brightness(0);
}

#nav .label {
  font-size: 1.1em;
}

.nav-divider {
  height: 1px;
  background: var(--divider, #f0f0f0);
  margin: 4px 0;
}

.nav-spacer {
  display: none;
}

#nav-container > .nav-bottom {
  /* nav-bottom is now direct child of nav-container */
}

.nav-bottom {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px solid var(--divider, #f0f0f0);
  padding-top: 10px;
  margin-top: auto;
  flex-shrink: 0;
}

.nav-bottom a {
  color: var(--text-primary);
  font-weight: var(--font-weight-medium);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background-color 0.15s ease;
  font-size: 0.95em;
}

.nav-bottom a:hover {
  background-color: #f5f5f5;
}

.nav-bottom img {
  height: 20px;
  width: 20px;
}

#nav-username {
  font-weight: 400;
  color: #999;
  padding: 4px 14px;
  font-size: 0.75em;
}

#nav-mail-badge {
  background: #555;
  color: white;
  font-size: 11px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  padding: 0 4px;
  border-radius: 8px;
  font-weight: 600;
  margin-left: auto;
  display: none;
}

#nav-mail-badge:not(:empty) {
  display: inline-block;
}

/* Header mail indicator — hidden on desktop, visible on mobile */
#head-mail {
  display: none;
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  text-decoration: none;
  color: #555;
  line-height: 0;
}
#head-mail svg {
  vertical-align: middle;
}
#head-mail-badge {
  display: none;
}
#head-mail-badge:not(:empty) {
  display: block;
  position: absolute;
  top: -6px;
  right: -8px;
  background: #555;
  color: white;
  font-size: 10px;
  min-width: 14px;
  height: 14px;
  line-height: 14px;
  text-align: center;
  padding: 0 3px;
  border-radius: 7px;
  font-weight: 600;
}

#nav-logged-out {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#nav-logged-out button {
  width: 100%;
  padding: 12px;
  font-size: 1em;
}

/* ========================================
   LAYOUT
   ======================================== */
/* ========================================
   LAYOUT
   ======================================== */
#container {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 50px);
  margin-top: 50px;
}

#content {
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 40px;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
}

#page-title {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 1.5em;
}

#footer {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-muted);
  font-size: 14px;
  border-top: 1px solid var(--divider);
  margin-top: 20px;
}

#footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

#footer a:hover {
  text-decoration: underline;
}

/* Scroll offset for anchor links to account for fixed header */
.anchor {
  scroll-margin-top: 60px;
  margin: 50px 0;
}

#main {
  max-width: 900px;
  justify-items: center;
  text-align: center;
  padding: 25px;
  margin: 0 auto;
  margin-top: 75px;
}

/* ========================================
   HOME PAGE
   ======================================== */

/* Hide the customize-link on the home page but keep the title */
body.page-home #page-title ~ #customize-link {
  display: none;
}

#home-date {
  color: #888;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
#home-date-text {
  white-space: nowrap;
}
#home-date-weather {
  font-size: 13px;
  color: #999;
}
#home-date-actions {
  margin-left: auto;
  font-size: 13px;
}

#home-status-form {
  margin-bottom: 12px;
}
#home-status-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  font-family: inherit;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
  color: #333;
}
#home-status-input::placeholder {
  color: #aaa;
}
#home-status-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#home-statuses {
  margin: 0;
  /* Stream is scrollable. Capped at ~55vh on mobile (so the card never
     takes the whole screen) and 420px on desktop. Overflowing entries
     scroll inside the card rather than expanding the layout. */
  max-height: min(55vh, 420px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}
.home-status-entry {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}
.home-status-entry:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.home-status-entry:first-child {
  padding-top: 0;
}
.home-status-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}
.home-status-body {
  flex: 1;
  min-width: 0;
}
.home-status-header {
  display: flex;
  align-items: center;
  gap: 6px;
}
.home-status-name {
  font-weight: 600;
  color: #333;
  text-decoration: none;
}
.home-status-name:hover {
  text-decoration: underline;
}
.home-status-time {
  color: #bbb;
  font-size: 12px;
  margin-left: auto;
  white-space: nowrap;
}
.home-status-text {
  color: #555;
  margin-top: 2px;
  /* Wrap long lines naturally and break any ultra-long unbroken
     strings (URLs, code) so nothing can widen the card. */
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  line-height: 1.4;
}
.home-status-system .home-status-name {
  color: #1f7a4a;
}
.home-status-system .home-status-avatar {
  background: #1f7a4a !important;
}

#home {
  margin-bottom: 25px;
  display: flex;
  gap: 20px;
  height: 100%;
}

.card-tooltip {
  display: inline-block;
  position: relative;
  width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  font-style: normal;
  color: #bbb;
  border: 1px solid #ddd;
  border-radius: 50%;
  cursor: pointer;
  vertical-align: middle;
  margin-left: 4px;
  float: right;
}
.card-tooltip:hover {
  color: #666;
  border-color: #aaa;
}
.card-tooltip::after {
  content: attr(data-tip);
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 6px;
  background: #333;
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  padding: 6px 10px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.card-tooltip:hover::after,
.card-tooltip.show::after {
  opacity: 1;
}

#home-chat-form {
  display: flex;
  gap: 10px;
  width: 100%;
}

#home-chat-form input {
  flex: 1;
  min-width: 0;
}

#home-chat-form button {
  white-space: nowrap;
  flex-shrink: 0;
}

#home:after {
  content: ".";
  display: block;
  height: 0;
  clear: both;
  visibility: hidden;
}

#home h1 {
  margin-top: 0;
}

.home-left, .home-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.home-left {
  flex: 1;
  min-width: 0;
}

.home-right {
  width: 370px;
  flex-shrink: 0;
}

.home-left .card, .home-right .card {
  margin: 0;
  float: none;
  min-width: 350px;
  max-width: none;  /* Allow cards to expand in home columns */
}

/* Home page: cards have borders, but content inside does not */
.home-left .card .headline,
.home-right .card .headline {
  border: none;
  border-bottom: 1px solid var(--border-color, #f0f0f0);
  border-radius: 0;
  padding: 12px 0;
  margin-bottom: 0;
  background: transparent;
}

.home-left .card .headline:last-of-type,
.home-right .card .headline:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.home-left .card .headline:first-of-type,
.home-right .card .headline:first-of-type {
  padding-top: 0;
}

.home-left .card .item,
.home-left .card .post-item,
.home-left .card .thumbnail,
.home-right .card .item,
.home-right .card .post-item,
.home-right .card .thumbnail {
  border: none;
  padding: 0;
  background: transparent;
}

/* Switch to single column when there's not enough space for two columns + sidebar */
@media only screen and (max-width: 1100px) {
  #home {
    flex-direction: column;
  }
  
  .home-right {
    width: 100%;
  }
}

/* ========================================
   CARDS & BLOCKS
   ======================================== */
.card {
  max-width: 750px;
  box-sizing: border-box;
  display: block;
  position: relative;
  border: var(--border-width) solid var(--card-border);
  border-radius: var(--border-radius);
  padding: var(--item-padding);
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-lg);
  background: var(--card-background);
  box-shadow: var(--shadow-sm);
}

a.card-clickable {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

a.card-clickable:hover {
  border-color: var(--accent-color, #000);
}

/* Reduce card min-width on smaller screens */
@media only screen and (max-width: 900px) {
  .card {
    max-width: 100%;
  }
}

.card h4 {
  margin-top: 0;
  margin-bottom: var(--spacing-sm);
  font-size: 1em;
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
}

.card form {
  margin-bottom: 0;
}

.block {
  width: 220px;
  height: auto;
  display: block;
  text-align: center;
  text-decoration: none;
  border: var(--border-width) solid var(--card-border);
  border-radius: var(--border-radius);
  padding: 10px;
  background: var(--card-background);
  transition: background var(--transition-fast);
}

.block:hover {
  background: var(--hover-background);
}

/* ========================================
   CHAT PAGE
   ======================================== */
body:has(#messages) #content {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 70px);
  padding-bottom: 20px;
  overflow: hidden;
}

body:has(#messages) #footer,
body:has(#messages) #chat-back-link {
  display: none;
}

#topic-selector {
  flex-shrink: 0;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e0e0e0;
  position: relative;
}

#chat-clear {
  position: absolute;
  top: 5px;
  right: 0;
  color: #999;
  text-decoration: none;
  font-size: 13px;
}

#chat-clear:hover {
  color: #555;
}

.topic-tabs {
  display: flex;
  gap: var(--topic-gap);
  flex-wrap: wrap;
}

#topic-selector .head {
  padding: 5px 0;
  font-size: 14px;
  text-decoration: none;
  color: #333;
  transition: color 0.2s;
  cursor: pointer;
}

#topic-selector .head.home-link {
  font-size: 16px;
  padding: 4px 12px 4px 0;
  text-decoration: none !important;
}

#topic-selector .head:hover {
  color: #000;
  text-decoration: underline;
}

#topic-selector .head.active {
  color: #000;
  text-decoration: underline;
  font-weight: bold;
}

#topic-summary {
  flex-shrink: 0;
  margin-bottom: 10px;
}

.topic-brief {
  font-size: 14px;
  color: #333;
  line-height: 1.5;
  padding: 12px 15px;
  background: var(--hover-background);
  border-left: 4px solid #ccc;
  border-radius: 3px;
  margin-bottom: 15px;
}

.topic-brief strong {
  color: #000;
  font-weight: 700;
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
}

.topic-brief div {
  color: #555;
}

#messages {
  height: calc(100dvh - 240px);
  min-height: 300px;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 15px;
  text-align: left;
  overflow-y: auto;
}
#messages p {
  margin-top: 8px;
  margin-bottom: 12px;
  line-height: 1.5;
}

#messages ul, #messages ol {
  margin: 10px 0;
  padding-left: 25px;
}

#messages li {
  margin-bottom: 8px;
  line-height: 1.5;
}

#messages h1, #messages h2, #messages h3 {
  margin-top: 20px;
  margin-bottom: 12px;
}

#messages code {
  margin: 10px 0;
}

.message {
  margin-bottom: var(--spacing-lg);
  width: 100%;
  display: block;
}

.you {
  font-size: 0.85em;
  font-weight: bold;
  color: var(--text-primary);
  display: block;
  margin-bottom: var(--spacing-xs);
}

.llm, .ai, .micro, .system {
  font-size: 0.85em;
  font-weight: bold;
  color: var(--text-primary);
  display: block;
  margin-bottom: var(--spacing-xs);
}

.loading-dots {
  display: inline-block;
  animation: loading-dots 1.5s infinite;
  letter-spacing: 2px;
}

@keyframes loading-dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

.context-message {
  font-size: small;
  color: #999;
  font-style: italic;
  text-align: center;
  padding: 8px 0;
  margin: 10px 0;
  border-top: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
}

.summary-toggle {
  color: var(--text-secondary);
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}

.summary-toggle:hover {
  text-decoration: underline;
}

.summary-content {
  margin-top: 8px;
  font-style: normal;
  line-height: 1.4;
}

/* Summary card for main /chat page */
.summary-card {
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 0;
  margin-bottom: 16px;
}

.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
}

.summary-header:hover {
  background: #f0f0f0;
  border-radius: 8px;
}

#summary-toggle-icon {
  color: #666;
  font-size: 12px;
}

.all-summaries {
  padding: 0 16px 16px;
  border-top: 1px solid #e0e0e0;
}

.summary-item {
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}

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

.summary-item .category {
  display: inline-block;
  margin-bottom: 8px;
}

.summary-item p {
  margin: 0;
  color: #555;
  font-size: 14px;
  line-height: 1.5;
}

.summary-item .link {
  display: block;
  margin-top: 8px;
}

.topic-summary {
  margin: 8px 0 0;
  color: #555;
  font-size: 14px;
  line-height: 1.5;
}

#topics {
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  gap: var(--topic-gap);
  flex-wrap: wrap;
}

#prompt {
  flex: 1;
  padding: 10px;
  margin: 0;
  box-sizing: border-box;
}

#chat-users {
  font-size: 13px;
  color: #666;
  padding: 0 0 8px;
  border-bottom: 1px solid #eee;
  margin-bottom: 8px;
}

#chat-form {
  width: 100%;
  margin: 15px 0 0 0;
  display: flex;
  gap: 10px;
  align-items: center;
}

#chat-form button {
  padding: 10px 20px;
  margin: 0;
  width: auto;
  flex-shrink: 0;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 10px;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  margin: 20px;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 20px;
  font-size: 32px;
  color: #666;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: #000;
}

#summaries-content .message {
  margin-bottom: 20px;
}

#summary {
  border-bottom: 1px solid darkgrey;
  margin-bottom: 20px;
}

#summary p {
  margin-bottom: 20px;
}

.head {
  display: inline-block;
  color: var(--accent-color) !important;
  font-size: 10px !important;
  font-weight: bold !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: transparent;
  padding: 0;
  border: none;
  text-decoration: none;
  margin-right: 8px;
  transition: color var(--transition-fast);
}

.head:hover {
  text-decoration: underline;
}

.head.active {
  text-decoration: underline;
}

/* ========================================
   BLOG PAGE
   ======================================== */
#blog {
  position: relative;
  max-width: 900px;
}

#blog h2 {
  margin-top: 15px;
}

#blog-form {
  max-width: 100%;
}

#blog-form input, #blog-form textarea {
  width: 100%;
  box-sizing: border-box;
}

#post-form-container {
  margin-bottom: 30px;
  padding: 20px;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  background: #fafafa;
  max-width: 100%;
}

#post-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#post-form input,
#post-form textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  font-size: 14px;
  border: 1px solid #e0e0e0;
  border-radius: 5px;
}

#post-form textarea {
  resize: vertical;
}

#post-form button {
  padding: 10px 20px;
  font-size: 14px;
  background-color: #333;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  align-self: flex-start;
}

.profile-app-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.profile-app-icon svg {
  width: 20px;
  height: 20px;
  max-width: 20px;
  max-height: 20px;
}
.post-item {
  position: relative;
  border: var(--border-width) solid var(--card-border);
  border-radius: var(--border-radius);
  padding: var(--item-padding);
  background: var(--card-background);
  margin-bottom: var(--spacing-md);
}

.message-item {
  border: var(--border-width) solid var(--card-border);
  border-radius: var(--border-radius);
  padding: var(--item-padding);
  background: var(--card-background);
  margin-bottom: var(--spacing-md);
}

.post-item h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

.post-item h3 a {
  text-decoration: none;
  color: inherit;
}

.post-item > div {
  margin-bottom: 10px;
  font-size: 0.9em;
}

.post-item .info {
  color: var(--text-secondary);
  font-size: 0.8em;
  margin-top: var(--spacing-sm);
  margin-bottom: 0;
}

.post-item .info a {
  color: var(--text-secondary);
  text-decoration: none;
}

.post-item .info a:hover {
  text-decoration: underline;
}

.keep-reading {
  display: inline-block;
  font-size: 0.85em;
  font-weight: 500;
  color: var(--accent-color);
  text-decoration: none;
  margin-top: 4px;
}

.keep-reading:hover {
  text-decoration: underline;
}

.post-tags {
  margin-top: 8px;
  font-size: small;
}

.post-content {
  display: none !important;
  border: 1px solid darkgrey;
  border-radius: 5px;
  padding: 15px;
  max-width: 800px;
  overflow: auto;
  margin-bottom: 20px;
  margin-top: 20px;
}

.post-content img {
  max-width: inherit;
}

.post-show {
  cursor: pointer;
  display: block;
  width: 180px;
  border: 1px solid darkgrey;
  border-radius: 5px;
  text-align: center;
  padding: 10px;
}

.post-show:focus + .post-content {
  display: block !important;
}

/* ========================================
   MODERATION PAGE
   ======================================== */
#moderation .info-banner {
  font-size: small;
  color: #999;
  font-style: italic;
  padding: 8px 0;
  margin: 10px 0;
  border-top: 1px solid #e0e0e0;
  border-bottom: 1px solid #e0e0e0;
}

.flagged-item {
  background: #fff3cd;
  padding: 15px;
  border-radius: 5px;
  margin-bottom: 20px;
}

.flagged-item h3 {
  margin: 10px 0;
}

.flagged-item .info {
  color: #666;
  font-size: small;
  margin-top: 10px;
}

.flagged-item .content-type-badge {
  background: #666;
  color: white;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 12px;
  text-transform: uppercase;
}

.flagged-item .actions {
  margin-top: 15px;
  display: flex;
  gap: 10px;
}

.flagged-item .actions form {
  display: inline;
}

.flagged-item .actions button {
  padding: 8px 16px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
}

.flagged-item .btn-approve {
  background: var(--btn-success);
  border-color: var(--btn-success);
  color: white;
}

.flagged-item .btn-approve:hover {
  background: var(--btn-success-hover);
  border-color: var(--btn-success-hover);
}

.flagged-item .btn-delete {
  background: var(--btn-danger);
  border-color: var(--btn-danger);
  color: white;
}

.flagged-item .btn-delete:hover {
  background: var(--btn-danger-hover);
  border-color: var(--btn-danger-hover);
}

/* ========================================
   NEWS PAGE
   ======================================== */
#news {
  max-width: 750px;
}

#news h1 {
  margin-top: 15px;
}

.headline {
  position: relative;
  border: var(--border-width) solid var(--card-border);
  border-radius: var(--border-radius);
  padding: var(--item-padding);
  background: var(--card-background);
  margin-bottom: var(--spacing-md);
}

.headline a {
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  color: var(--text-primary);
  transition: color var(--transition-fast);
}

.headline a:hover {
  color: var(--accent-color);
  text-decoration: none;
}

.headline .title {
  display: block;
  font-size: 1em;
  line-height: 1.4;
  margin: var(--spacing-sm) 0 0 0;
}

.headline .description {
  display: block;
  color: var(--text-secondary);
  font-size: 0.875em;
  line-height: var(--line-height);
  margin-bottom: var(--spacing-xs);
}

.headline .summary {
  font-size: 0.75em;
  margin-top: var(--spacing-sm);
  color: var(--text-muted);
}

.headline .summary a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.headline .summary a:hover {
  color: var(--accent-color);
  text-decoration: none;
}

.news {
  position: relative;
  border: var(--border-width) solid var(--card-border);
  border-radius: var(--border-radius);
  padding: var(--item-padding);
  background: var(--card-background);
  margin-bottom: var(--spacing-md);
}

.news a {
  text-decoration: none;
  color: var(--text-primary);
}

.news .cover {
  max-width: 200px;
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: var(--border-radius);
  margin-bottom: var(--spacing-sm);
}

.news .cover[src=""],
.news .cover:not([src]) {
  display: none;
}

.news .blurb {
  display: block;
}

.news .title {
  display: block;
  font-weight: bold;
  font-size: 1em;
  margin-bottom: 0;
}

.news .description {
  display: block;
  color: var(--text-secondary);
  font-size: 0.9em;
  margin-bottom: var(--spacing-xs);
}

.news .summary {
  font-size: 0.8em;
  margin-top: var(--spacing-sm);
  color: var(--text-secondary);
}

.news .summary a {
  color: var(--text-secondary);
  text-decoration: none;
}

.news .summary a:hover {
  text-decoration: underline;
}

/* News Article View */
#news-article h1 {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 1.8em;
}

#news-article .article-meta {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: 0.9em;
}

#news-article .article-image {
  max-width: 100%;
  max-height: 300px;
  width: auto;
  height: auto;
  object-fit: cover;
  border-radius: var(--border-radius);
  margin-bottom: 20px;
}

#news-article .article-summary {
  background-color: #f5f5f5;
  padding: 20px;
  border-radius: var(--border-radius);
  margin-bottom: 20px;
}

#news-article .article-summary h3 {
  margin-top: 0;
}

#news-article .article-summary > div {
  line-height: 1.6;
}

#news-article .article-description {
  margin-bottom: 20px;
  line-height: 1.6;
}

#news-article .article-actions {
  margin-top: 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

#news-article .article-actions a {
  color: var(--text-secondary);
}

#news-article .article-back {
  margin-top: 30px;
}

#news-article .article-back a {
  color: var(--text-secondary);
  text-decoration: none;
}

/* Reader content styling */
.reader-content {
  line-height: 1.7;
  font-size: 15px;
  color: var(--text-primary);
}

.reader-content p {
  margin: 0 0 16px;
}

.reader-content h1, .reader-content h2, .reader-content h3,
.reader-content h4, .reader-content h5, .reader-content h6 {
  margin: 24px 0 12px;
  line-height: 1.3;
}

.reader-content h1 { font-size: 1.6em; }
.reader-content h2 { font-size: 1.35em; }
.reader-content h3 { font-size: 1.15em; }

.reader-content ul, .reader-content ol {
  margin: 0 0 16px;
  padding-left: 24px;
}

.reader-content li {
  margin-bottom: 6px;
}

.reader-content blockquote {
  margin: 16px 0;
  padding: 12px 20px;
  border-left: 3px solid var(--border-color, #ddd);
  color: var(--text-secondary);
  background: var(--bg-secondary, #f8f8f8);
  border-radius: 4px;
}

.reader-content pre {
  margin: 16px 0;
  padding: 14px;
  background: var(--bg-secondary, #f5f5f5);
  border-radius: 6px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
}

.reader-content code {
  font-size: 0.9em;
  padding: 2px 5px;
  background: var(--bg-secondary, #f5f5f5);
  border-radius: 3px;
}

.reader-content pre code {
  padding: 0;
  background: none;
}

.reader-content a {
  color: var(--link-color, #1a73e8);
  text-decoration: underline;
}

.reader-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}

.reader-content th, .reader-content td {
  padding: 8px 12px;
  border: 1px solid var(--border-color, #ddd);
  text-align: left;
}

.reader-content th {
  background: var(--bg-secondary, #f5f5f5);
  font-weight: 600;
}

.reader-content hr {
  border: none;
  border-top: 1px solid var(--border-color, #ddd);
  margin: 24px 0;
}

.reader-content figure {
  margin: 16px 0;
}

.reader-content figcaption {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* Video info styling */
.thumbnail .info {
  font-size: 0.8em;
  margin-top: var(--spacing-sm);
  color: var(--text-secondary);
}

.thumbnail .info a {
  font-size: 1em; /* Inherit parent's 0.8em, don't compound with base a's 0.9em */
}

/* ========================================
   VIDEO PAGE
   ======================================== */
#video {
  max-width: 750px;
}

.thumbnail {
  position: relative;
  border: var(--border-width) solid var(--card-border);
  border-radius: var(--border-radius);
  padding: var(--item-padding);
  background: var(--card-background);
  margin-bottom: var(--spacing-md);
}

.thumbnail a {
  text-decoration: none;
  color: var(--text-primary);
}

.thumbnail img {
  max-width: 320px;
  width: 100%;
  border-radius: var(--border-radius);
  margin-bottom: var(--spacing-sm);
}

.thumbnail h3 {
  margin: var(--spacing-sm) 0;
  font-size: 1em;
}

.video {
  margin-bottom: var(--spacing-lg);
}

#video img {
  width: 100%;
  border-radius: 5px;
}

#video-search {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

#video-search input {
  flex: 1;
  min-width: 0;
}

#video-search button {
  flex-shrink: 0;
}

/* ========================================
   NEWS
   ======================================== */
#news-search {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

#news-search input {
  flex: 1;
  min-width: 0;
}

#news-search button {
  flex-shrink: 0;
}

/* ========================================
   MARKETS & REMINDER
   ======================================== */

/* Horizontal markets ticker */
.markets-ticker-container {
  margin-bottom: 15px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  /* Hide scrollbar for Chrome, Safari and Opera */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none;  /* IE and Edge */
}

.markets-ticker-container::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.markets-ticker {
  display: flex;
  gap: 15px;
  white-space: nowrap;
  padding: 10px 0;
}

.market-ticker {
  font-size: 0.85em;
  display: inline-block;
  flex-shrink: 0;
}

/* Legacy markets card styles (for /markets page) */
#markets, #reminder, #video {
  max-width: 100%;
  float: none;
  margin-right: 0;
}

.item {
  border: var(--border-width) solid var(--card-border);
  border-radius: var(--border-radius);
  padding: var(--item-padding);
  background: var(--card-background);
  margin-bottom: var(--spacing-md);
}

/* Professional market ticker grid */
.market-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.market-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 6px;
  background: var(--hover-background);
  border-radius: var(--border-radius);
  text-align: center;
}

.market-symbol {
  font-size: 0.75em;
  color: var(--text-muted);
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.02em;
}

.market-price {
  font-size: 0.75em;
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* ========================================
   AUTH PAGES
   ======================================== */
#login, #signup {
  max-width: 400px;
  margin: 0 auto;
}

#login input, #signup input {
  margin-bottom: 10px;
  width: 100%;
}

#login button, #signup button {
  width: 100%;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
.small {
  font-size: 0.8em;
  line-height: 1.4em;
  color: #666;
  font-weight: normal;
  display: block;
}

.text {
  display: block;
  font-size: 0.8em;
  margin-top: 10px;
}

.right {
  text-align: right;
}

.link {
  display: block;
  font-weight: 500;
  text-decoration: none;
  margin-top: 12px;
  color: var(--text-muted, #888);
  font-size: 13px;
}

.link:hover {
  color: var(--accent-color, #000);
  text-decoration: none;
}

.category,
.highlight,
a.category,
a.highlight {
  display: inline-block;
  color: var(--text-secondary) !important;
  font-size: 10px !important;
  font-weight: bold !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: transparent;
  padding: 0;
  border: none;
  text-decoration: none;
}

.category-header {
  margin-bottom: 8px;
}

.category-header .category {
  margin-bottom: 0;
}

.cover {
  width: 200px;
  height: auto;
  min-height: 100px;
  max-height: 300px;
  object-fit: cover;
  margin-right: 10px;
  margin-bottom: 10px;
  display: inline-block;
  border-radius: 3px;
  background: #1a1a1a;
}

.cover[src=""],
.cover:not([src]) {
  display: none;
}

.blurb {
  display: inline-block;
  vertical-align: top;
  max-width: 600px;
}

.blurb .text {
  font-size: 0.9em;
}

.title {
  font-size: 1.2em;
  font-weight: bold;
  display: block;
}

.description, .description a {
  font-size: 1em;
  font-weight: normal;
  white-space: pre-wrap;
}

.description iframe {
  display: none;
}

.verse {
  white-space: pre-wrap;
  margin-bottom: 0;
  font-size: 0.9em;
  overflow-y: scroll;
  max-height: 200px;
}
.video {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
}

/* ========================================
   MOBILE RESPONSIVE
   ======================================== */
/* Desktop: account for sidebar */
@media only screen and (min-width: 901px) {
  #nav-container ~ #content {
    padding-left: 240px; /* Account for fixed sidebar */
  }
}

/* Tablet/Mobile: hamburger menu with slide-out sidebar */
@media only screen and (max-width: 900px) {
  body {
    overflow-x: hidden;
  }
  
  /* Show hamburger menu button */
  #menu-toggle {
    display: flex;
  }

  #head {
    padding: 6px 15px;
    border-bottom: 1px solid #ddd;
    justify-content: center;
    position: fixed;
    height: 44px;
    box-sizing: border-box;
  }

  #head-mail.has-mail {
    display: block;
  }
  
  #brand a {
    font-size: 1em;
  }
  
  /* Sidebar hidden by default on mobile */
  #nav-container {
    position: fixed;
    left: -280px;
    top: 0;
    width: 260px;
    height: 100vh;
    height: 100svh;
    padding: 48px 20px 20px 20px;
    background: white;
    border-right: 1px solid #e0e0e0;
    z-index: 200;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
  }

  #nav {
    flex: 1;
    overflow-y: auto;
  }
  
  /* Show sidebar when menu is open */
  body.menu-open #nav-container {
    left: 0;
  }
  
  /* Show overlay when menu is open */
  body.menu-open #nav-overlay {
    display: block;
  }
  
  #nav {
    flex-direction: column;
    gap: 3px;
  }

  #nav a {
    padding: 8px 14px;
    flex-direction: row;
  }

  #nav img {
    margin-right: 14px;
    height: 22px;
    width: 22px;
  }

  .nav-divider {
    margin: 3px 0;
  }

  /* Starter query chips - slightly smaller on mobile */
  .starter-chip {
    font-size: 12px;
    padding: 5px 12px;
  }

  .nav-bottom {
    border-top: 1px solid var(--divider, #f0f0f0);
    padding-top: 10px;
    margin-top: auto;
    gap: 1px;
  }

  .nav-bottom a {
    padding: 6px 14px;
  }
  
  #container {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 44px);
    min-height: calc(100svh - 44px);
    padding-top: 44px;
    margin-top: 0;
  }
  
  #content {
    margin-left: 0;
    padding: 15px;
    max-width: 100%;
  }
  
  #page-title {
    text-align: center;
    font-size: 1.2em;
    margin-top: 0;
    margin-bottom: 8px;
    padding-top: 0;
  }
  
  #footer {
    padding: 20px 15px;
    margin-bottom: 0; /* No bottom bar anymore */
  }
  
  #main {
    max-width: 100%;
    padding: 15px;
    margin-top: 75px;
  }
  
  /* Blog styles */
  #blog .info {
    text-align: center;
  }
  #blog .post-item .info {
    text-align: left;
  }
  #blog .post-tags {
    text-align: center;
    margin-top: 8px;
    font-size: small;
  }
  #blog > div:first-child {
    text-align: center;
  }
  
  /* Topic selectors */
  .anchor {
    margin: 30px 0;
  }
  #topics, #topic-selector {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .topic-tabs, #topics {
    gap: 4px;
    flex-wrap: nowrap;
  }
  #topic-selector .head, #topics .head {
    font-size: 12px;
    white-space: nowrap;
    padding: 5px 0;
  }
  #chat-clear {
    position: static;
    display: block;
    text-align: right;
    margin-top: 4px;
  }
  
  /* Chat page adjustments */
  #messages {
    flex: 1 1 0;
    overflow-y: auto;
    min-height: 0;
    padding-bottom: 0;
    max-height: calc(100svh - 200px);
    -webkit-overflow-scrolling: touch;
  }
  #messages ~ #chat-form {
    margin-bottom: 0;
    flex-shrink: 0;
  }
  body:has(#messages) {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100svh; /* Use svh to prevent jump on keyboard open */
  }
  body:has(#messages) #container {
    overflow: hidden;
    height: 100svh;
    box-sizing: border-box;
  }
  body:has(#messages) #footer,
  body:has(#messages) #chat-back-link {
    display: none;
  }
  #chat-form {
    flex: 0 0 auto;
    background: white;
    padding-top: 10px;
    padding-bottom: 15px; /* Safe area for PWA/mobile */
    margin: 0;
  }
  
  /* Cards and content */
  .post-show {
    margin-top: 10px;
  }
  .card, #reminder, #video {
    float: none;
    display: block;
    width: 100%;
    min-width: auto;
    max-width: 100%;
    box-sizing: border-box;
  }
  #video-search {
    display: flex;
    max-width: 100%;
  }
  
  /* Home page layout — flatten columns on mobile for unified card ordering */
  #home {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: auto;
  }
  .home-left, .home-right {
    display: contents;
  }
  #home-date {
    justify-content: center;
  }

  /* Compact cards on mobile */
  .home-left .card, .home-right .card {
    padding: 12px;
    margin-bottom: 0;
    width: 100%;
    min-width: auto;
  }

  .home-left .card h3 {
    font-size: 14px;
    margin-bottom: 8px;
  }

  .home-left .card-link {
    font-size: 12px;
  }

  /* Card order on mobile — reminder first, then useful content */
  #reminder { order: 1; }
  #markets { order: 2; }
  #blog { order: 3; }
  #news { order: 4; }
  #social { order: 5; }
  #video { order: 6; }
  #home-chat { order: 7; }

  .cover {
    display: block;
  }
  
  /* Buttons on mobile */
  button, a.btn {
    min-height: 36px;
    padding: 6px 12px;
  }
  
  /* Prevent iOS zoom on input focus */
  input, textarea, select {
    font-size: 16px;
  }
  
  input[type="text"],
  input[type="email"],
  input[type="password"],
  textarea {
    -webkit-appearance: none;
    appearance: none;
  }
}

/* ========================================
   MAIL/MESSAGING
   ======================================== */
.thread-preview {
  padding: var(--item-padding);
  border-bottom: var(--border-width) solid var(--divider);
  position: relative;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.thread-preview:hover {
  background: var(--hover-background);
}

.thread-preview .delete-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  color: #ccc;
  text-decoration: none;
  font-size: 24px;
  line-height: 1;
}

/* Desktop: hide delete button, show on hover */
@media (min-width: 769px) {
  .thread-preview .delete-btn {
    display: none;
  }
  
  .thread-preview:hover .delete-btn {
    display: block;
  }
}

/* Mobile: always show delete button */
@media (max-width: 768px) {
  .thread-preview .delete-btn {
    display: block;
  }
}

/* Thread message card */
.thread-message {
  border: var(--border-width) solid var(--card-border);
  border-radius: var(--border-radius);
  padding: var(--item-padding);
  margin-bottom: var(--spacing-md);
  background: var(--card-background);
  max-width: 100%;
}

/* Reduce thread message padding on smaller screens */
@media only screen and (max-width: 900px) {
  .thread-message {
    padding: 10px;
  }
  
  .thread-message textarea,
  .thread-message input {
    max-width: 100%;
    box-sizing: border-box;
  }
}

.thread-message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.thread-message-header-text {
  flex: 1;
  min-width: 0;
}

.thread-message-author {
  color: #333;
  font-size: 14px;
  font-weight: bold;
}

.thread-message-time {
  color: #999;
  font-size: 13px;
}

.thread-message-delete {
  color: #ccc;
  font-size: 24px;
  text-decoration: none;
  line-height: 1;
  padding: 0 5px;
  flex-shrink: 0;
}

.thread-message-body {
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
  color: #333;
  max-width: 100%;
  overflow-x: auto;
}

/* Attachment blocks */
.attachment-block {
  background: #f8f9fa;
  border: var(--border-width) solid var(--card-border);
  border-radius: var(--border-radius);
  padding: 30px;
  margin: 15px 0;
  text-align: center;
}

.attachment-title {
  font-size: 16px;
  color: #495057;
  margin-bottom: 12px;
  font-weight: 500;
}

.attachment-size {
  color: #6c757d;
  font-size: 14px;
  margin-bottom: 20px;
}

.attachment-details {
  text-align: left;
  margin: 15px 0;
}

.attachment-summary {
  cursor: pointer;
  color: var(--text-primary);
  font-weight: var(--font-weight-medium);
  margin-bottom: 10px;
}

.attachment-content {
  background: white;
  padding: 15px;
  border-radius: 5px;
  overflow-x: auto;
  max-height: 400px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.6;
  margin-top: 10px;
  border: 1px solid #e0e0e0;
}

.attachment-download-btn {
  display: inline-block;
  background: var(--text-primary);
  color: white;
  padding: 12px 24px;
  border-radius: var(--border-radius);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
  margin-top: 10px;
}

.attachment-download-btn:hover {
  background: #333;
  color: white;
}

/* Links */
.mail-link {
  color: var(--text-primary);
  text-decoration: none;
}

.mail-link:hover {
  text-decoration: underline;
}

.mail-link-muted {
  color: #666;
  text-decoration: none;
}

.mail-link-muted:hover {
  color: #333;
}

/* Contenteditable placeholder styling */
[contenteditable][placeholder]:empty:before {
  content: attr(placeholder);
  color: #999;
  cursor: text;
}

[contenteditable]:focus {
  outline: none;
}

/* Status indicator */
#status-indicator {
  /* placeholder */
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Display */
.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }
.d-flex { display: flex; }

/* Flex utilities */
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

/* Gap */
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 10px; }
.gap-4 { gap: 15px; }
.gap-5 { gap: 20px; }

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Text colors */
.text-error { color: var(--btn-danger); }
.text-success { color: var(--btn-success); }
.text-warning { color: #d97706; }
.text-muted { color: var(--text-muted, #888); }
.text-secondary { color: var(--text-secondary, #666); }

/* Font size */
.text-xs { font-size: 12px; }
.text-sm { font-size: 13px; }
.text-base { font-size: 16px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 24px; }

/* Font weight */
.font-normal { font-weight: normal; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: bold; }

/* Font style */
.italic { font-style: italic; }

/* Whitespace */
.whitespace-pre-wrap { white-space: pre-wrap; }
.whitespace-nowrap { white-space: nowrap; }

/* Width */
.w-full { width: 100%; }
.w-auto { width: auto; }
.max-w-sm { max-width: 400px; }
.max-w-md { max-width: 500px; }
.max-w-lg { max-width: 600px; }
.max-w-xl { max-width: 750px; }

/* Margins */
.m-0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 5px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 10px; }
.mt-4 { margin-top: 15px; }
.mt-5 { margin-top: 20px; }
.mt-6 { margin-top: 30px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 5px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 10px; }
.mb-4 { margin-bottom: 15px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 30px; }
.ml-2 { margin-left: 8px; }
.ml-3 { margin-left: 10px; }
.ml-4 { margin-left: 15px; }
.mr-2 { margin-right: 8px; }
.mr-3 { margin-right: 10px; }

/* Padding */
.p-0 { padding: 0; }
.p-2 { padding: 8px; }
.p-3 { padding: 10px; }
.p-4 { padding: 15px; }
.p-5 { padding: 20px; }
.p-6 { padding: 30px; }
.p-10 { padding: 40px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.py-3 { padding-top: 10px; padding-bottom: 10px; }
.px-3 { padding-left: 10px; padding-right: 10px; }

/* Background */
.bg-light { background: #f9f9f9; }
.bg-lighter { background: #f5f5f5; }
.bg-success-light { background: #f0fff4; border-color: #22c55e; }
.bg-warning-light { background: #fffbeb; border-color: #f59e0b; }

/* Borders */
.border { border: 1px solid var(--card-border, #e0e0e0); }
.border-b { border-bottom: 1px solid var(--divider, #f0f0f0); }
.border-t { border-top: 1px solid var(--divider, #f0f0f0); }
.rounded { border-radius: var(--border-radius, 6px); }
.rounded-sm { border-radius: 3px; }
.rounded-lg { border-radius: 10px; }

/* Centering pattern */
.mx-auto { margin-left: auto; margin-right: auto; }
.center-card { max-width: 400px; margin: 50px auto; text-align: center; }
.center-card-md { max-width: 500px; margin: 50px auto; text-align: center; }

/* Form elements */
.form-input {
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  box-sizing: border-box;
}

.form-input::placeholder {
  color: #aaa;
}

.form-textarea {
  padding: 10px;
  font-family: 'Nunito Sans', serif;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 5px;
  resize: vertical;
}

.form-select {
  padding: 10px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 5px;
  background-color: white;
  cursor: pointer;
}

.form-label {
  display: block;
  margin-bottom: 5px;
}

.form-group {
  margin-bottom: 15px;
}

/* Message/alert boxes */
.alert {
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 15px;
}

.alert-error {
  color: #c00;
  background: #fff5f5;
}

.alert-success {
  color: #22c55e;
  background: #f0fff4;
}

.alert-info {
  color: #666;
  background: #f5f5f5;
}

/* Progress bar */
.progress {
  background: #eee;
  height: 6px;
  border-radius: 3px;
  margin: 10px 0;
}

.progress-bar {
  background: #000;
  height: 100%;
  border-radius: 3px;
}

/* Stats table (for wallet, admin, etc) */
.stats-table {
  width: 100%;
  font-size: 14px;
}

.stats-table td:last-child {
  text-align: right;
}

/* Data table with borders */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-bottom: 32px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
}

.data-table th {
  text-align: left;
}

.data-table td:last-child,
.data-table th:last-child {
  text-align: right;
}

.data-table tbody tr:nth-child(odd) {
  background: var(--hover-background);
}

/* Button styles */
/* Button variants */
a.btn-primary, .btn-primary {
  background: var(--btn-primary, #000);
  color: #fff !important;
  border-color: var(--btn-primary, #000);
}

a.btn-primary:hover, .btn-primary:hover {
  background: var(--btn-primary-hover, #333);
  border-color: var(--btn-primary-hover, #333);
  color: #fff !important;
}

a.btn-outline, .btn-outline {
  background: transparent;
  border: 1px solid var(--btn-primary, #000);
  color: var(--text-primary, #333) !important;
}

a.btn-outline:hover, .btn-outline:hover {
  background: var(--hover-background, #fafafa);
  color: var(--text-primary, #333) !important;
  text-decoration: none;
}

a.btn-secondary, .btn-secondary {
  background: var(--hover-background, #eee);
  color: var(--text-primary, #333) !important;
  border-color: var(--hover-background, #eee);
}

a.btn-secondary:hover, .btn-secondary:hover {
  background: #ddd;
  text-decoration: none;
}

/* Iframe container with aspect ratio */
.iframe-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  max-width: 100%;
  margin: 15px 0;
}

.iframe-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Vertical alignment */
.align-middle { vertical-align: middle; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* List reset */
.list-none { list-style: none; padding: 0; margin: 0; }

/* Options list (for plans, features, etc) */
.options-list {
  text-align: left;
  margin: 15px 0;
  list-style: none;
  padding: 0;
}

.options-list li {
  margin: 10px 0;
}

/* Cursor */
.cursor-pointer { cursor: pointer; }

/* Additional utilities */
.rounded { border-radius: var(--border-radius, 6px); }
.my-3 { margin-top: 10px; margin-bottom: 10px; }
.my-5 { margin-top: 20px; margin-bottom: 20px; }
.mx-2 { margin-left: 8px; margin-right: 8px; }

/* Blog form styles */
.blog-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.blog-form input,
.blog-form textarea,
.blog-form select {
  padding: 10px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 5px;
  box-sizing: border-box;
}

.blog-form textarea {
  font-family: 'Nunito Sans', serif;
  resize: vertical;
  min-height: 150px;
}

.blog-form select {
  background-color: white;
  cursor: pointer;
}

.blog-form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.blog-form-actions {
  display: flex;
  gap: 10px;
}

.blog-form-hint {
  font-size: 12px;
  color: #666;
}

/* Badge variant for private */
.badge-private {
  background-color: #d9534f;
  color: white;
}

/* Code/pre blocks */
.code-block {
  background: #f5f5f5;
  padding: 15px;
  border-radius: 5px;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.5;
}

.code-block-sm {
  background: #f5f5f5;
  padding: 10px;
  border-radius: 3px;
  overflow-x: auto;
  font-size: 11px;
  line-height: 1.4;
}

/* Mail compose form */
.mail-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mail-form input,
.mail-form textarea {
  padding: 10px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 5px;
  box-sizing: border-box;
}

.mail-form textarea {
  font-family: 'Nunito Sans', serif;
  resize: vertical;
  min-height: 200px;
}

.mail-reply-box {
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: 'Nunito Sans', serif;
  font-size: inherit;
  min-height: 100px;
  outline: none;
  background: white;
}

/* Additional text utilities */
.text-xs { font-size: 12px; }
.mr-1 { margin-right: 4px; }
.py-2 { padding-top: 8px; padding-bottom: 8px; }
.pt-3 { padding-top: 10px; }
.ml-2 { margin-left: 8px; }

/* Mail thread preview */
.mail-thread-item {
  margin-bottom: 4px;
}

.mail-thread-subject {
  font-size: 16px;
  font-weight: bold;
}

.mail-thread-meta {
  color: #666;
  font-size: 14px;
  margin-bottom: 4px;
}

.mail-thread-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mail-thread-preview {
  color: #999;
  font-size: 13px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-thread-time {
  color: #888;
  font-size: 12px;
  margin-left: 10px;
  flex-shrink: 0;
}

/* Legacy mail message item */
.mail-message-item {
  padding: 15px 0;
  border-bottom: 1px solid #eee;
}

.mail-message-item h3 {
  margin: 0 0 5px 0;
  font-size: 16px;
}

.mail-message-item h3 a {
  text-decoration: none;
  color: inherit;
}

.mail-message-body {
  margin-bottom: 5px;
  color: #666;
  font-size: 14px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Unread indicator */
.unread-dot {
  color: var(--text-primary);
  font-weight: bold;
}

/* ========================================
   CARD SYSTEM
   Reusable card components for all data types
   ======================================== */

/* Base card */
.card {
  background: var(--card-background, #fff);
  border: 1px solid var(--card-border, #e8e8e8);
  border-radius: var(--border-radius, 6px);
  padding: 16px;
  margin-bottom: 12px;
  transition: box-shadow 0.15s;
}
.card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* Card elements */
.card-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary, #1a1a1a);
  text-decoration: none;
  display: block;
  margin-bottom: 6px;
}
.card-title:hover {
  color: var(--accent-color, #000);
}
.card-desc, .card-preview {
  font-size: 14px;
  color: var(--text-secondary, #555);
  line-height: 1.5;
  margin-bottom: 8px;
}
.card-meta {
  font-size: 12px;
  color: var(--text-muted, #888);
}
.card-time {
  font-size: 12px;
  color: var(--text-muted, #888);
}
.card-author {
  font-size: 13px;
  color: var(--text-secondary, #666);
}
.card-category a {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent-color, #000);
  text-decoration: none;
  font-weight: 600;
}
.card-tags {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.card-tags .tag {
  padding: 2px 8px;
  background: var(--tag-background, #f0f0f0);
  border-radius: 10px;
  font-size: 11px;
  color: var(--text-secondary, #666);
}
.card-summary {
  font-size: 13px;
  color: var(--text-secondary, #666);
  line-height: 1.5;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--divider, #f0f0f0);
}
.card-content {
  font-size: 14px;
  color: var(--text-secondary, #555);
  line-height: 1.5;
  white-space: pre-wrap;
}
.card-pin {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 14px;
}
.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

/* Video card specifics */
.card-video {
  padding: 0;
  overflow: hidden;
}
.card-video .card-thumb {
  display: block;
  position: relative;
}
.card-video .card-thumb img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
}
.card-video .card-duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
}
.card-video .card-body {
  padding: 12px;
}

/* Note card colors */
.card-note { position: relative; }
.card-yellow { background: #fff9c4; border-color: #fff176; }
.card-green { background: #c8e6c9; border-color: #a5d6a7; }
.card-blue { background: #bbdefb; border-color: #90caf9; }
.card-pink { background: #f8bbd9; border-color: #f48fb1; }
.card-purple { background: #e1bee7; border-color: #ce93d8; }
.card-gray { background: #f5f5f5; border-color: #e0e0e0; }

/* Mail card */
.card-mail .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.card-mail .card-from {
  font-weight: 600;
}
.card-mail .card-subject {
  font-weight: 500;
  margin-bottom: 4px;
}
.card-mail.card-unread {
  border-left: 3px solid var(--accent-color, #000);
}

/* Market card */
.card-market {
  display: inline-block;
  padding: 10px 14px;
  min-width: 100px;
}
.card-market .card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.card-market .card-symbol {
  font-weight: 600;
}
.card-market .card-price {
  font-family: monospace;
}
.card-market .card-change {
  font-size: 13px;
  margin-top: 4px;
}
.card-market .card-up { color: var(--success-color, #28a745); }
.card-market .card-down { color: var(--error-color, #dc3545); }

/* Chat card */
.card-chat {
  padding: 12px;
}
.card-chat .card-header {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}
.card-chat.card-user {
  background: var(--hover-background);
}

/* Card grid layouts */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.card-grid .card {
  margin-bottom: 0;
  max-width: none;
}
.card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card-list .card {
  margin-bottom: 0;
}
.card-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.card-row .card {
  margin-bottom: 0;
}

/* ========================================
   PAGE LAYOUT
   Standard page structure components
   ======================================== */

.page-action {
  margin-bottom: 16px;
}

.page-filters {
  margin-bottom: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.page-filters .tag {
  padding: 4px 12px;
  background: var(--tag-background, #f0f0f0);
  border-radius: 20px;
  text-decoration: none;
  color: var(--text-secondary, #333);
  font-size: 13px;
}

.page-filters .tag.active {
  background: var(--accent-color, #000);
  color: white;
}

.page-filters .tag.clear {
  background: var(--hover-background, #ddd);
}

.view-toggle {
  font-size: 14px;
  color: var(--text-muted, #666);
  margin-left: auto;
}
.view-toggle a {
  color: var(--text-muted, #666);
  text-decoration: none;
}
.view-toggle a:hover {
  text-decoration: underline;
}

.mail-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--card-border, #e0e0e0);
  margin-bottom: 20px;
}
.mail-tab {
  padding: 10px 20px;
  text-decoration: none;
  color: var(--text-muted, #666);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.mail-tab:hover {
  color: var(--text-primary, #333);
}
.mail-tab.active {
  color: var(--text-primary, #333);
  border-bottom-color: var(--text-primary, #333);
}

/* Note editor */
.note-editor {
  max-width: 600px;
}
.note-editor input[type="text"] {
  width: 100%;
  padding: 8px 0;
  border: none;
  border-bottom: 1px solid #eee;
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 8px;
  outline: none;
}
.note-editor input[type="text"]:focus {
  border-bottom-color: var(--accent-color, #000);
}
.note-editor input[type="text"]::placeholder {
  color: #aaa;
  font-weight: normal;
}
.note-editor textarea {
  width: 100%;
  min-height: 200px;
  padding: 8px 0;
  border: none;
  font-size: 15px;
  font-family: inherit;
  line-height: 1.6;
  resize: none;
  outline: none;
}
.note-editor textarea::placeholder {
  color: #aaa;
}
.note-options-toggle {
  margin: 16px 0;
}
.note-options-toggle summary {
  font-size: 13px;
  color: #666;
  cursor: pointer;
}
.note-options {
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.note-options label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: #555;
}
.note-options input[type="checkbox"] {
  width: auto;
  margin: 0;
}
.note-options select {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
}
.note-options input[type="text"] {
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}
.note-actions {
  display: flex;
  gap: 15px;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid #eee;
  margin-top: 16px;
}
.note-actions a {
  color: #666;
  text-decoration: none;
  font-size: 14px;
}
.note-actions .delete-link {
  color: #c00;
}
#autosave-status {
  font-size: 13px;
  margin-left: auto;
}
.autosave-saving {
  color: #666;
}
.autosave-saved {
  color: #4caf50;
}
.autosave-error {
  color: #c00;
}

.revert-link {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  margin-left: 8px;
}
.revert-link:hover {
  text-decoration: underline;
}
.note-meta-info {
  margin-top: 16px;
  font-size: 13px;
  color: #999;
}

.error {
  color: #c00;
  padding: 10px;
  background: #fee;
  border-radius: 6px;
  margin-bottom: 15px;
}

/* Form groups */
.form-group {
  margin-bottom: 15px;
}
.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}
.form-group input[type="text"],
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 16px;
}
.form-group textarea {
  min-height: 120px;
}
.hint {
  font-size: 13px;
  color: #666;
  margin-top: 5px;
}
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Featured apps */
.featured-section {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--divider, #f0f0f0);
}
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  margin-top: 15px;
}
.featured-card {
  border: 2px solid var(--accent-color, #000);
  border-radius: var(--border-radius, 6px);
  padding: 20px;
  text-align: center;
  background: var(--card-background, #fff);
  transition: transform 0.15s ease;
}
.featured-card:hover {
  transform: translateY(-2px);
}
.featured-card h4 {
  margin: 0 0 8px 0;
}
.featured-card h4 a {
  text-decoration: none;
  color: var(--accent-color, #000);
}
.featured-card p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary, #555);
}

/* Card actions */
.card .actions {
  margin-top: 10px;
}
.card .actions a {
  margin-right: 15px;
  font-size: 13px;
}
.card .actions a.delete {
  color: #c00;
}

/* Code editor / preview */
.code-editor {
  font-family: monospace;
  font-size: 13px;
  min-height: 300px;
}
.preview-frame {
  width: 100%;
  height: 400px;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-top: 20px;
}
.button-secondary {
  background: var(--text-muted, #666);
  border-color: var(--text-muted, #666);
  margin-left: 10px;
}
.button-secondary:hover {
  background: var(--text-secondary, #555);
  border-color: var(--text-secondary, #555);
}

/* Video thumbnails */
.thumbnail {
  margin-bottom: 20px;
}

/* Recent searches */
.recent-searches {
  margin-bottom: 20px;
}
.recent-searches h3 {
  margin-bottom: 10px;
  white-space: normal;
}
.recent-search-item {
  display: inline-block;
  margin: 5px 10px 5px 0;
  padding: 5px 10px;
  background-color: #f0f0f0;
  border-radius: 5px;
  text-decoration: none;
  color: #333;
  cursor: pointer;
  white-space: nowrap;
}
.recent-search-item:hover {
  background-color: #e0e0e0;
}
.recent-search-item.active {
  background-color: #333;
  color: white;
}
.recent-search-item.active .recent-search-close {
  color: #ccc;
}
.recent-search-item.active .recent-search-close:hover {
  color: white;
}
.recent-search-label {
  margin-right: 8px;
}
.recent-search-close {
  display: inline-block;
  padding: 0 6px;
  color: #666;
  cursor: pointer;
  font-weight: bold;
}
.recent-search-close:hover {
  color: #000;
}

/* Wallet deposit page */
.deposit-address {
  font-family: monospace;
  font-size: 13px;
  word-break: break-all;
  background: #f5f5f5;
  padding: 12px;
  border-radius: 6px;
  display: block;
  margin: 10px 0;
}

.qr-code {
  display: block;
  margin: 15px 0;
  border-radius: 8px;
}

#send-section input[type="number"] {
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.btn-success {
  background: #22c55e;
  color: white;
}

/* =============================================
   Admin Styles
   ============================================= */

.admin-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 400px;
}
.admin-links a {
  padding: 12px 16px;
  background: var(--card-background, #fff);
  border: 1px solid var(--card-border, #e8e8e8);
  border-radius: var(--border-radius, 6px);
  text-decoration: none;
  color: var(--text-primary, #333);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.admin-links a:hover {
  background: var(--hover-background, #fafafa);
}
.admin-links .count {
  color: var(--text-muted, #888);
  font-size: 14px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}
.admin-table th {
  text-align: left;
  padding: 10px;
  border-bottom: 2px solid #ddd;
}
.admin-table td {
  padding: 10px;
  border-bottom: 1px solid #eee;
}
.admin-table .center {
  text-align: center;
}
@media only screen and (max-width: 600px) {
  .admin-table {
    font-size: 0.85em;
  }
  .admin-table th, .admin-table td {
    padding: 5px 3px;
  }
  .admin-table .created-col {
    display: none;
  }
  .admin-table .delete-btn {
    padding: 3px 6px !important;
    font-size: 0.8em !important;
  }
}

/* Blocklist */
.blocklist-section {
  margin: 20px 0;
}
.blacklist-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
}
.blacklist-table th {
  text-align: left;
  padding: 10px;
  border-bottom: 2px solid #ddd;
}
.blacklist-table td {
  padding: 10px;
  border-bottom: 1px solid #eee;
}
.block-form {
  margin: 20px 0;
  padding: 15px;
  background: #f9f9f9;
  border-radius: 5px;
}
.block-form form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.block-form input[type="text"] {
  padding: 8px;
  width: 300px;
  max-width: 100%;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 14px;
  flex: 1;
  min-width: 200px;
}

/* Email log table */
.email-log {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.email-log th {
  text-align: left;
  padding: 8px;
  border-bottom: 2px solid #ddd;
}
.email-log td {
  padding: 8px;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}
.email-log .dir-in {
  color: #22c55e;
}
.email-log .dir-out {
  color: #3b82f6;
}
.email-log .dir-int {
  color: #666;
}
.email-log .subject {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.email-log .addr {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: monospace;
  font-size: 12px;
}
@media (max-width: 600px) {
  .email-log {
    font-size: 12px;
  }
  .email-log th, .email-log td {
    padding: 6px 4px;
  }
  .email-log .hide-mobile {
    display: none;
  }
  .email-log .subject {
    max-width: 120px;
  }
  .email-log .addr {
    max-width: 80px;
    font-size: 11px;
  }
}

/* =============================================
   Agent Styles
   ============================================= */


/* =============================================
   Status Page Styles
   ============================================= */

.status-page {
  max-width: 600px;
}
.status-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 30px;
}
.status-ok {
  color: #4caf50;
}
.status-error {
  color: #f44336;
}
.status-warn {
  color: #ff9800;
}
.status-section {
  margin-bottom: 30px;
}
.status-section h3 {
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
  margin-bottom: 15px;
}
.status-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f5f5f5;
}
.status-item:last-child {
  border-bottom: none;
}
.status-name {
  font-weight: 500;
}
.status-value {
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-icon {
  font-size: 16px;
}
.status-details {
  color: #666;
  font-size: 13px;
}
.system-info {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}
.system-info-item {
  background: #f9f9f9;
  padding: 15px;
  border-radius: 8px;
}
.system-info-label {
  font-size: 12px;
  color: #666;
  text-transform: uppercase;
}
.system-info-value {
  font-size: 18px;
  font-weight: 600;
  margin-top: 5px;
}

/* =============================================
   Apps Styles
   ============================================= */

.develop-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.preview-section {
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.preview-frame {
  width: 100%;
  height: 400px;
  border: none;
  display: block;
}
.instruction-section {
  background: #f9f9f9;
  padding: 20px;
  border-radius: 8px;
}
.instruction-input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 15px;
  font-family: inherit;
  margin-bottom: 10px;
  box-sizing: border-box;
}
.instruction-input:disabled {
  background: #eee;
}
.history {
  margin-top: 15px;
  font-size: 13px;
  color: #666;
}
.history ul {
  margin: 5px 0 0 20px;
  padding: 0;
}
.history li {
  margin: 3px 0;
}
.version-history {
  margin-top: 15px;
  font-size: 13px;
  color: #666;
  padding-top: 15px;
  border-top: 1px solid #eee;
}
.version-history ul {
  margin: 5px 0 0 0;
  padding: 0;
  list-style: none;
}
.version-history li {
  margin: 5px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.version-label {
  flex: 1;
}
.version-time {
  color: #999;
  font-size: 12px;
}
.revert-btn {
  padding: 2px 8px;
  font-size: 12px;
  background: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 3px;
  cursor: pointer;
}
.revert-btn:hover {
  background: #eee;
}
.meta-section {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #ddd;
  flex-wrap: wrap;
}
.meta-section input[type="text"] {
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  width: auto;
}
.checkbox-group {
  display: flex;
  align-items: center;
  gap: 5px;
}
.checkbox-group input[type="checkbox"] {
  width: auto;
}
.code-toggle {
  margin-top: 15px;
}
.code-toggle summary {
  cursor: pointer;
  color: #666;
  font-size: 13px;
}
.code-editor {
  width: 100%;
  min-height: 300px;
  font-family: monospace;
  font-size: 12px;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-top: 10px;
  box-sizing: border-box;
}

.app-frame {
  width: 100%;
  height: 500px;
  border: 1px solid var(--card-border, #e8e8e8);
  border-radius: var(--border-radius, 6px);
  background: white;
}
.widget-btn {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 4px;
  text-decoration: none;
  font-size: small;
}
.widget-btn.add {
  background: var(--btn-primary, #000);
  color: white;
}
.widget-btn.remove {
  background: #eee;
  color: #333;
}
.app-info {
  color: #666;
  font-size: small;
  margin-bottom: 15px;
}
.app-info a {
  color: #666;
  text-decoration: none;
}
.app-info a:hover {
  text-decoration: underline;
}

/* =============================================
   Docs Styles
   ============================================= */

.docs-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 10px 0;
}
.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.docs-card {
  padding: 20px;
  border: 1px solid #ddd;
  border-radius: 8px;
}
.docs-card h4 {
  margin: 0 0 8px 0;
}
.docs-card p {
  margin: 0;
  color: #666;
  font-size: 14px;
}
.docs-category {
  margin-top: 30px;
}
.docs-category:first-child {
  margin-top: 0;
}
.docs-category h3 {
  margin-bottom: 15px;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

/* =============================================
   Video Player Embed
   ============================================= */

.video-player-body {
  margin: 0;
  padding: 0;
  background: #000;
  overflow: hidden;
}
.video-embed {
  position: relative;
  width: 100%;
  height: calc(100vh - 48px);
}
.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}
.video-embed.audio-only iframe {
  clip-path: inset(100%);
  pointer-events: none;
}
.video-bar {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: #111;
}
.video-bar button {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.video-bar button:active {
  background: rgba(255,255,255,0.25);
}
.video-bar #playBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
}
.video-bar span {
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}
.audio-vis {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #000;
  align-items: center;
  justify-content: center;
  gap: 6px;
  z-index: 10;
}
.audio-vis span {
  display: inline-block;
  width: 8px;
  background: #fff;
  border-radius: 4px;
  animation: audiovis 1s ease-in-out infinite alternate;
}
.audio-vis span:nth-child(1){ height:20px; animation-delay:0s; }
.audio-vis span:nth-child(2){ height:35px; animation-delay:.2s; }
.audio-vis span:nth-child(3){ height:50px; animation-delay:.4s; }
.audio-vis span:nth-child(4){ height:35px; animation-delay:.6s; }
.audio-vis span:nth-child(5){ height:20px; animation-delay:.8s; }
@keyframes audiovis {
  from { transform: scaleY(1); }
  to   { transform: scaleY(3); }
}

/* =============================================
   Pricing Page
   ============================================= */

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 40px;
}
@media (max-width: 700px) {
  .pricing-grid {
    grid-template-columns: 1fr;
  }
}
.pricing-grid .card {
  margin-bottom: 0;
}

/* Topup options */
.topup-option {
  display: block;
  padding: 12px 16px;
  border: 1px solid var(--card-border, #e8e8e8);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.topup-option:hover {
  border-color: var(--text-primary, #333);
  background: var(--card-background, #fafafa);
}

.topup-option input[type="radio"] {
  display: none;
}

.topup-option:has(input:checked) {
  border-color: var(--text-primary, #333);
  background: var(--card-background, #f5f5f5);
}

/* Toast notifications */
.mu-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 40px 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: toastIn 0.3s ease;
  max-width: 90%;
}

.mu-toast-info {
  background: #333;
  color: white;
}

.mu-toast-success {
  background: #28a745;
  color: white;
}

.mu-toast-error {
  background: #dc3545;
  color: white;
}

.mu-toast-close {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 18px;
  opacity: 0.7;
}

.mu-toast-close:hover {
  opacity: 1;
}

.mu-toast-hide {
  animation: toastOut 0.3s ease forwards;
}

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

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

/* ========================================
   MARKETS PAGE
   ======================================== */
.markets-page {
  max-width: 750px;
}

.markets-page .description {
  margin-bottom: 20px;
  color: var(--text-muted);
  font-size: 0.85em;
}

.markets-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.markets-tab {
  display: inline-block;
  color: var(--accent-color) !important;
  font-size: 10px !important;
  font-weight: bold !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: transparent;
  padding: 0;
  border: none;
  text-decoration: none;
  margin-right: 8px;
  transition: color var(--transition-fast);
}

.markets-tab:hover {
  text-decoration: underline;
}

.markets-tab.active {
  text-decoration: underline;
}

.markets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.market-card {
  border: var(--border-width) solid var(--card-border);
  border-radius: var(--border-radius);
  padding: var(--item-padding);
  background: var(--card-background);
  box-shadow: var(--shadow-sm);
}

.market-card:hover {
  border-color: var(--accent-color, #000);
}

.market-card-header {
  margin-bottom: 8px;
}

.market-card .market-symbol {
  font-size: 0.85em;
  font-weight: var(--font-weight-bold);
  color: var(--text-primary);
  letter-spacing: 0.05em;
}

.market-card-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.market-card .market-price {
  font-size: 0.9em;
  font-weight: var(--font-weight-semibold);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* Markets table */
.markets-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 0.9em;
}

.markets-table th {
  text-align: left;
  padding: 8px 12px;
  font-size: 0.75em;
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: var(--border-width) solid var(--border-color);
}

.markets-table td {
  padding: 10px 12px;
  border-bottom: var(--border-width) solid var(--border-color);
  font-variant-numeric: tabular-nums;
}

.markets-table tr:last-child td {
  border-bottom: none;
}

.markets-symbol {
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.05em;
}

.markets-price {
  font-weight: var(--font-weight-semibold);
}

.markets-change {
  font-weight: var(--font-weight-semibold);
}

.markets-change-up {
  color: var(--success-color, #28a745);
}

.markets-change-down {
  color: var(--error-color, #dc3545);
}

.markets-change-neutral {
  color: var(--text-muted);
}

.markets-chart-link {
  font-size: 0.8em;
  color: var(--accent-color) !important;
  text-decoration: none;
  white-space: nowrap;
}

.markets-chart-link:hover {
  text-decoration: underline;
}

.markets-footer {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.8em;
}

.markets-source {
  margin-bottom: 5px;
}

.markets-note {
  margin-top: 5px;
  font-style: italic;
}

@media (max-width: 768px) {
  .markets-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
  }
  .markets-table {
    font-size: 0.8em;
  }
  .markets-table th,
  .markets-table td {
    padding: 8px 6px;
  }
}

/* Places page */
.places-page {
  max-width: 100%;
}

.places-search-card {
  margin-bottom: 16px;
}

.places-search-card input[type="text"],
.places-search-card select {
  width: 100%;
  margin-bottom: 10px;
  box-sizing: border-box;
}

.places-location-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0;
}

.places-location-row input[type="text"] {
  flex: 1;
  min-width: 180px;
  margin-bottom: 0;
}

.places-options-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.places-options-row select {
  flex: 1;
  min-width: 140px;
  margin-bottom: 0;
}

.places-actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.places-actions-row button {
  flex: 1;
}

.places-forms {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .places-forms {
    grid-template-columns: 1fr;
  }
  .places-location-row {
    flex-direction: column;
    align-items: stretch;
  }
  .places-location-row input[type="text"] {
    min-width: unset;
    margin-bottom: 8px;
  }
  .places-options-row {
    flex-direction: column;
  }
  .places-options-row select {
    min-width: unset;
  }
}

.places-forms .card {
  margin: 0;
}

.places-forms input,
.places-forms select {
  width: 100%;
  margin-bottom: 8px;
}

.places-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.place-card {
  margin: 0;
}

.place-card h4 {
  margin: 0 0 6px 0;
  font-size: 1em;
}

.place-category {
  display: inline-block;
  background: var(--accent-color);
  color: #fff;
  font-size: 0.75em;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
  text-transform: capitalize;
}

.place-address {
  font-size: 0.85em;
  margin: 4px 0 0;
}

.cost-badge {
  display: inline-block;
  background: var(--text-secondary);
  color: #fff;
  font-size: 0.7em;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  vertical-align: middle;
}

/* Places city grid */
.city-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 20px;
}

.city-link {
  display: inline-block;
  padding: 6px 12px;
  background: var(--bg-secondary, #f5f5f5);
  border-radius: 20px;
  text-decoration: none;
  color: inherit;
  font-size: 0.9em;
  border: 1px solid var(--border-color, #ddd);
  transition: background 0.15s;
}

.city-link:hover {
  background: var(--accent-color);
  color: #fff;
  border-color: var(--accent-color);
}

.places-form-desc {
  margin-top: 0;
  font-size: 0.85em;
}

.type-filter-btn {
  margin: 5px;
}
/* ========================================
   WEATHER PAGE
   ======================================== */

.weather-controls {
  gap: 8px;
  margin-bottom: 16px;
}

.weather-options {
  margin-bottom: 20px;
  font-size: 0.9em;
  color: var(--text-secondary);
}

.weather-current {
  display: inline-block;
  margin-bottom: 20px;
  min-width: 180px;
}

.weather-temp {
  font-size: 3em;
  font-weight: 700;
  line-height: 1;
}

.weather-desc {
  font-size: 1.1em;
  color: var(--text-secondary);
  margin-top: 4px;
}

.weather-hourly-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 20px;
}

.weather-hour-card {
  flex: 0 0 auto;
  min-width: 70px;
  text-align: center;
  background: var(--hover-background);
  border: 1px solid var(--card-border);
  border-radius: var(--border-radius);
  padding: 8px 6px;
}

.weather-hour-time {
  font-size: 0.75em;
  color: var(--text-muted);
}

.weather-hour-temp {
  font-size: 1.1em;
  font-weight: 700;
  margin: 4px 0;
}

.weather-hour-desc {
  font-size: 0.7em;
  color: var(--text-secondary);
  line-height: 1.2;
}

.weather-hour-rain {
  font-size: 0.7em;
  color: #2980b9;
  margin-top: 2px;
}

.weather-table {
  width: 100%;
  margin-bottom: 20px;
}

.weather-search-form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.weather-search-input {
  flex: 1;
  min-width: 0;
}

.weather-or {
  color: var(--text-muted);
}

.table-scroll {
  overflow-x: auto;
  margin-bottom: 20px;
}

.table-scroll .weather-table {
  margin-bottom: 0;
}

@media (max-width: 600px) {
  .weather-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .weather-or {
    display: none;
  }

  .weather-search-form {
    width: 100%;
  }
}

/* =============================================
   Admin Mobile Styles
   ============================================= */

/* Deploy controls */
#deploy-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* Spam filter settings table */
.spam-settings table {
  width: 100%;
}
.spam-settings td {
  padding: 8px 6px;
  vertical-align: middle;
}
.spam-section {
  margin-top: 24px;
}

/* Blacklist tables - action column */
.blacklist-table td.text-center,
.blacklist-table th.text-center {
  white-space: nowrap;
}

@media (max-width: 600px) {
  /* Block forms: stack input and button vertically with margin */
  .block-form form {
    flex-direction: column;
  }
  .block-form input[type="text"] {
    width: 100%;
    min-width: 0;
  }
  .block-form button {
    align-self: flex-start;
    margin-top: 4px;
  }

  /* Spam filter settings: stack each row */
  .spam-settings table,
  .spam-settings thead,
  .spam-settings tbody,
  .spam-settings tr,
  .spam-settings td {
    display: block;
    width: 100%;
  }
  .spam-settings tr {
    padding: 10px 0;
    border-bottom: 1px solid #eee;
  }
  .spam-settings td {
    padding: 2px 0;
  }
  .spam-settings td form {
    margin-top: 4px;
  }
  .spam-settings td input[type="number"] {
    width: 60px;
  }

  /* Blacklist / spam tables: allow horizontal scroll */
  .blacklist-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .blacklist-table th,
  .blacklist-table td {
    padding: 8px 6px;
  }

  /* Deploy controls: full-width buttons */
  #deploy-controls {
    flex-direction: column;
  }
  #deploy-controls button {
    width: 100%;
  }

  /* Status page: system info single column */
  .system-info {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   DISPLAY / KIOSK MODE
   Activated via ?mode=display on /home
   Hides nav, header, footer for wall-mounted displays
   ============================================ */
body.display-mode #head,
body.display-mode #nav-container,
body.display-mode #nav-overlay,
body.display-mode #footer,
body.display-mode #menu-toggle,
body.display-mode #page-title,
body.display-mode #home-status-form,
body.display-mode #head-mail {
  display: none !important;
}

body.display-mode #container {
  margin: 0;
  padding: 0;
  max-width: 100%;
}

body.display-mode #content {
  margin: 0;
  padding: 16px;
  max-width: 100%;
}

body.display-mode #home {
  gap: 16px;
}

body.display-mode .card {
  font-size: 15px;
}

body.display-mode .card h4 {
  font-size: 16px;
}

/* Typing indicator animation */
.typing-dot {
  display: inline-block;
  animation: typingBounce 1.2s infinite;
  font-size: 20px;
  margin: 0 1px;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* Console prompt mobile optimisation */
#console-prompt {
  max-width: 100%;
  box-sizing: border-box;
}
#console-input {
  min-height: 44px;
}
#console-response {
  overflow-x: auto;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
#console-response pre {
  overflow-x: auto;
  max-width: 100%;
}
.console-suggest {
  flex-shrink: 0;
}
@media (max-width: 480px) {
  #console-prompt {
    padding-top: 12px !important;
  }
  #console-input {
    font-size: 15px !important;
    padding: 12px 40px 12px 12px !important;
  }
  #console-suggestions {
    gap: 4px !important;
  }
  .console-suggest {
    padding: 5px 10px !important;
    font-size: 12px !important;
  }
  #console-response {
    padding: 12px !important;
    font-size: 14px;
  }
}
