/* ============================================================
   BASE THEME
============================================================ */
:root {
  --bg: #0f1220;
  --card: #171a2b;
  --text: #eef6fb;
  --muted: #8ea3b0;
  --accent: rgba(77,163,255,0.35);

  --role-ot: #4da3ff;
  --role-ipos: #b57bff;
  --role-mc: #4dff8c;
  --role-door-expo: #ffcc66;
  --role-traffic: #ff6f6f;

  --inside: #1a2c46;
  --outside: #3f7d4a;
  --cover: #ff4d4f;
  --line: #222b47;
}

/* ============================================================
   GLOBAL
============================================================ */
.icon-btn,
.move-icon,
.cover-icon,
.pause-icon {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif !important;
}

/* ============================================================
   REMOVE BLUE HIGHLIGHT FROM BUTTON CLICKS / TOUCHES
============================================================ */
*:focus {
  outline: none !important;
}

button,
.icon-btn,
.mini-end-btn,
.modal-btn,
.toggle-btn,
.cover-name-pill,
.adjust-btn {
  outline: none !important;
  box-shadow: none !important;
}

/* Remove Chrome/Android tap highlight */
* {
  -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   FORCE NO SCROLLBARS ANYWHERE
============================================================ */
* {
  scrollbar-width: none;
}

*::-webkit-scrollbar {
  display: none !important;
}

.column,
#app,
.card-list {
  min-height: 0;
  min-width: 0;
  overflow: visible; /* allow stacking */
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, sans-serif;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none !important;
}

/* Main layout: Inside 50%, Outside 50% */
#app {
  display: flex;
  justify-content: space-between;
  padding: 20px;
  width: 100%;
}

.column {
  width: 50%;
  padding: 0 10px;
}

.column-title {
  text-align: center;
  font-weight: 900;
  font-size: 22px;
  color: var(--muted);
  margin-bottom: 14px;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ============================================================
   CARD BASE
============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  position: relative;
  z-index: 1;
  overflow: visible;
  padding-right: 15px;
  min-height: 87px;
  height: auto;
}

/* ============================================================
   STATUS BAR
============================================================ */
.status-bar {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  width: 32px;
  height: 100%;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  color: #fff;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top-left-radius: 14px;
  border-bottom-left-radius: 14px;
}

.status-inside { background: var(--inside); }
.status-outside { background: var(--outside); }
.status-cover { background: var(--cover); }

/* ============================================================
   HEADER GRID
============================================================ */
.card-header-grid {
  display: grid;
  grid-template-columns: 32% 43% 10% 0% 15%;
  align-items: center;
  gap: 0px;
  width: calc(100% - 32px);
}

/* ============================================================
   ROLE PILL / NAME / SHIFT
============================================================ */
.col-role-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.role-pill {
  display: inline-block;
  width: fit-content;
  padding: 3px 8px;
  white-space: nowrap;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

.role-Order-Taker { background: var(--role-ot); }
.role-iPOS-Lead   { background: var(--role-ipos); }
.role-Mobile-Cash { background: var(--role-mc); }
.role-Door-Expo   { background: var(--role-door-expo); }
.role-Traffic     { background: var(--role-traffic); }

.card-name {
  font-size: 20px;
  font-weight: 800;
}

.card-shift {
  font-size: 12px;
  color: var(--muted);
}

/* ============================================================
   HISTORY
============================================================ */
.col-history {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 6em;
  overflow: hidden;
  align-items: flex-start;
}

.history-row {
  background: #1e2b33;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.85rem;
  white-space: nowrap;
  color: var(--muted);
  opacity: 0.95;
  display: inline-block;
  width: auto;
}

/* ============================================================
   ICON BUTTONS
============================================================ */
.col-buttons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
  align-items: center;
  margin-top: -3px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #22283f;
  border: 1px solid #303a55;
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover { background: #2d3552; }

/* ============================================================
   TIMER
============================================================ */
.col-timer {
  font-size: 26px;
  font-weight: 900;
  text-align: right;
}

/* ===============================
   MINI-CARD WRAPPER
================================ */
.mini-card-wrapper {
  margin-top: 10px;
  display: none;
  position: relative;
}

.mini-card-wrapper.has-mini {
  display: block;
}

/* MINI-CARD GRID */
.mini-card {
  display: grid;
  grid-template-columns: 45% 35% 20%;
  width: 70%;
  height: 48px;
  margin-left: auto;
  margin-right: 26px;
  gap: 6px;
  padding: 8px 10px;
  background: #0f162d;
  border-radius: 10px;
  border: 1px solid var(--line);
  overflow: hidden;
}

.mini-card > * {
  min-width: 0 !important;
  overflow: hidden;
  display: flex;
  align-items: center;
}

/* COLUMN 1 — NAME */
.mini-name {
  font-size: 16px;
  font-weight: 900;
  justify-content: flex-start;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* COLUMN 2 — END COVER BUTTON */
.mini-end-btn {
  width: 100%;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ff4d4f;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 10px;
  font-weight: 900;
  color: var(--text);
  padding: 2px;
  white-space: nowrap;
  overflow: hidden;
}

.mini-end-btn:hover {
  opacity: 0.85;
}

/* COLUMN 3 — TIMER */
.mini-timer {
  font-size: 20px;
  font-weight: 900;
  justify-content: flex-end;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  margin-right: 16px;
}

/* Outer horizontal row — label flush against mini-card */
.mini-cover-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  width: 100%;
  margin-right: 26px;
}

.mini-cover-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  width: 30%;
  margin: 0;
  padding: 0;
  text-align: right;
}

/* Pause icon for main card during cover */
.pause-icon {
  font-size: 28px;
  font-weight: 900;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-bottom: 12px;
}

.pause-icon.pulsing {
  animation: pausePulse 1.1s ease-in-out infinite;
}

@keyframes pausePulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.14);
    opacity: 0.65;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ============================================================
   MODALS
============================================================ */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.22s ease,
    visibility 0.22s ease;
}

.modal:not(.hidden) {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.modal-box {
  background: var(--card);
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 20px;
  width: 300px;
  transform: scale(0.92) translateY(10px);
  opacity: 0;
  transition:
    transform 0.22s ease,
    opacity 0.22s ease;
}

.modal:not(.hidden) .modal-box {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.modal.hidden .modal-box {
  transform: scale(0.92) translateY(10px);
  opacity: 0;
}

/* ROLE MODAL BUTTONS */
.role-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}

.role-btn {
  width: 100%;
  padding: 8px 12px;
  height: 44px;
  border-radius: 10px;
  border: none;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
  margin-bottom: 6px;
}

.role-btn:hover {
  transform: scale(1.03);
  opacity: 0.9;
}

.role-btn.role-Order-Taker { background: var(--role-ot); }
.role-btn.role-iPOS-Lead   { background: var(--role-ipos); }
.role-btn.role-Mobile-Cash { background: var(--role-mc); }
.role-btn.role-Door-Expo        { background: var(--role-door-expo); }
.role-btn.role-Traffic     { background: var(--role-traffic); }

.modal-cancel {
  width: 100%;
  padding: 10px 14px;
  height: 44px;
  background: #22283f;
  border: 1px solid #303a55;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}

.modal-cancel:hover {
  background: #2d3552;
  transform: scale(1.03);
}

/* ============================================================
   COVER MODAL
============================================================ */
.cover-name-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  justify-items: center;
  margin-top: 16px;
}

.cover-name-pill {
  background: #2a334a;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  width: 100%;
  max-width: 160px;
  cursor: pointer;
  transition: opacity .2s;
}

.cover-name-pill:hover {
  opacity: 0.85;
}

.cover-toggle-wrap {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #1e2539;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
  height: 44px;
}

.cover-toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  border-radius: 12px;
  transition: transform 0.25s ease;
  z-index: 0;
  background: var(--accent);
}

.toggle-btn {
  position: relative;
  z-index: 2;
  background: transparent;
  border: none;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.toggle-btn.active {
  color: white;
}

.cover-cancel-btn {
  width: 100%;
  padding: 12px;
  margin-top: 20px;
  background: #22283f;
  border: 1px solid #303a55;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.cover-cancel-btn:hover {
  opacity: 0.85;
}

/* ============================================================
   ADJUST TIMER MODAL
============================================================ */
.adjust-box { width: 320px; }

.adjust-toggle-wrap {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: #1e2539;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
  height: 44px;
}

.adjust-toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: var(--accent);
  border-radius: 12px;
  transition: transform 0.22s ease;
  z-index: 1;
}

.adjust-toggle-btn {
  position: relative;
  z-index: 2;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.adjust-toggle-btn.active {
  color: white;
}

.adjust-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 16px;
  margin-bottom: 16px;
}

.adjust-btn {
  width: 100%;
  padding: 10px 14px;
  height: 44px;
  background: var(--accent);
  border: 1px solid #303a55;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}

.adjust-btn:hover {
  background: #2d3552;
  transform: scale(1.03);
}

.adjust-toggle-btn,
.adjust-btn,
#adjust-cancel {
  -webkit-tap-highlight-color: transparent;
}

#inside-list,
#outside-list {
  padding-bottom: 70px;
  position: relative;
}

/* ===========================================
   FULL SCREEN LOADING OVERLAY
=========================================== */
#loading-screen {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 32, 0.96);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999999;
  opacity: 1;
}

#loading-screen.hidden {
  display: none;
}

.loading-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.loading-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: #4da3ff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.loading-text {
  font-size: 24px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 1.6px;
  opacity: 0.85;
}

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

/* ----------------------------
      WEATHER WIDGET
-----------------------------*/
#weather-widget {
  position: relative;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  min-height: 180px;
  padding: 0;
  display: flex;
  flex-direction: column;
  font-family: Inter, system-ui;
  margin-bottom: 0;
  overflow: hidden;
}

.wx-top-label {
  background: #1a2c46;
  color: #9ec3ff;
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 1px;
  text-align: center;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.wx-cols {
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 20px;
  margin-top: 4px;
}

.wx-left,
.wx-right {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.wx-temp {
  font-size: 78px;
  font-weight: 900;
  margin: 0;
}

.wx-delta {
  font-size: 28px;
  font-weight: 900;
  margin: 0;
}

.wx-sub {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
  margin-top: 4px;
}

.wx-zone {
  font-size: 36px;
  font-weight: 900;
  margin: 0;
}

.wx-zone-label {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
  margin-top: 4px;
  margin-bottom: 20px;
}

.wx-rules {
  font-size: 18px;
  font-weight: 700;
  margin-top: 4px;
  line-height: 1.1;
}

#wx-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 8px;
  width: 0;
  background: var(--accent);
  transition: width 1s linear;
}

/* PULSE SYSTEM */
.card-inner {
  position: relative;
}

.card-inner::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  pointer-events: none;
  opacity: calc(0.25 + (var(--pulsePhase) * 0.75));
  background: transparent;
  border: 2px solid transparent;
  transition: opacity 0.2s linear;
  z-index: 5;
}

.card.pulse-yellow .card-inner::after {
  background: rgba(255, 255, 0, 0.25);
  border-color: rgba(255, 255, 0, 0.9);
}

.card.pulse-red .card-inner::after {
  background: rgba(255, 0, 0, 0.25);
  border-color: rgba(255, 0, 0, 0.9);
}

/* ============================================
   DEBUG PANEL STYLES
============================================ */
#debug-panel {
  position: fixed;
  top: 0;
  right: -320px;
  width: 300px;
  height: 100vh;
  background: #0f1120;
  border-left: 2px solid #1c2238;
  padding: 20px;
  color: #d0dae7;
  font-family: system-ui, sans-serif;
  transition: right 0.25s ease;
  z-index: 9999;
}

#debug-panel.open {
  right: 0;
}

#debug-open-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  height: 50px;
  width: 50px;
  background: #1a1f33;
  border: 1px solid #2d3552;
  padding-bottom: 3px;
  border-radius: 8px;
  color: #cbd8ef;
  font-size: 30px;
  cursor: pointer;
  z-index: 9999;
}

#debug-close {
  position: absolute;
  top: 10px;
  right: 10px;
  color: #cbd8ef;
  font-size: 26px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 10000;
}

.dbg-title {
  margin: 40px 0 15px;
  font-size: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dbg-tools-toggle {
  font-size: 12px;
  padding: 2px 8px;
}

.dbg-section {
  margin: 20px 0;
  padding-bottom: 15px;
  border-bottom: 1px solid #232a44;
}

.dbg-section:last-child {
  border-bottom: none;
}

.dbg-section.disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* Toggle switch */
.dbg-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dbg-toggle input {
  display: none;
}

.dbg-toggle .slider {
  width: 45px;
  height: 22px;
  background: #2b334d;
  border-radius: 22px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
}

.dbg-toggle .slider::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.dbg-toggle input:checked + .slider {
  background: #4da3ff;
}

.dbg-toggle input:checked + .slider::after {
  transform: translateX(23px);
}

.dbg-row {
  display: grid;
  grid-template-columns: 70px 1fr 40px;
  align-items: center;
  margin-bottom: 10px;
}

.dbg-row input[type="range"] {
  width: 100%;
}

.dbg-zones {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.dbg-zone {
  flex: 1 1 45%;
  padding: 8px;
  background: #1b2033;
  border: 1px solid #2d3553;
  border-radius: 6px;
  color: #cdd7ef;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}

.dbg-zone:hover {
  background: #223056;
}

.dbg-btn {
  width: 100%;
  padding: 10px;
  background: #283053;
  border: 1px solid #3a456d;
  color: #d0d8ea;
  border-radius: 6px;
  cursor: pointer;
  font-size: 18px;
  transition: opacity 0.2s;
}

.dbg-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.history-row {
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
}

/* Toggle container */
.dbg-tools-toggle-wrap {
  position: relative;
  width: 54px;
  height: 26px;
  background: #222a;
  border-radius: 20px;
  display: flex;
  align-items: center;
  padding: 0;
  justify-content: space-between;
  overflow: hidden;
  transform: translateY(8px);
}

.dbg-tools-toggle-slider {
  position: absolute;
  width: 26px;
  height: 26px;
  background: var(--accent, #4da3ff);
  border-radius: 50%;
  left: 0;
  top: 0;
  transition: transform 0.25s ease;
}

.dbg-tools-toggle-btn {
  width: 50%;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.modal-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-input,
.modal-select {
  background: #101321;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 6px 8px;
  color: #f5f7fb;
  font-size: 18px;
}

.modal-select {
  height: 40px; /* collapsed height */
}

.modal-input:focus,
.modal-select:focus {
  outline: none;
  border-color: var(--accent, #4da3ff);
}

.modal-actions {
  display: flex;
  gap: 8px;
}

/* =========================================
   SWIPE TO DELETE
========================================= */

/* card we can slide */
.card.swipe-card {
  position: relative;
  overflow: hidden;
  padding: 0;
  background: transparent;
  border-radius: 14px;  /* match your card corner radius */
  touch-action: pan-y;
}

/* Inner card that actually slides (already added earlier) */
.card-inner {
  position: relative;
  z-index: 1;
  background: var(--card);
  border-radius: 14px;
  padding: 8px;
  padding-right: 15px;
  min-height: 87px;
  height: auto;
}

/* Red delete strip “under” the card — completely stationary */
.card.swipe-card::before {
  content: "Delete ✕";
  position: absolute;
  top: 1px;
  bottom: 1px;
  right: 1px;
  width: calc(50% - 1px);
  background: #ff4d4f;
  color: #fff;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 16px;
  z-index: 0;
  transform: none;
  transition: none;
  border-top-right-radius: 14px;
  border-bottom-right-radius: 14px;
}


/* Optional: you can still style “active” state without sliding */
.card.swipe-card.swipe-active::before {
  /* maybe a tiny visual change, but NOT movement */
  filter: brightness(1.05);
}

/* Card snapping back after swipe */
.card.swipe-card.swipe-animating .card-inner {
  transition: transform 0.15s ease-out;
}

/* Confirm Delete button — same style as cancel, but red */
.modal-confirm-delete {
  width: 100%;
  padding: 10px 14px;
  height: 44px;
  background: #ff4d4f;              /* 🔥 red background */
  border: 1px solid #8c2f30;         /* darker red border */
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
  margin-bottom: 10px;
}

.modal-confirm-delete:hover {
  background: #e54446;               /* slightly darker red on hover */
  transform: scale(1.03);
}

.modal-add {
  width: 100%;
  padding: 10px 14px;
  height: 44px;
  background: var(--accent);
  border: 1px solid #303a55;
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}

.modal-add:hover {
  transform: scale(1.03);
}

.custom-select {
  position: relative;
  background: #101321;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 6px 8px;
  color: #f5f7fb;
  cursor: pointer;
  user-select: none;
}

.custom-select-display {
  font-size: 14px;
}

.custom-select-options {
  position: absolute;
  top: calc(100% + 4px);  /* always below */
  left: 0;
  width: 100%;
  background: #101321;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px;
  max-height: 200px;      /* 🔥 fixed dropdown height */
  overflow-y: auto;       /* scroll instead of expanding */
  display: none;
  z-index: 999999;
}

.custom-select.open .custom-select-options {
  display: block;
}

.custom-select-option {
  padding: 8px;
  font-size: 14px;
  cursor: pointer;
}

.custom-select-option:hover {
  background: #1c2438;
}

.modal-row {
  display: flex;
  gap: 12px;
}

.modal-row .modal-field {
  flex: 1; /* each column = 50% */
}

.modal-row .modal-field .custom-select {
  width: 100%;  /* fill full half */
  margin: 0;
}

/* ==============================
   WEATHER ROW — BASE (DESKTOP DEFAULT)
   - Full-width row
   - Widget aligned to inside column cards
============================== */

#weather-row {
  padding: 20px 20px 0;      /* match #app padding */
  display: block;
  pointer-events: none;
}

/*
  Cards in inside column:
    left = 20px (#app padding) + 10px (.column padding-left) = 30px
  So we match that frame.
*/
#weather-row #weather-widget {
  width: calc(50% - 20px);
  margin-left: 10px;         /* 20 (app) + 10 = 30px total offset */
}

/* ============================================================
   DESKTOP (DEFAULT) ALIGNMENT
   - Right column top flush with widget top
   - Inside column starts just BELOW widget
   - Gap under widget ~= card gap (8px)
============================================================ */

body[data-layout="default"] #weather-row {
  position: relative;
  z-index: 2;
}

/* Pull columns up so OUTSIDE top aligns with widget top */
body[data-layout="default"] #app {
  margin-top: -230px;        /* ≈ widget height; tweak if needed */
}

body[data-layout="default"] #inside-column {
  padding-top: 218px;
}

body[data-layout="default"] #outside-column {
  padding-top: 8px;
}

/* ============================================================
   PORTRAIT PHONE LAYOUT
   - Weather centered above columns
   - Same inner width as two-column area
   - Gap under widget = card gap (8px)
============================================================ */

body[data-layout="phone-portrait"] #weather-row {
  padding: 8px 8px 0;        /* match phone #app padding: 8px 8px */
  display: block;
}

body[data-layout="phone-portrait"] #weather-row #weather-widget {
  width: calc(100% - 16px);
  margin: 0 auto 8px;
}

body[data-layout="phone-portrait"] .wx-rules {
  font-size: 13px;
}

body[data-layout="phone-portrait"] .wx-zone {
  font-size: 25px;
}

body[data-layout="phone-portrait"] .wx-temp {
  font-size: 62px;
}

/* Slightly tighten app padding on phone */
body[data-layout="phone-portrait"] #app {
  padding: 0px 8px 16px;
}

/* Optional: slightly smaller column titles on phone */
body[data-layout="phone-portrait"] .column-title {
  font-size: 18px;
  margin-bottom: 8px;
}

body[data-layout="phone-portrait"] .card-name {
  font-size: 14px;
}

body[data-layout="phone-portrait"] .card-shift {
  font-size: 8px;
}

body[data-layout="phone-portrait"] .role-pill {
  font-size: 8px;
}

body[data-layout="phone-portrait"] .status-bar {
  width: 20px;
  font-size: 10px;
}

body[data-layout="phone-portrait"] .mini-cover-label {
  display: none !important;
}

/* Global top breathing room so widget + columns aren't crammed to top */
body {
  padding-top: 8px;
}


/* =========================================
   PHONE PORTRAIT — 
   Row 1: name + shift
   Row 2: buttons (side-by-side) + timer
========================================= */
body[data-layout="phone-portrait"] .card-header-grid {
  display: grid;
  grid-template-columns: auto auto;  /* col 1 = buttons, col 2 = timer */
  grid-template-rows: auto auto;     /* row1 = name, row2 = buttons+timer */
  column-gap: 8px;                   /* gap between button group + timer */
  row-gap: 4px;                      /* gap between name row and button row */
  align-items: center;
  width: 100%;
}

/* Row 1 — name + shift spans BOTH columns */
body[data-layout="phone-portrait"] .col-role-name {
  grid-column: 1 / 3;
  grid-row: 1;
}

/* Hide history on mobile */
body[data-layout="phone-portrait"] .col-history {
  display: none !important;
}

/* =========================================
   Row 2 — LEFT SIDE: BUTTONS (side-by-side)
========================================= */
body[data-layout="phone-portrait"] .col-buttons {
  grid-column: 1;
  grid-row: 2;
  display: grid !important;
  grid-template-columns: auto auto;  /* two buttons next to each other */
  column-gap: 6px;                   /* 🔥 adjust space between buttons */
  row-gap: 0;
  margin-top: 0;
  align-items: center;
  justify-content: flex-start;
}

/* Square buttons */
body[data-layout="phone-portrait"] .col-buttons .icon-btn {
  width: 24px;      /* 🔥 tweak size */
  height: 24px;     /* must match for true square */
  font-size: 16px;  /* tweak icon size */
  padding: 0;
  border-radius: 6px;
}

/* =========================================
   Row 2 — RIGHT SIDE: TIMER
========================================= */
body[data-layout="phone-portrait"] .col-timer {
  grid-column: 2;
  grid-row: 1 / 3;
  display: flex;              /* enable centering */
  align-items: center;        /* vertical center */
  justify-content: flex-end;  /* keep it right-aligned horizontally */
  text-align: right;
  padding-right: 12px;
  font-size: 18px;
}


/* =========================================
   PHONE PORTRAIT — mini-card adjustments
========================================= */
body[data-layout="phone-portrait"] .mini-card-wrapper {
  margin-top: -10px;        /* tighten spacing if you want */
}

body[data-layout="phone-portrait"] .mini-card {
  width: 100% !important;          /* full width */
  margin: 0 !important;            /* remove right offset */
  grid-template-columns: 1fr auto auto; /* name | X button | timer */
  gap: 6px;                        /* adjust spacing inside */
  height: 42px;                    /* tweak as needed */
  padding: 6px 10px;
  margin-right: 24px !important;
}

/* Smaller, mobile-friendly name */
body[data-layout="phone-portrait"] .mini-card .mini-name {
  font-size: 10px;                /* 🔥 tweak smaller or bigger */
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================
   Replace "End Cover" with a square X button
========================================= */
body[data-layout="phone-portrait"] .mini-card .mini-end-btn {
  width: 20px;                   /* 🔥 square size (tweak) */
  height: 20px;
  padding: 0;
  position: relative;
  color: transparent !important; /* hide original "End Cover" text */
  font-size: 0 !important;       /* neutralize text height */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* X replacement (visible) */
body[data-layout="phone-portrait"] .mini-card .mini-end-btn::before {
  content: "✕";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;               /* 🔥 X size */
  font-weight: 900;
  color: #fff;
}

/* Mini timer size */
body[data-layout="phone-portrait"] .mini-card .mini-timer {
  font-size: 10px; 
  margin-right: 0;
}

/* =========================================
   PHONE PORTRAIT — tighten inside/outside column gap
========================================= */
body[data-layout="phone-portrait"] .column {
  padding: 0 4px !important;       /* reduce space BETWEEN the two columns */
}

/* =========================================
   PHONE PORTRAIT — tighter card padding
   without exposing delete background
========================================= */
body[data-layout="phone-portrait"] .card {
  min-height: 0;
  height: auto;
  padding-top: 0;      /* outer shell has NO vertical padding */
  padding-bottom: 0;
}

/* The sliding inner card controls visual padding */
body[data-layout="phone-portrait"] .card-inner {
  min-height: 0;
  height: auto;

  /* 🔥 tighten these values */
  padding-top: 4px;     
  padding-bottom: 0px;  /* VERY tight bottom padding */
}

/* Prevent flex spacing from creating artificial height */
body[data-layout="phone-portrait"] .card-main {
  justify-content: flex-start;
}
