/* ============================================================
   PSU Info Network — Design System
   ============================================================ */

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

/* ── CSS Variables ── */
:root {
  /* PSU Brand Colors — Custom Andaman Blue (#0085AD) */
  --psu-blue: #0085AD;
  --psu-blue-dark: #006685;
  --psu-blue-light: #2A9DBD;
  --psu-gold: #C9A84C;
  --psu-gold-light: #E8C96A;

  /* UI Colors */
  --bg-base: #F0F4F8;
  --bg-sidebar: #0085AD;
  --bg-sidebar-2: #006685;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F0FBFF;
  --border: #E2E8F0;
  --border-light: #F1F5F9;

  /* Text */
  --text-primary: #1A202C;
  --text-secondary: #4A5568;
  --text-muted: #718096;
  --text-white: #FFFFFF;

  /* Channel Colors */
  --ch-social: #4267B2;
  --ch-web: #16A34A;
  --ch-led: #D97706;
  --ch-broadcast: #DC2626;

  /* Status Colors */
  --st-draft: #94A3B8;
  --st-wait: #0EA5E9;
  --st-process: #8B5CF6;
  --st-success: #16A34A;
  --st-partial: #059669;
  --st-reqinfo: #6B7280;
  --st-suspend: #F59E0B;
  --st-cancel: #374151;

  /* Spacing */
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;

  /* Shadow */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08);
  --shadow: 0 4px 16px rgba(0, 0, 0, .10);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, .14);
}


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

html {
  font-size: 15px;
}

body {
  font-family: 'Sarabun', 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  margin: 0;
  min-height: 100vh;
  line-height: 1.6;
}

a {
  color: var(--psu-blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #C1CBD8;
  border-radius: 3px;
}

/* ============================================================
   LAYOUT: Sidebar + Main
   ============================================================ */

.layout-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: #0085AD;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform .3s ease;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand-icon {
  width: 40px;
  height: 40px;
  background: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #275e8b;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-brand-text {
  color: #fff;
}

.sidebar-brand-text strong {
  display: block;
  font-size: .95rem;
  font-weight: 700;
}

.sidebar-brand-text small {
  font-size: .72rem;
  color: rgba(255, 255, 255, .85);
}

.sidebar-nav {
  padding: 12px 0;
  flex: 1;
}

.sidebar-section {
  padding: 12px 16px 4px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .08em;
  color: rgba(255, 255, 255, .75);
  text-transform: uppercase;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  margin: 1px 8px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: .88rem;
  font-weight: 500;
  transition: background .18s, color .18s;
  cursor: pointer;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, .1);
  color: #fff;
  text-decoration: none;
}

.sidebar-link.active {
  background: rgba(255, 255, 255, .2);
  color: #fff;
}

.sidebar-link i {
  width: 18px;
  text-align: center;
  font-size: .9rem;
  opacity: .8;
}

.sidebar-link.active i {
  opacity: 1;
}

.sidebar-badge {
  margin-left: auto;
  background: var(--ch-broadcast);
  color: #fff;
  border-radius: 10px;
  padding: 2px 7px;
  font-size: .7rem;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .22);
  border: 1.5px solid rgba(255, 255, 255, .4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
  flex-shrink: 0;
}

.sidebar-user-info strong {
  display: block;
  font-size: .82rem;
  color: #fff;
  font-weight: 600;
}

.sidebar-user-info small {
  font-size: .72rem;
  color: rgba(255, 255, 255, .8);
}

.sidebar-logout {
  margin-left: auto;
  color: rgba(255, 255, 255, .75);
  font-size: .85rem;
}

.sidebar-logout:hover {
  color: #fff;
}

/* Main content */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.topbar-hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px 8px;
}

.topbar-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.topbar-spacer {
  flex: 1;
}

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

/* Page content */
.page-content {
  padding: 24px;
  flex: 1;
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: .95rem;
  color: var(--text-primary);
  background: var(--bg-card);
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-base);
}

/* Stat Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: transform .2s, box-shadow .2s;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-card.sc-total::before {
  background: linear-gradient(90deg, #7DD3FC, #BAE6FD);
}

.stat-card.sc-wait::before {
  background: linear-gradient(90deg, #93C5FD, #BFDBFE);
}

.stat-card.sc-success::before {
  background: linear-gradient(90deg, #86EFAC, #BBF7D0);
}

.stat-card.sc-draft::before {
  background: linear-gradient(90deg, var(--st-draft), #CBD5E1);
}

.stat-card.sc-cancel::before {
  background: linear-gradient(90deg, #FCA5A5, #FECACA);
}

.stat-card.sc-suspend::before {
  background: linear-gradient(90deg, #FDE047, #FEF08A);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-card.sc-total .stat-icon {
  background: #E0F2FE;
  color: #0EA5E9;
}

.stat-card.sc-wait .stat-icon {
  background: #DBEAFE;
  color: #3B82F6;
}

.stat-card.sc-success .stat-icon {
  background: #DCFCE7;
  color: #22C55E;
}

.stat-card.sc-draft .stat-icon {
  background: #F1F5F9;
  color: var(--st-draft);
}

.stat-card.sc-cancel .stat-icon {
  background: #FEE2E2;
  color: #EF4444;
}

.stat-card.sc-suspend .stat-icon {
  background: #FEF9C3;
  color: #EAB308;
}

.stat-info {
  flex: 1;
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ============================================================
   STATUS BADGES
   ============================================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-all {
  background: #F1F5F9;
  color: #334155;
  border: 1px solid #CBD5E1;
}

.status-red-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: #EF4444;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.3);
  animation: pulse-red-dot 2s infinite;
}

@keyframes pulse-red-dot {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.badge-draft {
  background: #F1F5F9;
  color: #475569;
  border: 1px solid #CBD5E1;
}

.badge-wait {
  background: #E0F2FE;
  color: #0369A1;
  border: 1px solid #BAE6FD;
}

.badge-process {
  background: #EDE9FE;
  color: #6D28D9;
  border: 1px solid #DDD6FE;
}

.badge-success {
  background: #DCFCE7;
  color: #15803D;
  border: 1px solid #BBF7D0;
}

.badge-partial {
  background: #D1FAE5;
  color: #065F46;
  border: 1px solid #A7F3D0;
}

.badge-reqinfo {
  background: #F1F5F9;
  color: #374151;
  border: 1px solid #D1D5DB;
}

.badge-suspend {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}

.badge-cancel {
  background: #F3F4F6;
  color: #1F2937;
  border: 1px solid #D1D5DB;
}

/* Channel badges */
.ch-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 600;
  margin: 2px;
}

.ch-social {
  background: #EFF6FF;
  color: var(--ch-social);
  border: 1px solid #BFDBFE;
}

.ch-web {
  background: #DCFCE7;
  color: var(--ch-web);
  border: 1px solid #BBF7D0;
}

.ch-led {
  background: #FEF3C7;
  color: var(--ch-led);
  border: 1px solid #FDE68A;
}

.ch-broadcast {
  background: #FEE2E2;
  color: var(--ch-broadcast);
  border: 1px solid #FECACA;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: .88rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all .18s;
  white-space: nowrap;
  text-decoration: none;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--psu-blue);
  color: #fff;
}

.btn-primary:hover {
  background: var(--psu-blue-dark);
  color: #fff;
}

.btn-success {
  background: #16A34A;
  color: #fff;
}

.btn-success:hover {
  background: #15803D;
  color: #fff;
}

.btn-danger {
  background: #DC2626;
  color: #fff;
}

.btn-danger:hover {
  background: #B91C1C;
  color: #fff;
}

.btn-warning {
  background: #D97706;
  color: #fff;
}

.btn-warning:hover {
  background: #B45309;
  color: #fff;
}

.btn-secondary {
  background: #F1F5F9;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: #E2E8F0;
  color: var(--text-primary);
}

.btn-outline {
  background: transparent;
  color: var(--psu-blue);
  border: 1.5px solid var(--psu-blue);
}

.btn-outline:hover {
  background: var(--psu-blue);
  color: #fff;
}

.btn-sm {
  padding: 5px 12px;
  font-size: .8rem;
}

.btn-lg {
  padding: 11px 26px;
  font-size: 1rem;
}

.btn-icon {
  padding: 7px 10px;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-label .required {
  color: #DC2626;
  margin-left: 2px;
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: border-color .18s, box-shadow .18s;
  outline: none;
}

.form-control:focus {
  border-color: var(--psu-blue);
  box-shadow: 0 0 0 3px rgba(0, 169, 206, .15);
}

.form-control::placeholder {
  color: var(--text-muted);
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

select.form-control {
  cursor: pointer;
}

.form-hint {
  font-size: .76rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-error {
  font-size: .76rem;
  color: #DC2626;
  margin-top: 4px;
  font-weight: 500;
}

/* Checkbox/Radio custom */
.check-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .18s;
  font-size: .88rem;
  user-select: none;
}

.check-item:hover {
  border-color: var(--psu-blue);
  background: #E0F7FC;
}

.check-item input[type=checkbox],
.check-item input[type=radio] {
  display: none;
}

.check-item.checked {
  border-color: var(--psu-blue);
  background: #E0F7FC;
  color: var(--psu-blue);
  font-weight: 600;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
  overflow-x: auto;
}

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

.table th {
  background: var(--bg-base);
  padding: 11px 14px;
  text-align: left;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: .04em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

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

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

/* ============================================================
   ALERTS / FLASH
   ============================================================ */
.alert {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: .9rem;
  margin-bottom: 16px;
}

.alert-success {
  background: #DCFCE7;
  color: #166534;
  border: 1px solid #BBF7D0;
}

.alert-error {
  background: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FECACA;
}

.alert-warning {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
}

.alert-info {
  background: #E0F2FE;
  color: #075985;
  border: 1px solid #BAE6FD;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

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

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn .2s ease;
}

@keyframes modalIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }

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

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 1rem;
}

.modal-body {
  padding: 22px;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px 6px;
}

/* ============================================================
   TABS (Channel Form Tabs)
   ============================================================ */
.tab-nav {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 10px 18px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all .18s;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tab-btn:hover {
  color: var(--psu-blue);
  background: #F8FAFF;
}

.tab-btn.active {
  color: var(--psu-blue);
  border-bottom-color: var(--psu-blue);
}

.tab-pane {
  display: none;
}

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

/* ============================================================
   FILE UPLOAD DROP ZONE
   ============================================================ */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: all .18s;
  background: var(--bg-base);
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: var(--psu-blue);
  background: #E0F7FC;
}

.upload-zone i {
  font-size: 2rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.upload-zone p {
  margin: 4px 0;
  font-size: .88rem;
  color: var(--text-secondary);
}

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

.file-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .82rem;
}

.file-item-icon {
  color: var(--psu-blue);
  width: 20px;
  text-align: center;
}

.file-item-name {
  flex: 1;
  color: var(--text-primary);
  font-weight: 500;
}

.file-item-size {
  color: var(--text-muted);
  font-size: .76rem;
}

.file-item-remove {
  color: var(--ch-broadcast);
  cursor: pointer;
  background: none;
  border: none;
  font-size: .85rem;
  padding: 2px 4px;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.page-btn {
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.page-btn:hover {
  border-color: var(--psu-blue);
  color: var(--psu-blue);
  text-decoration: none;
}

.page-btn.active {
  background: var(--psu-blue);
  border-color: var(--psu-blue);
  color: #fff;
}

.page-btn.disabled {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================================
   Toast Notifications
   ============================================================ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: .88rem;
  font-weight: 500;
  min-width: 280px;
  max-width: 380px;
  animation: toastIn .25s ease;
  background: var(--bg-card);
  border-left: 4px solid var(--psu-blue);
}

.toast.toast-success {
  border-left-color: var(--st-success);
}

.toast.toast-error {
  border-left-color: var(--ch-broadcast);
}

.toast.toast-warning {
  border-left-color: var(--ch-led);
}

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

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

/* ============================================================
   PUBLIC FOOTER (Global)
   ============================================================ */
.pub-footer {
  background: var(--bg-sidebar);
  color: rgba(255,255,255,0.7);
  padding: 60px 40px 30px;
  font-family: 'Sarabun', sans-serif;
  margin-top: 60px;
}
.pub-footer-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 40px;
  text-align: left;
}
.pub-footer-col h3 {
  color: #fff; font-size: 1.25rem; font-weight: 700;
  margin: 0 0 20px; font-family: 'Sarabun', sans-serif;
}
.pub-footer-col p {
  font-size: 0.95rem; line-height: 1.6; margin: 0 0 10px;
}
.pub-footer-col ul { list-style: none; padding: 0; margin: 0; }
.pub-footer-col ul li {
  display: flex; gap: 12px; margin-bottom: 14px;
  font-size: 0.95rem; line-height: 1.5; color: rgba(255,255,255,0.85);
}
.pub-footer-col ul li i { margin-top: 4px; color: #38bdf8; font-size: 0.85rem; }
.pub-socials { display: flex; gap: 12px; margin-top: 24px; }
.pub-social {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.3);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.1rem; text-decoration: none;
  transition: all 0.2s;
}
.pub-social:hover { background: #fff; color: var(--psu-blue); }
.pub-footer-bottom {
  max-width: 1200px; margin: 40px auto 0;
  padding-top: 24px; border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.85rem; color: rgba(255,255,255,0.5);
}
.pub-footer-bottom a { color: rgba(255,255,255,0.6); text-decoration: none; }
.pub-footer-bottom a:hover { color: #fff; }

@media (max-width: 768px) {
  .pub-footer-grid { grid-template-columns: 1fr; gap: 30px; }
  .pub-footer-bottom { flex-direction: column; text-align: center; gap: 16px; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* Medium Devices (Tablets/Small Laptops) */
@media (max-width: 992px) {
  div[style*="grid-template-columns:1fr 300px"],
  div[style*="grid-template-columns:1fr 320px"],
  div[style*="grid-template-columns:1fr 340px"] {
    grid-template-columns: 1fr !important;
  }
}

/* Small Devices (Mobiles) */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .topbar {
    padding: 0 16px;
  }

  .topbar-hamburger {
    display: block;
  }

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

  .page-content {
    padding: 16px;
  }

  .modal-box {
    margin: 0;
    max-height: 100vh;
    border-radius: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
  }

  .modal-body {
    flex: 1;
  }

  /* Inline Grid Overrides for Mobile */
  div[style*="grid-template-columns:1fr 1fr;"],
  div[style*="grid-template-columns:1fr 1fr gap"],
  div[style*="grid-template-columns:1fr 1fr auto"] {
    grid-template-columns: 1fr !important;
  }
  
  /* Tabs wrapping */
  .tab-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .tab-btn {
    white-space: nowrap;
    padding: 10px 14px;
  }

  /* Tables */
  .table th, .table td {
    padding: 10px;
    font-size: 0.82rem;
  }

  /* Form checks */
  .check-item {
    font-size: 0.8rem;
    padding: 6px 10px;
  }
}

@media (max-width: 480px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }
  
  /* Make inline dual-date fields stack (used in broadcast/led forms) */
  div[style*="grid-template-columns:1fr 1fr;gap:10px;"] {
      grid-template-columns: 1fr !important;
  }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

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

.text-bold {
  font-weight: 700;
}

.text-sm {
  font-size: .82rem;
}

.text-xs {
  font-size: .72rem;
}

.d-flex {
  display: flex;
}

.align-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-8 {
  gap: 8px;
}

.gap-12 {
  gap: 12px;
}

.gap-16 {
  gap: 16px;
}

.mb-0 {
  margin-bottom: 0;
}

.mb-8 {
  margin-bottom: 8px;
}

.mb-16 {
  margin-bottom: 16px;
}

.mb-24 {
  margin-bottom: 24px;
}

.mt-8 {
  margin-top: 8px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-24 {
  margin-top: 24px;
}

.p-0 {
  padding: 0 !important;
}

.w-100 {
  width: 100%;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: .4;
}

.empty-state p {
  font-size: .95rem;
  margin: 0;
}

/* Channel color text helpers */
.text-social {
  color: var(--ch-social);
}

.text-web {
  color: var(--ch-web);
}

.text-led {
  color: var(--ch-led);
}

.text-broadcast {
  color: var(--ch-broadcast);
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--psu-blue);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}

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

/* Normalized rich-text content from news submissions */
.news-content {
  font-family: 'Sarabun', sans-serif;
  font-size: .95rem;
  line-height: 1.8;
  letter-spacing: normal;
  word-spacing: normal;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}

.news-content p {
  margin: 0 0 .85em;
}

.news-content p:last-child {
  margin-bottom: 0;
}

.news-content h1,
.news-content h2,
.news-content h3,
.news-content h4 {
  font-family: inherit;
  line-height: 1.4;
  margin: 1em 0 .55em;
}

.news-content ul,
.news-content ol {
  margin: .65em 0 .9em;
  padding-left: 1.6em;
}

.news-content blockquote {
  margin: .8em 0;
  padding: .55em .9em;
  border-left: 3px solid var(--psu-blue);
  background: #F8FAFC;
}

.news-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 10px 0;
  border-radius: 8px;
}

.news-content table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: .8em 0;
}

.news-content th,
.news-content td {
  border: 1px solid var(--border);
  padding: 6px 9px;
  vertical-align: top;
}

/* ช่องลิงก์กรอกไม่ถูกต้อง (ต้องขึ้นต้นด้วย http:// หรือ https://) → ขอบแดง */
input[type="url"].form-control:not(:placeholder-shown):invalid {
  border-color: #DC2626;
  background: #FEF2F2;
}
input[type="url"].form-control:not(:placeholder-shown):invalid:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .15);
}
/* ปุ่มสื่อแบบแคปซูล (หน้าส่งข่าว) — ใช้ร่วมกัน: ปุ่มเลือกสื่อ (ขั้น 2) และแท็บรายละเอียด (ขั้น 3) */
.ch-tab-hint {
  font-size: .82rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.ch-tab-hint i { color: var(--psu-blue); margin-right: 4px; }
#channelTabs .tab-nav {
  gap: 8px;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 1px dashed var(--border);
}
.ch-pill {
  --tab-color: var(--psu-blue);
  --tab-tint: #EFF6FF;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 700;
  border: 2px solid var(--tab-color);
  border-radius: 999px;
  margin-bottom: 0;
  background: var(--tab-tint);
  color: var(--tab-color);
  cursor: pointer;
  user-select: none;
  transition: all .18s;
}
.ch-pill i { font-size: 1rem; }
.ch-pill:hover { background: #fff; color: var(--tab-color); border-color: var(--tab-color); }
.ch-pill.active,
.ch-pill.active:hover {
  background: var(--tab-color);
  color: #fff;
  border-color: var(--tab-color);
}
.ch-pill.active::after {
  content: "\f00c";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: .75rem;
  margin-left: 2px;
}
.ch-c-01_SOCIAL    { --tab-color: var(--ch-social);    --tab-tint: #EFF6FF; }
.ch-c-02_WEB       { --tab-color: var(--ch-web);       --tab-tint: #DCFCE7; }
.ch-c-03_LED       { --tab-color: var(--ch-led);       --tab-tint: #FEF3C7; }
.ch-c-04_BROADCAST { --tab-color: var(--ch-broadcast); --tab-tint: #FEE2E2; }
@media (max-width: 640px) {
  .ch-pill { padding: 8px 14px; font-size: .88rem; }
}
/* เช็คบ็อกซ์เลือกสื่อ (หน้าส่งข่าว ขั้นที่ 2) — สีตามช่องทางจาก .ch-c-* */
.ch-check-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px 10px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}
.ch-check-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
  accent-color: var(--tab-color);
}
.ch-check-item i { color: var(--tab-color); font-size: 1rem; }
.ch-check-item:hover { border-color: var(--tab-color); }
.ch-check-item.active {
  border-color: var(--tab-color);
  background: var(--tab-tint);
  color: var(--tab-color);
}
/* กรอบโฟกัสเฉพาะตอนใช้คีย์บอร์ด (Tab) */
.ch-check-item:has(input:focus-visible) { outline: 2px solid var(--tab-color); outline-offset: 2px; }
/* ข้อมูลส่วนตัว (/profile) + การ์ดผู้ใช้ในเมนูซ้ายกดไปหน้านี้ได้ */
.sidebar-user-link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  border-radius: 8px;
  padding: 4px;
  margin: -4px;
}
.sidebar-user-link:hover { background: rgba(255, 255, 255, .1); }
.profile-card { max-width: 860px; }
.profile-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--psu-blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  flex-shrink: 0;
}
.profile-name { font-size: 1.15rem; font-weight: 700; color: var(--text-primary); }
.profile-meta { font-size: .85rem; color: var(--text-muted); margin-top: 2px; }
.profile-section-title { font-weight: 700; font-size: .9rem; margin-bottom: 10px; color: var(--text-primary); }
.profile-section-title i { color: var(--psu-blue); margin-right: 4px; }
.profile-list {
  display: grid;
  grid-template-columns: 180px 1fr;
  margin: 0 0 16px;
  font-size: .9rem;
}
.profile-list dt,
.profile-list dd {
  margin: 0;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}
.profile-list dt { color: var(--text-muted); font-weight: 600; }
.profile-list dd { color: var(--text-primary); word-break: break-word; }
.profile-list dt:nth-of-type(even),
.profile-list dd:nth-of-type(even) { background: #FAFBFD; }
.profile-note { font-size: .82rem; color: var(--text-muted); }
.profile-note i { color: var(--psu-blue); margin-right: 4px; }
@media (max-width: 640px) {
  .profile-list { grid-template-columns: 1fr; }
  .profile-list dt { border-bottom: none; padding-bottom: 0; }
  .profile-list dd { padding-top: 2px; }
}