/* === Ankur Lighting OMS — Styles === */
:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-col: #1a2332;
  --border: #334155;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #6366f1;
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --red-bg: #451a1a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* === Top Nav === */
.topnav {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: #1e293b;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topnav-brand {
  font-weight: 700;
  font-size: 16px;
  color: #f8fafc;
  white-space: nowrap;
  letter-spacing: -0.3px;
}
.topnav-brand span { color: var(--accent); }

.view-toggle {
  display: flex;
  background: var(--bg);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.view-toggle button {
  padding: 6px 14px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.view-toggle button.active {
  background: var(--accent);
  color: #fff;
}

.search-box {
  flex: 1;
  max-width: 320px;
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.search-box input:focus { border-color: var(--accent); }
.search-box::before {
  content: '🔍';
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
}

.filter-select {
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.esc-toggle {
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-weight: 500;
}
.esc-toggle:hover {
  border-color: var(--amber);
  color: var(--text);
}
.esc-toggle.active {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--red);
  color: #fca5a5;
  font-weight: 600;
}
.esc-toggle.active:hover {
  background: rgba(239, 68, 68, 0.22);
}

.collapse-all-btn {
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-weight: 500;
  font-family: inherit;
}
.collapse-all-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.topnav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.topnav-right .user-name {
  font-size: 13px;
  color: var(--text-muted);
}
.topnav-right .role-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  text-transform: uppercase;
  font-weight: 600;
}
.btn-sm {
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-muted);
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-sm:hover { background: var(--bg); border-color: var(--accent); color: var(--text); }
.btn-sm.btn-danger { color: #fca5a5; border-color: #7f1d1d; }
.btn-sm.btn-danger:hover { background: #7f1d1d; color: #fff; border-color: var(--red); }
.btn-link {
  padding: 6px 12px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
}
.btn-link:hover { color: var(--text); }

/* === Kanban Board === */
.kanban-board {
  display: flex;
  gap: 12px;
  padding: 16px;
  overflow-x: auto;
  min-height: calc(100vh - 60px);
  align-items: flex-start;
}
.kanban-col {
  min-width: 280px;
  max-width: 300px;
  flex-shrink: 0;
  background: var(--bg-col);
  border-radius: 10px;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 80px);
}
.kanban-col.on-hold {
  border-color: #dc2626;
  background: #1a1a2e;
}

/* Collapsed column */
.kanban-col.col-collapsed {
  min-width: 44px;
  max-width: 44px;
  width: 44px;
}
.kanban-col.col-collapsed .col-header-collapsed {
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 4px;
  height: 100%;
  border-bottom: none;
  cursor: pointer;
  flex: 1;
  overflow: hidden;
}
.kanban-col.col-collapsed .col-cards-collapsed {
  min-height: 20px;
  height: 20px;
  padding: 0;
  /* Invisible drop target below the header */
}
.kanban-col.col-collapsed .col-title-vertical {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 220px;
}
.kanban-col.col-collapsed .col-collapsed-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-top: auto;
}
.kanban-col.col-collapsed .col-count-big {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.kanban-col.col-collapsed .col-overdue {
  font-size: 10px;
  padding: 2px 6px;
}
.col-toggle {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.1s;
}
.col-toggle:hover { color: var(--text); }

.col-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.col-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.col-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.col-count {
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}
.col-overdue {
  font-size: 11px;
  color: #fff;
  background: var(--red);
  padding: 2px 7px;
  border-radius: 10px;
  flex-shrink: 0;
  font-weight: 600;
}

.col-cards {
  padding: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 60px;
}

/* Health tint on column headers */
.col-health-green .col-header { border-bottom-color: #22c55e44; background: #22c55e0a; }
.col-health-amber .col-header { border-bottom-color: #f59e0b44; background: #f59e0b0a; }
.col-health-red .col-header { border-bottom-color: #ef444444; background: #ef44440a; }

/* === Cards === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: grab;
  transition: transform 0.1s, box-shadow 0.1s;
  position: relative;
}
.card:hover {
  border-color: #475569;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.card:active { cursor: grabbing; }
.card.sortable-ghost {
  opacity: 0.4;
  border-color: var(--accent);
}
.card.sortable-chosen {
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  transform: rotate(1deg);
}

.card-on-hold {
  border-left: 3px solid var(--red);
  background: #1e1a2e;
}

/* Terminal cards (Completed etc.) — muted, no drama */
.card-terminal {
  opacity: 0.7;
  background: #0d1829;
  border-color: #1f2937;
}
.card-terminal:hover { opacity: 1; }
.card-terminal .card-days { color: var(--green); font-weight: 600; }

/* Due date (stage SLA) passed — amber/orange outline */
.card-due-overdue {
  border-color: var(--amber) !important;
  box-shadow: 0 0 0 1px var(--amber), 0 0 12px rgba(245, 158, 11, 0.25);
}

/* EDD (whole-order deadline) passed — red outline with pulse */
.card-edd-overdue {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 1px var(--red), 0 0 14px rgba(239, 68, 68, 0.4);
  animation: pulse-red 2.5s ease-in-out infinite;
}

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 1px var(--red), 0 0 14px rgba(239, 68, 68, 0.4); }
  50%     { box-shadow: 0 0 0 1px var(--red), 0 0 22px rgba(239, 68, 68, 0.7); }
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}
.card-pl {
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text-dim);
}
.card-so {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}
.card-customer {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.card-meta-item {
  display: flex;
  align-items: center;
  gap: 3px;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.dot-green { background: var(--green); }
.dot-amber { background: var(--amber); }
.dot-red { background: var(--red); }

.card-badges {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}
.badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}
.badge-esc { background: var(--red); color: #fff; }
.badge-edd { background: #78350f; color: #fbbf24; }
.badge-due { background: #334155; color: #cbd5e1; }
.badge-due-passed { background: #7f1d1d; color: #fecaca; }
.badge-days-amber { background: #78350f; color: #fbbf24; }
.badge-days-red { background: #7f1d1d; color: #fca5a5; }

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #334155;
}
.card-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.card-owner {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-days {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* === List View === */
.list-view {
  padding: 16px;
  display: none;
}
.list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.list-table th {
  text-align: left;
  padding: 10px 12px;
  background: #1e293b;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.list-table th:hover { color: var(--text); }
.list-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #1e293b;
  color: var(--text);
}
.list-table tr:hover td { background: #1e293b; }
.list-table tr.row-due-overdue td { background: rgba(245, 158, 11, 0.08); border-left: 2px solid var(--amber); }
.list-table tr.row-due-overdue:first-child td:first-child,
.list-table tr.row-due-overdue td:first-child { border-left: 3px solid var(--amber); }
.list-table tr.row-edd-overdue td { background: rgba(239, 68, 68, 0.1); }
.list-table tr.row-edd-overdue td:first-child { border-left: 3px solid var(--red); }
.list-table .sort-arrow { margin-left: 4px; font-size: 10px; }

/* === Detail Modal === */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 200;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px;
  overflow-y: auto;
}
.modal-overlay.active { display: flex; }
.modal {
  background: #1e293b;
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0,0,0,0.4);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
}
.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: #334155; color: var(--text); }
.modal-body { padding: 24px; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.detail-item label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-bottom: 4px;
}
.detail-item .value {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}

.detail-section {
  margin-bottom: 24px;
}
.detail-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Stage history timeline */
.timeline {
  position: relative;
  padding-left: 20px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--border);
}
.timeline-item {
  position: relative;
  padding-bottom: 16px;
  font-size: 13px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -17px;
  top: 5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #1e293b;
}
.timeline-item .time {
  font-size: 11px;
  color: var(--text-dim);
}

/* Notes */
.note-item {
  padding: 10px;
  background: var(--bg);
  border-radius: 6px;
  margin-bottom: 8px;
}
.note-item .note-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 4px;
}
.note-item .note-text {
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
}
.note-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.note-form textarea {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  resize: vertical;
  min-height: 38px;
  font-family: inherit;
  outline: none;
}
.note-form textarea:focus { border-color: var(--accent); }
.note-form button {
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  align-self: flex-end;
}
.note-form button:hover { background: #4f46e5; }

/* Detail actions row */
.detail-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.detail-actions select,
.detail-actions input {
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.detail-actions select:focus,
.detail-actions input:focus { border-color: var(--accent); }
.detail-actions .action-label {
  font-size: 11px;
  color: var(--text-dim);
  display: block;
  margin-bottom: 4px;
}
.zoho-link {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
}
.zoho-link:hover { text-decoration: underline; }

/* === Manage Stages === */
.stages-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.stage-config-row {
  background: var(--bg);
  border-radius: 8px;
  padding: 10px 12px;
  border: 1px solid transparent;
  transition: background 0.1s, border 0.1s;
}
.stage-config-row:hover { background: #1a2332; border-color: var(--border); }
.stage-config-row.sortable-ghost { opacity: 0.4; background: var(--accent); }
.stage-config-row.stage-is-terminal {
  background: rgba(22, 101, 52, 0.08);
  border-color: #166534;
}
.terminal-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  white-space: nowrap;
  user-select: none;
}
.terminal-toggle:hover { border-color: var(--accent); color: var(--text); }
.terminal-toggle input { accent-color: var(--green); cursor: inherit; margin: 0; }
.stage-config-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.stage-config-bottom {
  display: flex;
  gap: 16px;
  padding-top: 8px;
  margin-top: 8px;
  border-top: 1px solid #1e293b;
  padding-left: 26px;
}
.stage-config-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stage-config-field label {
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.duration-pickers {
  display: flex;
  gap: 6px;
}
.dur-picker {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding-right: 6px;
  transition: border-color 0.15s;
}
.dur-picker:focus-within { border-color: var(--accent); }
.dur-picker select {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 12px;
  padding: 4px 2px 4px 6px;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  min-width: 38px;
}
.dur-picker .dur-label {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.stage-config-owners { flex: 1; min-width: 0; }
.owner-chips-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex-wrap: wrap;
}
.owner-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
  min-width: 0;
  align-items: center;
}
.owner-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2px 4px 2px 10px;
  font-size: 11px;
  color: var(--text);
}
.owner-chip button {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}
.owner-chip button:hover { background: #7f1d1d; color: #fff; }
.owner-placeholder {
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
}
.owner-add-select {
  padding: 4px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 11px;
  outline: none;
  cursor: pointer;
}
.owner-add-select:focus { border-color: var(--accent); }

/* Legacy stage-row (used only by sortable ghost class reference) */
.stage-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 6px;
}
.stage-row .drag-handle {
  cursor: grab;
  color: var(--text-dim);
  font-size: 16px;
  flex-shrink: 0;
  user-select: none;
}
.stage-row .drag-handle:active { cursor: grabbing; }
.stage-color-swatch {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
}
.stage-color-swatch input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}
.stage-name-input {
  flex: 1;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  font-family: inherit;
}
.stage-name-input:hover { border-color: var(--border); }
.stage-name-input:focus { border-color: var(--accent); background: var(--bg-card); }
.stage-order-count {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 50px;
  text-align: right;
}
.stage-row .btn-icon {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--text-dim);
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stage-row .btn-icon:hover { background: var(--border); color: var(--text); }
.stage-row .btn-icon.danger:hover { background: #7f1d1d; color: #fca5a5; }
.stage-add-row {
  display: flex;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.stage-add-row input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  font-family: inherit;
}
.stage-add-row input:focus { border-color: var(--accent); }
.stage-add-row button {
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.stage-add-row button:hover { background: #4f46e5; }
.stage-save-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 8px;
}

/* === Danger Zone (in detail modal) === */
.danger-zone {
  margin-top: 24px;
  padding: 16px;
  border: 1px solid #7f1d1d;
  border-radius: 8px;
  background: rgba(127, 29, 29, 0.12);
}
.danger-zone-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #fca5a5;
  font-weight: 700;
  margin-bottom: 10px;
}
.btn-danger-full {
  width: 100%;
  padding: 10px 14px;
  background: #7f1d1d;
  color: #fff;
  border: 1px solid var(--red);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-danger-full:hover { background: var(--red); }
.danger-zone-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
  line-height: 1.5;
}

/* === Schedule Modal (business hours + holidays) === */
.hours-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}
.hours-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg);
  border-radius: 6px;
}
.hours-day {
  width: 90px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.hours-working {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  min-width: 90px;
}
.hours-working input { accent-color: var(--accent); cursor: inherit; margin: 0; }
.hours-row input[type="time"] {
  padding: 5px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
  outline: none;
  font-family: inherit;
  width: 90px;
}
.hours-row input[type="time"]:focus { border-color: var(--accent); }
.hours-row input[type="time"]:disabled { opacity: 0.4; cursor: not-allowed; }
.hours-sep { font-size: 11px; color: var(--text-dim); }

.holiday-add {
  display: flex;
  gap: 8px;
  padding: 10px;
  background: var(--bg);
  border-radius: 6px;
  margin-bottom: 8px;
}
.holiday-add input[type="date"],
.holiday-add input[type="text"] {
  padding: 6px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
  outline: none;
  font-family: inherit;
}
.holiday-add input[type="text"] { flex: 1; }
.holiday-add input:focus { border-color: var(--accent); }
.holiday-add button {
  padding: 6px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
}
.holiday-list { display: flex; flex-direction: column; gap: 2px; }
.holiday-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: 4px;
}
.holiday-date {
  font-family: 'SF Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
  min-width: 95px;
}
.holiday-label { flex: 1; font-size: 13px; color: var(--text); }

/* === Reason-on-Stage-Entry Modal === */
.reason-body { display: flex; flex-direction: column; gap: 10px; }
.reason-intro { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.reason-body textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
}
.reason-body textarea:focus { border-color: var(--accent); }
.reason-error {
  font-size: 12px;
  color: #fbbf24;
  min-height: 16px;
}
#reasonSubmitBtn:disabled { opacity: 0.45; cursor: not-allowed; }

/* === Password Modal === */
.password-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.pw-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pw-field label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.pw-field input {
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.pw-field input:focus { border-color: var(--accent); }
.pw-error {
  display: none;
  background: #451a1a;
  border: 1px solid var(--red);
  color: #fca5a5;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
}
.pw-error.active { display: block; }
.pw-success {
  background: #14532d;
  border: 1px solid var(--green);
  color: #bbf7d0;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
}

/* === Roles Modal === */
.roles-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.role-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
}
.role-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}
.role-label-input {
  width: 100%;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  outline: none;
  font-family: inherit;
}
.role-label-input:hover { border-color: var(--border); }
.role-label-input:focus { border-color: var(--accent); background: var(--bg-card); }
.role-label-input:disabled { color: var(--text-muted); cursor: not-allowed; }
.role-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
}
.role-desc {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
  resize: vertical;
  font-family: inherit;
  outline: none;
  margin-bottom: 10px;
}
.role-desc:focus { border-color: var(--accent); }
.perms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 4px 12px;
  margin-bottom: 10px;
}
.perm-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  padding: 2px 0;
}
.perm-toggle.disabled {
  color: var(--text-dim);
  cursor: not-allowed;
}
.perm-toggle input[type="checkbox"] {
  accent-color: var(--accent);
  cursor: inherit;
}
.perm-stage-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid #1e293b;
}
.perm-stage-row label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.perm-stage-row select {
  padding: 5px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 12px;
  outline: none;
  flex: 1;
  max-width: 280px;
}
.perm-stage-row select:focus { border-color: var(--accent); }

/* === Kbd === */
kbd {
  display: inline-block;
  padding: 2px 7px;
  font-size: 11px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  line-height: 1.4;
}

/* === Utility === */
.hidden { display: none !important; }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.text-red { color: var(--red); }

/* Refresh indicator */
.refresh-bar {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: #1e293b;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text-muted);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
}
.refresh-bar button {
  padding: 4px 10px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}

/* Admin stage context menu */
.context-menu {
  position: fixed;
  background: #1e293b;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 300;
  min-width: 160px;
  padding: 4px;
  display: none;
}
.context-menu.active { display: block; }
.context-menu button {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
}
.context-menu button:hover { background: var(--bg); }
.context-menu button.danger { color: var(--red); }

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* === Admin pages === */
.admin-page {
  padding: 24px;
  max-width: 800px;
  margin: 0 auto;
}
.admin-page h2 {
  font-size: 20px;
  margin-bottom: 20px;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th {
  text-align: left;
  padding: 10px 12px;
  background: #1e293b;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #1e293b;
}
.admin-form {
  background: #1e293b;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}
.admin-form .form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.admin-form input, .admin-form select {
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  flex: 1;
  min-width: 120px;
}
.admin-form button {
  padding: 8px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
