:root {
  --bg-base: #090b10;
  --bg-surface: #0f131c;
  --bg-card: rgba(18, 23, 34, 0.75);
  --bg-card-hover: rgba(26, 33, 49, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(255, 200, 50, 0.35);

  --gold-primary: #ffc832;
  --gold-hover: #ffd75a;
  --gold-dim: rgba(255, 200, 50, 0.15);
  --gold-glow: 0 0 25px rgba(255, 200, 50, 0.25);

  --cyan-primary: #38bdf8;
  --cyan-dim: rgba(56, 189, 248, 0.15);

  --emerald-primary: #10b981;
  --emerald-dim: rgba(16, 185, 129, 0.15);

  --ruby-primary: #f43f5e;
  --ruby-dim: rgba(244, 63, 94, 0.15);

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --font-sans: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-base);
  background-image: 
    radial-gradient(at 0% 0%, rgba(255, 200, 50, 0.06) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(56, 189, 248, 0.05) 0px, transparent 50%),
    linear-gradient(180deg, #090b10 0%, #0d1117 100%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: #334155;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(15, 19, 28, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(255,200,50,0.2), rgba(255,160,0,0.05));
  border: 1px solid rgba(255,200,50,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--gold-glow);
}

.brand-logo svg {
  width: 22px;
  height: 22px;
}

.brand-text h1 {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 1;
}

.brand-text h1 span {
  color: var(--gold-primary);
}

.brand-badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--gold-primary);
  opacity: 0.85;
}

.system-status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}

.status-dot.online {
  background: var(--emerald-primary);
  box-shadow: 0 0 10px var(--emerald-primary);
}

.status-dot.offline {
  background: var(--ruby-primary);
}

.status-dot.pulse {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.8; }
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.35);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  gap: 4px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.nav-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
  background: rgba(255, 200, 50, 0.15);
  color: var(--gold-primary);
  border: 1px solid rgba(255, 200, 50, 0.3);
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.clock-display {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--cyan-primary);
  background: var(--cyan-dim);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #ffc832 0%, #e5a812 100%);
  color: #0b0d13;
  box-shadow: 0 4px 15px rgba(255, 200, 50, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #ffd75a 0%, #ffc832 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255, 200, 50, 0.4);
}

.btn-gold {
  background: rgba(255, 200, 50, 0.15);
  color: var(--gold-primary);
  border: 1px solid rgba(255, 200, 50, 0.4);
}

.btn-gold:hover {
  background: rgba(255, 200, 50, 0.25);
  color: #fff;
  border-color: var(--gold-primary);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* Main Container */
.app-container {
  flex: 1;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 28px;
}

/* Banner */
.active-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(90deg, rgba(255, 200, 50, 0.12), rgba(56, 189, 248, 0.08));
  border: 1px solid rgba(255, 200, 50, 0.35);
  padding: 14px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.active-banner.hidden {
  display: none;
}

.banner-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255, 200, 50, 0.2);
  border-top-color: var(--gold-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.banner-text {
  display: flex;
  flex-direction: column;
}

.banner-text strong {
  color: var(--gold-primary);
  font-size: 14px;
}

.banner-text span {
  color: var(--text-muted);
  font-size: 12px;
}

/* Tab Panes */
.tab-pane {
  display: none;
  animation: fadeIn 0.3s ease;
}

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

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

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.stat-icon {
  font-size: 32px;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-value {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 1.1;
  margin: 2px 0;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-dim);
}

.gold-glow .stat-value { color: var(--gold-primary); }
.cyan-glow .stat-value { color: var(--cyan-primary); }
.text-emerald { color: var(--emerald-primary); }
.text-ruby { color: var(--ruby-primary); }

/* Generic Card */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-title h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
}

/* Timeline */
.timeline-card {
  background: linear-gradient(180deg, rgba(18,23,34,0.85) 0%, rgba(13,17,25,0.95) 100%);
}

.next-slot-badge {
  font-size: 13px;
  color: var(--text-muted);
  background: rgba(255, 200, 50, 0.1);
  border: 1px solid rgba(255, 200, 50, 0.3);
  padding: 6px 14px;
  border-radius: var(--radius-full);
}

.next-slot-badge strong {
  color: var(--gold-primary);
}

.slots-timeline {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 10px;
  padding: 10px 0;
}

.slot-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  padding: 12px 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  cursor: pointer;
  user-select: none;
}

.slot-item:hover {
  transform: translateY(-3px);
  border-color: var(--gold-primary);
  box-shadow: 0 4px 15px rgba(255, 200, 50, 0.2);
}

.slot-item .slot-time {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

.slot-item .slot-tag {
  font-size: 10px;
  font-weight: 600;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.slot-item.past {
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.05);
}
.slot-item.past .slot-time { color: var(--emerald-primary); }
.slot-item.past .slot-tag { background: var(--emerald-dim); color: var(--emerald-primary); }

.slot-item.next {
  border-color: var(--gold-primary);
  background: rgba(255, 200, 50, 0.15);
  box-shadow: 0 0 15px rgba(255, 200, 50, 0.3);
  transform: scale(1.05);
}
.slot-item.next .slot-time { color: var(--gold-primary); }
.slot-item.next .slot-tag { background: var(--gold-primary); color: #000; font-weight: 800; }

.slot-item.upcoming {
  opacity: 0.6;
}

/* Daily Slot Breakdown Grid */
.slots-report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}

.slot-report-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: var(--transition);
  cursor: pointer;
}

.slot-report-card:hover {
  border-color: rgba(255, 200, 50, 0.4);
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.02);
}

.slot-report-card.active-slot {
  border-color: var(--emerald-primary);
  background: rgba(16, 185, 129, 0.04);
}

.slot-report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.slot-report-time {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 800;
  color: var(--gold-primary);
}

.slot-report-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--emerald-dim);
  color: var(--emerald-primary);
}

.slot-report-badge.upcoming {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
}

.slot-report-summary {
  font-size: 12px;
  color: var(--text-main);
  line-height: 1.4;
}

.slot-report-metrics {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.slot-report-metrics span strong {
  color: var(--cyan-primary);
}

.slot-modal-section {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.slot-modal-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.slot-modal-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--gold-primary);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.link-pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cyan-primary);
  background: var(--cyan-dim);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  margin: 3px 0;
  word-break: break-all;
}
.link-pill:hover {
  text-decoration: underline;
}

/* Data Table */
.tasks-table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  padding: 12px 16px;
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge-running {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--emerald-dim);
  color: var(--emerald-primary);
  font-weight: 700;
  font-size: 11px;
}

/* Upcoming Posts Grid */
.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-toolbar h2 {
  font-size: 20px;
  font-weight: 800;
}

.section-toolbar .subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 2px;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.post-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 200, 50, 0.4);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.post-card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #000;
  overflow: hidden;
}

.post-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.post-card:hover .post-card-thumb img {
  transform: scale(1.03);
}

.post-card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  color: var(--gold-primary);
  font-size: 10px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 200, 50, 0.3);
}

.post-card-content {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-card-slug {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cyan-primary);
  margin-bottom: 8px;
  word-break: break-all;
}

.post-card-caption {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-card-actions {
  margin-top: auto;
  display: flex;
  gap: 8px;
}

/* History Column Layout */
.history-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.published-list, .log-entries-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 700px;
  overflow-y: auto;
  padding-right: 6px;
}

.published-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.published-item:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 200, 50, 0.3);
}

.published-thumb {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #000;
}

.published-details {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.published-slug {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.published-time {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.log-item {
  padding: 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.log-item-header {
  color: var(--gold-primary);
  font-weight: 700;
  margin-bottom: 6px;
  font-family: var(--font-mono);
}

.log-item-content {
  color: var(--text-muted);
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.4;
}

/* Rules Bento Grid */
.rules-bento {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.rule-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.rule-card:hover {
  border-color: rgba(255, 200, 50, 0.4);
  transform: translateY(-2px);
}

.rule-number {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 32px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.05);
}

.rule-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--gold-primary);
  margin-bottom: 8px;
}

.rule-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Console Terminal */
.console-card {
  padding: 0;
  overflow: hidden;
  border-color: rgba(255, 255, 255, 0.12);
}

.console-card .card-header {
  padding: 16px 20px;
  margin-bottom: 0;
  background: #090c12;
  border-bottom: 1px solid var(--border-subtle);
}

.console-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.toggle-label {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.terminal-body {
  background: #05070a;
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #10b981;
  height: 650px;
  overflow-y: auto;
  line-height: 1.6;
}

.terminal-line {
  word-break: break-all;
  white-space: pre-wrap;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.open {
  display: flex;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid rgba(255, 200, 50, 0.4);
  border-radius: var(--radius-lg);
  max-width: 900px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--gold-primary);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-dim);
  cursor: pointer;
}

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

.modal-body {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  padding: 24px;
  overflow-y: auto;
}

.modal-img-col img {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.modal-info-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.meta-group label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 6px;
}

.code-box {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--text-main);
  max-height: 180px;
  overflow-y: auto;
}

.text-gold {
  color: var(--gold-primary);
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  background: #1e293b;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  animation: slideIn 0.3s ease;
}

.toast.success {
  border-color: var(--emerald-primary);
  background: #064e3b;
}

.toast.error {
  border-color: var(--ruby-primary);
  background: #881337;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* History Layout & Items */
.history-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.history-column {
  display: flex;
  flex-direction: column;
}

.published-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 6px;
}

.published-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: var(--transition);
}

.published-item:hover {
  border-color: rgba(255, 200, 50, 0.3);
  transform: translateY(-2px);
}

.published-thumb {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  object-fit: cover;
  background: #111;
  border: 1px solid rgba(255,255,255,0.1);
}

.published-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.published-slug {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.published-time {
  font-size: 11px;
  color: var(--text-muted);
}

.log-entries-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 6px;
}

.log-item {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: var(--transition);
}

.log-item:hover {
  border-color: rgba(0, 242, 254, 0.3);
}

.log-item-header {
  font-size: 12px;
  font-weight: 800;
  color: var(--gold-primary);
  margin-bottom: 8px;
  line-height: 1.4;
  word-break: break-word;
}

.log-item-content {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.25);
  padding: 8px 10px;
  border-radius: 4px;
  border-left: 2px solid var(--border-subtle);
}

.log-item-content a {
  color: var(--cyan-primary);
  text-decoration: underline;
}



/* ==========================================================================
   MOBILE & TABLET RESPONSIVE SYSTEM (FUTGOLD CONTROL CENTER)
   Optimized for iOS Safari, Android Chrome, and touch interactions
   ========================================================================== */

@media (max-width: 1024px) {
  .app-container {
    padding: 20px 16px;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
  .slots-timeline {
    grid-template-columns: repeat(5, 1fr);
  }
  .posts-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
  .history-container {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (max-width: 768px) {
  /* Header Mobile: 2-tier Grid Layout */
  .app-header {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 10px;
    padding: 10px 12px;
    position: sticky;
    top: 0;
    z-index: 1000;
  }

  .header-left {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }

  .brand {
    gap: 8px;
  }

  .brand-logo {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }
  .brand-logo svg {
    width: 18px;
    height: 18px;
  }
  .brand-text h1 {
    font-size: 16px;
    white-space: nowrap;
  }
  .brand-badge {
    display: none; /* Tiết kiệm diện tích màn hình mobile */
  }

  .system-status-pill {
    padding: 3px 8px;
    font-size: 10px;
    gap: 5px;
    white-space: nowrap;
  }

  .header-right {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .clock-display {
    display: none; /* Ẩn đồng hồ để nút chạy nổi bật */
  }

  .header-right .btn-primary {
    padding: 6px 12px;
    font-size: 11.5px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
  }

  /* Header Center: Nav-Tabs cuộn ngang mượt mà */
  .header-center {
    grid-column: 1 / 3;
    grid-row: 2 / 3;
    width: 100%;
    overflow: hidden;
  }

  .nav-tabs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 3px;
    gap: 4px;
    width: 100%;
  }
  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .nav-btn {
    flex: 0 0 auto;
    padding: 7px 11px;
    font-size: 12px;
    white-space: nowrap;
    border-radius: var(--radius-sm);
    touch-action: manipulation;
  }

  /* Main Container */
  .app-container {
    padding: 12px 10px;
  }

  /* Stats Grid */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
  }
  .stat-card {
    padding: 12px 10px;
    gap: 8px;
  }
  .stat-icon {
    width: 36px;
    height: 36px;
    font-size: 18px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
  }
  .stat-label {
    font-size: 10.5px;
  }
  .stat-value {
    font-size: 18px;
  }
  .stat-sub {
    font-size: 9px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Card General */
  .card {
    padding: 14px 12px;
    margin-bottom: 14px;
    border-radius: var(--radius-sm);
  }
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
  }
  .header-title h3 {
    font-size: 14px;
  }
  .card-header .next-slot-badge,
  .card-header .brand-badge,
  .card-header .btn {
    align-self: flex-start;
  }

  /* Timeline 10 Slot: Cuộn ngang mượt mà chuẩn app mobile */
  .slots-timeline {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
    padding: 4px 2px 8px 2px;
  }
  .slots-timeline::-webkit-scrollbar {
    display: none;
  }
  .slot-item {
    flex: 0 0 88px;
    min-width: 88px;
    padding: 10px 4px;
    touch-action: manipulation;
  }
  .slot-item .slot-time {
    font-size: 12px;
  }

  /* Slots Report Grid */
  .slots-report-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .slot-report-card {
    padding: 12px;
  }

  /* Tables: Overflow cuộn ngang không vỡ trang */
  .tasks-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -12px;
    padding: 0 12px;
  }
  .data-table {
    min-width: 580px;
    font-size: 11.5px;
  }
  .data-table th, .data-table td {
    padding: 9px 10px;
  }

  /* Toolbar */
  .section-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 14px;
  }
  .section-toolbar h2 {
    font-size: 16px;
  }
  .section-toolbar .subtitle {
    font-size: 12px;
  }
  .section-toolbar .btn {
    width: 100%;
    justify-content: center;
  }

  /* Posts Grid */
  .posts-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .post-card-content {
    padding: 12px;
  }

  /* History Column */
  .history-container {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .published-list, .log-entries-list {
    max-height: 420px;
  }

  /* Rules Bento */
  .rules-bento {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .rule-card {
    padding: 14px;
  }

  /* Terminal Console */
  .terminal-body {
    max-height: 360px;
    font-size: 10px;
    padding: 10px;
  }
  .console-actions {
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    justify-content: space-between;
  }

  /* Modals: Mobile Fullscreen / Bottom Sheet */
  .modal-overlay {
    padding: 10px;
    align-items: flex-end;
  }
  .modal-content {
    max-height: 92vh;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    width: 100%;
  }
  .modal-header {
    padding: 12px 14px;
  }
  .modal-body {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
    max-height: calc(92vh - 60px);
    overflow-y: auto;
  }
  .modal-img-col img {
    max-height: 200px;
    object-fit: contain;
  }
  .code-box {
    font-size: 11px;
    max-height: 120px;
  }

  /* Toast Notification */
  .toast-container {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
  }
  .toast {
    padding: 10px 12px;
    font-size: 11.5px;
  }
}

@media (max-width: 420px) {
  .header-left .brand-text h1 {
    font-size: 15px;
  }
  .system-status-pill .status-label {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
}
