/* ─────────────────────────────
   Court Rolls / Ubuntu — page header
───────────────────────────── */
.cr-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 20px;
}

.cr-header-left h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.cr-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 480px;
}

.cr-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding-top: 4px;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1.5px solid var(--surface-border);
  border-radius: 8px;
  background: var(--surface-bg);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn-outline:hover { border-color: var(--accent); background: var(--surface-hover-bg); }
.btn-outline svg { width: 15px; height: 15px; fill: currentColor; flex-shrink: 0; }

.btn-primary svg { width: 15px; height: 15px; fill: currentColor; flex-shrink: 0; margin-right: 2px; }

/* ─────────────────────────────
   Stats row
───────────────────────────── */
.cr-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}

.cr-stat-card {
  border-radius: 12px;
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
  min-height: 115px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cr-stat-dark {
  background: #0d1a3e;
  color: #fff;
}

.cr-stat-light {
  background: var(--surface-bg);
  color: var(--text-primary);
  border: 1px solid var(--surface-border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.cr-stat-amber {
  background: var(--surface-bg);
  color: var(--text-primary);
  border: 1px solid var(--surface-border);
  border-left: 4px solid #d97706;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

html[data-theme="dark"] .cr-stat-light,
html[data-theme="dark"] .cr-stat-amber { box-shadow: none; }

.cr-stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 8px;
  opacity: 0.65;
}

.cr-stat-dark .cr-stat-label { color: #fff; opacity: 0.6; }

.cr-stat-value {
  font-size: 44px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
}

.cr-stat-dark .cr-stat-value { color: #fff; }

.cr-stat-sub { font-size: 12px; line-height: 1.4; }
.cr-stat-dark .cr-stat-sub { color: rgba(255,255,255,0.55); }
.cr-stat-light .cr-stat-sub, .cr-stat-amber .cr-stat-sub { color: var(--text-muted); }

.cr-stat-trend { font-size: 12px; font-weight: 500; color: var(--accent-green); }

.cr-stat-bg-shape {
  position: absolute;
  right: -24px;
  bottom: -24px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  pointer-events: none;
}
.cr-stat-bg-shape::after {
  content: '';
  position: absolute;
  right: 22px;
  top: 22px;
  width: 75px;
  height: 75px;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
}

/* ─────────────────────────────
   Table section container
───────────────────────────── */
.cr-table-section {
  background: var(--surface-bg);
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  border: 1px solid var(--surface-border);
  overflow: hidden;
}

html[data-theme="dark"] .cr-table-section { box-shadow: none; }

.cr-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 18px;
  border-bottom: 1px solid var(--surface-border);
  background: var(--surface-header-bg);
}

.cr-table-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.cr-table-tools { display: flex; gap: 6px; }

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  border: 1.5px solid var(--surface-border);
  background: var(--surface-bg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: border-color 0.15s, color 0.15s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 15px; height: 15px; fill: currentColor; }

/* ─────────────────────────────
   Table cells
───────────────────────────── */
.th-check { width: 40px; padding: 11px 6px 11px 14px !important; }

input[type="checkbox"].row-check,
input[type="checkbox"]#crSelectAll,
input[type="checkbox"]#ueSelectAll {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.cr-cell-case { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.cr-cell-ref  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.cr-cell-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cr-cell-type { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.cr-court-cell { display: flex; align-items: center; gap: 8px; }

.cr-court-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--surface-header-bg);
  border: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cr-court-icon svg { width: 14px; height: 14px; fill: var(--text-secondary); }

.cr-court-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.cr-court-room { font-size: 11px; color: var(--text-muted); }

.cr-cell-date { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.cr-cell-time { font-size: 11px; color: var(--text-muted); margin-top: 1px; }

/* ─────────────────────────────
   Category badges
───────────────────────────── */
.cr-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  white-space: nowrap;
}

.cr-badge-urgent   { background: #fde8e8; color: #b91c1c; }
.cr-badge-standard { background: #dbeafe; color: #1a6bb5; }
.cr-badge-taxation { background: #fef3c7; color: #b45309; }
.cr-badge-civil    { background: #e0f2fe; color: #0369a1; }
.cr-badge-default  { background: var(--surface-header-bg); color: var(--text-secondary); }

html[data-theme="dark"] .cr-badge-urgent   { background: #3b1212; color: #fca5a5; }
html[data-theme="dark"] .cr-badge-standard { background: #132f45; color: #93c5fd; }
html[data-theme="dark"] .cr-badge-taxation { background: #3b2000; color: #fcd34d; }
html[data-theme="dark"] .cr-badge-civil    { background: #0f2a3d; color: #7dd3fc; }
html[data-theme="dark"] .cr-badge-default  { background: var(--surface-hover-bg); color: var(--text-muted); }

/* ─────────────────────────────
   Status chips
───────────────────────────── */
.cr-status {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  white-space: nowrap;
  margin-top: 3px;
  margin-right: 4px;
}

.cr-status-pending   { background: #dcfce7; color: #15803d; }
.cr-status-highpri   { background: #fde8e8; color: #b91c1c; }
.cr-status-completed { background: #dbeafe; color: #1d4ed8; }

html[data-theme="dark"] .cr-status-pending   { background: #052e16; color: #4ade80; }
html[data-theme="dark"] .cr-status-highpri   { background: #3b1212; color: #fca5a5; }
html[data-theme="dark"] .cr-status-completed { background: #1e3a5f; color: #93c5fd; }

/* ── Filter panel ── */
.cr-filter-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 200;
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cr-filter-row   { display: flex; flex-direction: column; gap: 4px; }
.cr-filter-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); }
.cr-filter-select {
  font-size: 13px;
  padding: 5px 8px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--surface-header-bg);
  color: var(--text-primary);
  outline: none;
}
.cr-filter-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 4px; }
.cr-date-range { display: flex; align-items: center; gap: 6px; }
.cr-date-sep   { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.cr-filter-date {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  padding: 5px 6px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--surface-header-bg);
  color: var(--text-primary);
  outline: none;
}
.btn-sm { font-size: 12px; padding: 5px 12px; }
.icon-btn-active { color: var(--accent); background: var(--accent-alpha, rgba(79,110,247,0.12)); }

/* ─────────────────────────────
   Pagination
───────────────────────────── */
.cr-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--surface-border);
  flex-wrap: wrap;
  gap: 8px;
}

.pag-info { font-size: 12px; color: var(--text-secondary); }

.pag-controls { display: flex; gap: 4px; align-items: center; }

.pag-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--surface-border);
  background: var(--surface-bg);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.pag-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--surface-hover-bg); }
.pag-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 700; }
.pag-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.pag-ellipsis { font-size: 13px; color: var(--text-muted); padding: 0 4px; }

/* ─────────────────────────────
   Dashboard — Command Center
───────────────────────────── */
.dash-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.dash-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-bg);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 8px 14px;
  flex: 1;
  max-width: 400px;
}
.dash-search-wrap svg { width: 15px; height: 15px; fill: var(--text-muted); flex-shrink: 0; }

.dash-search-input {
  border: none;
  background: none;
  outline: none;
  font-size: 13px;
  color: var(--text-primary);
  width: 100%;
}
.dash-search-input::placeholder { color: var(--text-muted); }

.dash-topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.dash-icon-btn {
  width: 36px; height: 36px;
  border-radius: 8px;
  border: 1.5px solid var(--surface-border);
  background: var(--surface-bg);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: border-color 0.15s, color 0.15s;
}
.dash-icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.dash-icon-btn svg { width: 18px; height: 18px; fill: currentColor; }

.dash-cc-header { margin-bottom: 18px; }

.dash-cc-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.dash-cc-date {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-secondary);
}
.dash-cc-date svg { width: 13px; height: 13px; fill: var(--text-secondary); flex-shrink: 0; }

/* Stats row */
.dash-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.dash-stat-card {
  background: var(--surface-bg);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
html[data-theme="dark"] .dash-stat-card { box-shadow: none; }

.dash-stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.dash-stat-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
}
.dash-stat-icon svg { width: 19px; height: 19px; fill: currentColor; }

.dash-icon-blue  { background: #e8f0fe; color: #4f6ef7; }
.dash-icon-red   { background: #fde8e8; color: #e11d48; }
.dash-icon-dark  { background: #0f2a3d; color: #859AA7; }

html[data-theme="dark"] .dash-icon-blue { background: #1e3a5f; color: #93c5fd; }
html[data-theme="dark"] .dash-icon-red  { background: #3b1212; color: #fca5a5; }

.dash-stat-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--text-muted);
}

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

.dash-stat-name {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.dash-stat-trend { font-size: 12px; font-weight: 500; color: #15803d; }
html[data-theme="dark"] .dash-stat-trend { color: #4ade80; }

.dash-stat-alert { font-size: 12px; font-weight: 500; color: #b91c1c; }
html[data-theme="dark"] .dash-stat-alert { color: #fca5a5; }
.dash-stat-sub { font-size: 12px; font-weight: 500; color: var(--text-muted); }

.dash-capacity { margin-top: 2px; }

.dash-capacity-bar {
  height: 5px;
  background: var(--surface-border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}
.dash-capacity-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.6s ease;
}
.dash-capacity-text {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  font-weight: 600;
}

/* Bottom grid */
.dash-bottom-grid {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 380px);
  gap: 14px;
  align-items: start;
}

@media (max-width: 900px) {
  .dash-bottom-grid { grid-template-columns: 1fr; }
}

.dash-chart-card,
.dash-logs-card {
  background: var(--surface-bg);
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
html[data-theme="dark"] .dash-chart-card,
html[data-theme="dark"] .dash-logs-card { box-shadow: none; }

.dash-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}
.dash-card-title { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 2px; }
.dash-card-sub   { font-size: 12px; color: var(--text-secondary); }

.dash-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--text-secondary);
  align-items: center;
  max-width: 260px;
}
.legend-item { display: flex; align-items: center; gap: 4px; min-width: 0; }
.legend-label {
  max-width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.legend-empty { font-size: 10px; color: var(--text-muted); font-style: italic; font-weight: 400; text-transform: none; }

.legend-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.dash-chart-wrap { width: 100%; overflow: hidden; }

.dash-view-all {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  flex-shrink: 0;
}
.dash-view-all:hover { text-decoration: underline; }

.dash-logs-list { display: flex; flex-direction: column; margin-bottom: 14px; }

.dash-log-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--surface-border);
}
.dash-log-item:last-child { border-bottom: none; }

.dash-log-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px;
}
.dash-log-dot-blue  { background: #4f6ef7; }
.dash-log-dot-red   { background: #e11d48; }
.dash-log-dot-gray  { background: var(--surface-border); }
.dash-log-dot-green { background: #15803d; }

.dash-log-title { font-size: 13px; font-weight: 500; color: var(--text-primary); line-height: 1.4; margin-bottom: 2px; }
.dash-log-meta  { font-size: 11px; color: var(--text-muted); }
.dash-log-empty { font-size: 12px; color: var(--text-muted); padding: 16px 0; text-align: center; font-style: italic; }

.dash-quote-card {
  background: #0d1a3e;
  border-radius: 10px;
  padding: 14px 16px;
}
.dash-quote-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  margin-bottom: 7px;
}
.dash-quote-text {
  font-size: 13px;
  font-style: italic;
  line-height: 1.55;
  color: rgba(255,255,255,0.85);
  margin-bottom: 5px;
}
.dash-quote-attr { font-size: 11px; color: rgba(255,255,255,0.4); }

/* ─────────────────────────────
   Settings — recipient divider & hint
───────────────────────────── */
.settings-row-divider {
  margin-top: 6px;
  padding-top: 14px !important;
  border-top: 1px solid var(--surface-border);
}

.settings-row-hint {
  padding-top: 0 !important;
  padding-bottom: 4px !important;
  border-bottom: none !important;
}

.settings-hint {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ─────────────────────────────
   PDF Viewer — send status bar
───────────────────────────── */
.viewer-send-msg {
  margin: 0 0 10px;
  padding: 9px 14px;
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.45;
  animation: fadeSlideIn 0.2s ease;
}
.viewer-send-msg.msg-error {
  background: rgba(220, 53, 69, 0.12);
  border: 1px solid rgba(220, 53, 69, 0.35);
  color: #e05260;
}
.viewer-send-msg.msg-success {
  background: rgba(40, 167, 69, 0.12);
  border: 1px solid rgba(40, 167, 69, 0.35);
  color: #3aad5a;
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─────────────────────────────
   PDF Viewer — send channel picker
───────────────────────────── */
.send-picker {
  position: relative;
  display: inline-flex;
  /* Ensure the picker floats above the iframe stacking context */
  z-index: 9999;
}

.send-picker-menu {
  position: fixed; /* fixed breaks out of iframe stacking entirely */
  background: var(--surface-bg);
  border: 1px solid var(--surface-border);
  border-radius: 9px;
  box-shadow: 0 8px 32px rgba(0,0,0,.32);
  min-width: 160px;
  z-index: 9999;
  overflow: hidden;
  animation: fadeSlideIn 0.15s ease;
}

.send-picker-opt {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 11px 16px;
  background: none;
  border: none;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
  white-space: nowrap;
}

.send-picker-opt + .send-picker-opt {
  border-top: 1px solid var(--surface-border);
}

.send-picker-opt:hover {
  background: var(--surface-hover-bg);
}

.send-picker-opt svg {
  flex-shrink: 0;
  fill: var(--text-secondary);
}

.send-picker-opt:hover svg {
  fill: var(--accent);
}

/* ─────────────────────────────
   Table search bar
───────────────────────────── */
.cr-table-header {
  flex-wrap: wrap;
  gap: 10px;
}

.table-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.table-search-icon {
  position: absolute;
  left: 9px;
  width: 15px;
  height: 15px;
  fill: var(--text-secondary);
  pointer-events: none;
  flex-shrink: 0;
}

.table-search-input {
  height: 32px;
  width: 280px;
  padding: 0 30px 0 30px;
  border: 1.5px solid var(--surface-border);
  border-radius: 7px;
  background: var(--surface-bg);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.table-search-input::placeholder { color: var(--text-secondary); }

.table-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-alpha, rgba(79,110,247,0.15));
}

.table-search-clear {
  position: absolute;
  right: 6px;
  width: 18px;
  height: 18px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding: 0;
  transition: color 0.12s, background 0.12s;
}
.table-search-clear:hover {
  color: var(--text-primary);
  background: var(--surface-hover-bg);
}

/* Widen filter panel to fit the extra Court Type row */
.cr-filter-panel { min-width: 260px; }

/* ── Dashboard Mini Calendar ── */
.dash-mini-cal-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.dash-mini-cal-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 72px;
  text-align: center;
}
.icon-btn-xs { width: 22px; height: 22px; }
.icon-btn-xs svg { width: 14px; height: 14px; }

.dash-mini-cal-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 2px;
}
.dash-mini-cal-dow span {
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 2px 0;
}

.dash-mini-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
}
.dmc-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 3px;
  border-radius: 4px;
  cursor: default;
  position: relative;
}
.dmc-cell.dmc-has-events { cursor: pointer; }
.dmc-cell.dmc-has-events:hover { background: var(--surface-hover-bg); }
.dmc-cell.dmc-selected { background: var(--accent-alpha, rgba(79,110,247,0.12)); border-radius: 4px; }
.dmc-cell.dmc-today .dmc-num {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dmc-num {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1;
}
.dmc-dots {
  display: flex;
  gap: 1px;
  margin-top: 2px;
  flex-wrap: wrap;
  justify-content: center;
}
.dmc-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
}
.dmc-dot-cr { background: #4f6ef7; }
.dmc-dot-ue { background: #F87060; }

.dash-mini-cal-events {
  margin-top: 8px;
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
  min-height: 40px;
}
.dmc-ev-date {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.dmc-ev-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-primary);
  padding: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dmc-ev-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dmc-empty {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Calendar ── */
.cal-legend {
  display: flex;
  gap: 18px;
  margin-left: auto;
}
.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}
.cal-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.cal-dot-cr { background: #4f6ef7; }
.cal-dot-ue { background: #F87060; }

.cal-card {
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.cal-month-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  min-width: 160px;
  text-align: center;
}

.cal-grid-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}
.cal-grid-header > div {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 4px 0;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cal-cell {
  min-height: 90px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 6px 5px 4px;
  background: var(--surface-bg);
  vertical-align: top;
  overflow: hidden;
}
.cal-cell-empty {
  background: transparent;
  border-color: transparent;
}
.cal-cell-today {
  border-color: var(--accent);
  background: var(--accent-alpha, rgba(79,110,247,0.07));
}

.cal-day-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
  line-height: 1;
}
.cal-day-today {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.cal-events-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cal-event {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 5px;
  border-radius: 3px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  transition: filter 0.1s;
}
.cal-event:hover { filter: brightness(1.15); }
.cal-event-cr {
  background: rgba(79,110,247,0.18);
  color: #4f6ef7;
}
.cal-event-ue {
  background: rgba(248,112,96,0.18);
  color: #F87060;
}
.cal-event-more {
  font-size: 10px;
  color: var(--text-muted);
  padding: 1px 5px;
}

.cal-load-err {
  grid-column: 1 / -1;
  padding: 24px;
  color: var(--danger, #e11d48);
  font-size: 13px;
}

/* Popup */
.cal-popup {
  position: fixed;
  z-index: 9999;
  width: 280px;
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
  padding: 16px;
}
.cal-popup-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}
.cal-popup-close:hover { color: var(--text-primary); }
.cal-popup-type {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 6px;
}
.cal-popup-type-cr { color: #4f6ef7; }
.cal-popup-type-ue { color: #F87060; }
.cal-popup-case {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.cal-popup-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.5;
}
.cal-popup-row {
  display: flex;
  gap: 8px;
  font-size: 12px;
  padding: 3px 0;
  border-bottom: 1px solid var(--border-color);
}
.cal-popup-row:last-child { border-bottom: none; }
.cal-popup-key {
  color: var(--text-muted);
  min-width: 60px;
  flex-shrink: 0;
}
.cal-popup-val {
  color: var(--text-primary);
  font-weight: 500;
}

.ue-sync-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  align-self: center;
}

/* ─────────────────────────────
   Upload drop zone — polished override
───────────────────────────── */
.upload-drop-zone {
  border: 1.5px dashed var(--surface-border);
  border-radius: 10px;
  padding: 28px 20px 22px;
  text-align: center;
  cursor: pointer;
  background: var(--surface-header-bg);
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
  margin-bottom: 16px;
  position: relative;
}

.upload-drop-zone:hover,
.upload-drop-zone.drag-over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, var(--surface-header-bg));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent);
}

.upload-drop-zone svg {
  display: block;
  margin: 0 auto 2px;
  opacity: 0.45;
}

.upload-drop-zone:hover svg,
.upload-drop-zone.drag-over svg {
  opacity: 0.75;
  fill: var(--accent) !important;
}

.upload-drop-label {
  margin: 8px 0 2px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.upload-browse-link {
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  transition: border-color 0.12s;
}
.upload-browse-link:hover { border-color: var(--accent); }

.upload-file-name {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 6px 0 0;
  min-height: 16px;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  padding: 0 4px;
}

.dz-change-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin: 4px 0 0;
  font-style: italic;
}

/* ── Court Roll Upload ── */
.cru-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 36px;
  color: var(--text-secondary);
  font-size: 14px;
}
.cru-spinner-ring {
  width: 26px;
  height: 26px;
  border: 3px solid var(--surface-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: cru-spin 0.75s linear infinite;
}
@keyframes cru-spin { to { transform: rotate(360deg); } }
.cru-json-pre {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 16px;
  font-size: 12px;
  font-family: monospace;
  overflow: auto;
  max-height: 65vh;
  white-space: pre;
  margin: 0;
}
/* Two-column layout: upload card + log side by side */
.cru-layout {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 20px;
  align-items: start;
  margin-bottom: 24px;
}

@media (max-width: 860px) {
  .cru-layout { grid-template-columns: 1fr; }
}

/* Button row inside upload card */
.cru-btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--surface-border);
}

.cru-log-box {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--surface-border);
}
.cru-log-header {
  background: #1a1a2e;
  color: #a0aec0;
  font-size: 11px;
  font-family: monospace;
  padding: 8px 14px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cru-log-header::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #48bb78;
}
.cru-log-body {
  background: #0d1117;
  padding: 12px 16px;
  min-height: 260px;
  max-height: 420px;
  overflow-y: auto;
  font-family: monospace;
  font-size: 12px;
  line-height: 1.7;
}
.cru-log-line { display: block; white-space: pre-wrap; word-break: break-all; }
.cru-log-req     { color: #63b3ed; }
.cru-log-res     { color: #68d391; }
.cru-log-info    { color: #a0aec0; }
.cru-log-event   { color: #d6bcfa; }
.cru-log-error   { color: #fc8181; }
.cru-log-section { color: #f6e05e; font-weight: 700; margin-top: 4px; }
.cru-log-success { color: #68d391; font-weight: 700; }

/* Editable cells in extracted table */
.cru-editable {
  outline: none;
  transition: background 0.12s, box-shadow 0.12s;
  white-space: nowrap;
  min-width: 60px;
}
.cru-editable:hover {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.cru-editable:focus {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  box-shadow: inset 0 0 0 1.5px var(--accent);
  border-radius: 2px;
  white-space: normal;
}

.cru-edit-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
}

.cru-goto-link {
  font-weight: 600;
  color: inherit;
  text-decoration: underline;
  white-space: nowrap;
}
.cru-goto-link:hover { opacity: 0.8; }

/* ─────────────────────────────
   System Settings — reset card widths for tab layout
───────────────────────────── */
.settings-tab-pane .settings-card {
  max-width: 900px;
  width: 100%;
  flex: unset;
}

.settings-tab-pane .settings-row {
  grid-template-columns: 200px 1fr;
}

/* ─────────────────────────────
   System Settings tab nav
───────────────────────────── */
.settings-tabs-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--surface-border);
  padding-bottom: 0;
  flex-wrap: wrap;
}

.settings-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  background: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.settings-tab:hover {
  color: var(--text-primary);
  background: var(--surface-hover-bg);
}

.settings-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: none;
}

.settings-tab-panes {
  position: relative;
}

.settings-tab-pane {
  display: none;
}

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

/* ─────────────────────────────
   Empty state (distinct from loading)
───────────────────────────── */
.table-empty {
  text-align: center;
  padding: 36px 28px;
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

/* ─────────────────────────────
   GitHub Auto-Update card
───────────────────────────── */
.settings-info {
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding: 0.4rem 0;
  display: block;
}

.settings-info-mono {
  font-family: monospace;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.github-log-box {
  background: #071d2b;
  color: #4ade80;
  font-size: 0.78rem;
  font-family: monospace;
  padding: 0.75rem 1rem;
  border-radius: 0 0 6px 6px;
  max-height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
}

/* ── Deploy UI ── */
.deploy-page-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.deploy-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface-header-bg);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  margin: 16px 0 12px;
}

.deploy-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}
.deploy-status-dot.dot-green  { background: #22c55e; box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.deploy-status-dot.dot-yellow { background: #f59e0b; box-shadow: 0 0 6px rgba(245,158,11,0.5); }
.deploy-status-dot.dot-red    { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.5); }
.deploy-status-dot.dot-pulse  {
  background: #3b82f6;
  animation: deploy-pulse 1s ease-in-out infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes deploy-pulse {
  0%, 100% { box-shadow: 0 0 4px rgba(59,130,246,0.5); }
  50%       { box-shadow: 0 0 10px rgba(59,130,246,0.9); }
}

.deploy-status-text {
  flex: 1;
  font-size: 13px;
  color: var(--text-secondary);
}

.btn-text-link {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--accent);
  padding: 2px 4px;
  font-weight: 600;
}
.btn-text-link:hover { text-decoration: underline; }

.deploy-action-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  margin-bottom: 12px;
}

.deploy-action-left {
  display: flex;
  gap: 10px;
  flex: 1;
}

.deploy-action-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.deploy-branch {
  font-weight: 400;
  color: var(--text-secondary);
  font-size: 13px;
}

.deploy-action-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.deploy-action-desc code {
  background: var(--surface-header-bg);
  border: 1px solid var(--surface-border);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 11px;
  font-family: monospace;
}

.deploy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}

.deploy-log-section {
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 4px;
}

.deploy-log-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--surface-header-bg);
  border-bottom: 1px solid var(--surface-border);
}

.deploy-log-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.deploy-log-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}
.deploy-log-badge-running { background: rgba(34,197,94,0.15); color: #22c55e; }
.deploy-log-badge-done    { background: rgba(99,102,241,0.15); color: #818cf8; }
.deploy-log-badge-error   { background: rgba(239,68,68,0.15);  color: #ef4444; }

/* ── Mobile API Reference ── */
.api-ref-baseurl-row {
  margin: 16px 0 20px;
}

.api-ref-url-wrap {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.api-ref-url-input { flex: 1; }

.api-ref-auth-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface-header-bg);
  border: 1px solid var(--surface-border);
  border-radius: 7px;
  padding: 10px 12px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.api-ref-auth-note svg { flex-shrink: 0; margin-top: 1px; color: var(--accent); }

.api-ref-auth-note code {
  background: var(--surface-bg);
  border: 1px solid var(--surface-border);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 11px;
  font-family: monospace;
}

.api-ref-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 20px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.api-ref-auth-badge {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted);
}

.api-ref-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  overflow: hidden;
}

.api-ref-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--surface-border);
  font-size: 13px;
}

.api-ref-item:last-child { border-bottom: none; }
.api-ref-item:hover { background: var(--surface-hover-bg); }

.api-method {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  flex-shrink: 0;
  font-family: monospace;
  letter-spacing: 0.3px;
}

.api-method-get    { background: rgba(34,197,94,0.12);  color: #16a34a; }
.api-method-post   { background: rgba(59,130,246,0.12); color: #2563eb; }
.api-method-delete { background: rgba(239,68,68,0.12);  color: #dc2626; }

html[data-theme="dark"] .api-method-get    { color: #4ade80; }
html[data-theme="dark"] .api-method-post   { color: #93c5fd; }
html[data-theme="dark"] .api-method-delete { color: #fca5a5; }

.api-ref-path {
  font-family: monospace;
  font-size: 12px;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.api-ref-desc {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}

@media (max-width: 700px) { .api-ref-desc { display: none; } }
