/* ============================================================
   Dark Minimalism — Century Gothic
   Inspired by Linear.app / Raycast
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg-base:    #252525;
  --bg-surface: #2e2e2e;
  --bg-raised:  #383838;
  --bg-hover:   #424242;
  --border:     #4e4e4e;
  --border-sub: #383838;
  --text:       #e8e8e8;
  --text-2:     #9a9a9a;
  --text-3:     #686868;
  --green:      #22c55e;
  --blue:       #3b82f6;
  --amber:      #f59e0b;
  --red:        #ef4444;
  --purple:     #a78bfa;
  --cyan:       #06b6d4;

  --radius-sm:  4px;
  --radius-md:  7px;
  --radius-lg:  10px;

  --transition: 140ms ease;
}

/* ── White Minimalism theme overrides ──────────────────────── */
[data-theme="white"] {
  --bg-base:    #f5f5f5;
  --bg-surface: #ffffff;
  --bg-raised:  #eeeeee;
  --bg-hover:   #e4e4e4;
  --border:     #cccccc;
  --border-sub: #e0e0e0;
  --text:       #1a1a1a;
  --text-2:     #6b6b6b;
  --text-3:     #9b9b9b;
  --green:      #16a34a;
  --blue:       #2563eb;
  --amber:      #d97706;
  --red:        #dc2626;
  --purple:     #7c3aed;
  --cyan:       #0891b2;
}

/* Scrollbars */
[data-theme="white"] ::-webkit-scrollbar-track { background: #e8e8e8; }
[data-theme="white"] ::-webkit-scrollbar-thumb { background: #c0c0c0; }
[data-theme="white"] ::-webkit-scrollbar-thumb:hover { background: #a0a0a0; }

/* Input / select hover borders */
[data-theme="white"] input:focus,
[data-theme="white"] textarea:focus,
[data-theme="white"] select:focus   { border-color: var(--blue) !important; }
[data-theme="white"] input:hover,
[data-theme="white"] select:hover   { border-color: #999 !important; }

/* Select option background */
[data-theme="white"] select option  { background: #fff; color: #1a1a1a; }

/* Table head */
[data-theme="white"] thead th       { background: var(--bg-hover); color: var(--text-2); }

/* Overdue / follow-up row tints */

/* Modal shadows */
[data-theme="white"] .modal-box {
  box-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.07);
}

/* Toasts */
[data-theme="white"] .toast-ok  { background: #f0fdf4; border-color: rgba(22,163,74,0.35); color: #166534; }
[data-theme="white"] .toast-err { background: #fef2f2; border-color: rgba(220,38,38,0.3);  color: #991b1b; }

/* Budget warning borders */
[data-theme="white"] .budget-warn   { border-color: rgba(217,119,6,0.5) !important; }
[data-theme="white"] .budget-danger { border-color: rgba(220,38,38,0.5) !important; }

/* Room cell */
[data-theme="white"] td.room-cell { background: var(--bg-surface); color: var(--text-3); }
[data-theme="white"] .sub-space { color: rgba(120, 70, 200, 0.75); }


/* Filter button active state */
[data-theme="white"] .filter-btn.active {
  background: rgba(120, 120, 120, 0.12);
  border-color: rgba(120, 120, 120, 0.55);
  color: var(--text);
  font-weight: 700;
}

/* Stat card value */
[data-theme="white"] .stat-value { color: var(--text); }


/* Gmail banner */
[data-theme="white"] .gmail-banner {
  background: rgba(37,99,235,0.06);
  border-bottom: 1px solid rgba(37,99,235,0.18);
}
[data-theme="white"] .gmail-banner button {
  background: transparent;
  border-color: var(--border);
  color: var(--text-2);
}
[data-theme="white"] .gmail-banner button:hover {
  background: var(--bg-hover);
  border-color: var(--text-3);
  color: var(--text);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-base);
  color: var(--text);
  font-family: 'Century Gothic', 'CenturyGothic', 'Futura', 'Trebuchet MS', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #4e4e4e;
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: #606060;
}

/* ── Keyframes ──────────────────────────────────────────────── */
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
  70%  { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

@keyframes amber-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.45); }
  70%  { box-shadow: 0 0 0 7px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ================================================================
   HEADER
   ================================================================ */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 16px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-sub);
  flex-shrink: 0;
  gap: 10px;
  z-index: 100;
}

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

header h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.05em;
  white-space: nowrap;
  margin-right: 4px;
}

/* Project select */
#project-select {
  appearance: none;
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 5px 28px 5px 10px;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23555' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  max-width: 180px;
}
#project-select:hover {
  border-color: #606060;
  background-color: var(--bg-hover);
}
#project-select:focus {
  border-color: var(--blue);
}
#project-select option {
  background: var(--bg-raised);
  color: var(--text);
}

/* Ghost minimal buttons — shared base */
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  white-space: nowrap;
  outline: none;
  line-height: 1;
}
.btn-ghost:hover {
  background: var(--bg-raised);
  color: var(--text);
  border-color: #606060;
}
.btn-ghost:active {
  background: var(--bg-hover);
}

/* Download button */
#download-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  white-space: nowrap;
  outline: none;
  line-height: 1;
}
#download-btn:hover {
  background: var(--bg-raised);
  border-color: var(--text-3);
  color: var(--text);
}
#download-btn:active {
  background: var(--bg-hover);
}

.btn-danger:hover {
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.35);
}

/* Last updated */
#last-updated {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

/* Undo / Redo buttons */
.btn-undo-redo {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-3);
  font-size: 16px;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  outline: none;
  padding: 0;
  line-height: 1;
}
.btn-undo-redo:hover {
  background: var(--bg-raised);
  color: var(--text);
  border-color: var(--text-3);
}

/* Upload button — gray default, red when has-changes */
#upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  outline: none;
  white-space: nowrap;
  line-height: 1;
}
#upload-btn:hover {
  background: var(--bg-raised);
  border-color: var(--text-3);
  color: var(--text);
}
#upload-btn.has-changes {
  color: #ff6363;
  border-color: rgba(255, 99, 99, 0.45);
  background: rgba(255, 99, 99, 0.1);
  animation: amber-pulse 2s infinite;
}
#upload-btn.has-changes:hover {
  background: rgba(255, 99, 99, 0.18);
  border-color: rgba(255, 99, 99, 0.65);
}

/* ================================================================
   MENU
   ================================================================ */
.menu-container {
  position: relative;
  display: inline-block;
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  border-radius: var(--radius-md);
  outline: none;
}
.menu-toggle:hover {
  background: var(--bg-raised);
  color: var(--text);
  border-color: #606060;
}

.menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  min-width: 160px;
  z-index: 200;
  overflow: visible;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity var(--transition), visibility var(--transition), transform var(--transition);
  pointer-events: none;
}
.menu-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.menu-dropdown button {
  display: block;
  width: 100%;
  padding: 10px 14px;
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}
.menu-dropdown button:hover {
  background: var(--bg-raised);
  color: var(--text);
}
.menu-dropdown button:active {
  background: var(--bg-hover);
}

.menu-section-label {
  padding: 8px 14px 3px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  pointer-events: none;
}

.menu-divider {
  height: 1px;
  border: none;
  background: var(--border);
  margin: 4px 0;
}

/* Export flyout submenu */
.menu-item-with-sub {
  position: relative;
}
.menu-item-with-sub .has-submenu {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.menu-item-with-sub .submenu {
  display: none;
  position: absolute;
  top: 0;
  right: 100%;
  margin-right: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  min-width: 140px;
  overflow: hidden;
  z-index: 201;
}
.menu-item-with-sub:hover .submenu {
  display: block;
}
.submenu button {
  display: block;
  width: 100%;
  padding: 10px 14px;
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
}
.submenu button:hover {
  background: var(--bg-raised);
  color: var(--text);
}

/* Appearance toggle row */
.menu-appearance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-2);
  border-radius: var(--radius-md);
  transition: background var(--transition), color var(--transition);
  user-select: none;
}
.menu-appearance-row:hover { background: var(--bg-raised); color: var(--text); }

.theme-toggle {
  width: 36px;
  height: 20px;
  border-radius: 99px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  position: relative;
  flex-shrink: 0;
  transition: background 200ms ease, border-color 200ms ease;
}
.theme-toggle.on {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.5);
}
.theme-toggle-thumb {
  width: 14px;
  height: 14px;
  border-radius: 99px;
  background: var(--text-3);
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 200ms ease, background 200ms ease;
}
.theme-toggle.on .theme-toggle-thumb {
  transform: translateX(16px);
  background: var(--blue);
}

/* Pulse indicator — green dot */
.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  animation: pulse-ring 2.2s infinite;
}

/* ================================================================
   SUMMARY BAR
   ================================================================ */
.summary-bar {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-sub);
  flex-shrink: 0;
  padding: 10px 16px;
  gap: 10px;
}

.stat-card {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: background var(--transition);
  min-width: 0;
}
.stat-card:hover {
  background: var(--bg-raised);
}

/* Accent left borders for status cards */
.stat-card.confirmed,
.stat-card.pending,
.stat-card.purchased,
.stat-card.completed {
  border-left: 3px solid var(--text);
}
[data-theme="white"] .stat-card.confirmed,
[data-theme="white"] .stat-card.pending,
[data-theme="white"] .stat-card.purchased,
[data-theme="white"] .stat-card.completed {
  border-left: 3px solid var(--text-3);
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.stat-label-note {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.6;
}

/* Clickable stat cards */
.stat-clickable { cursor: pointer; }
.stat-clickable:hover { background: var(--bg-raised); }

/* Stat detail dropdown */
@keyframes statDropdownOpen {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.stat-detail-dropdown {
  position: fixed;
  z-index: 2000;
  width: 340px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 28px rgba(0,0,0,0.28), 0 2px 8px rgba(0,0,0,0.10);
  padding: 16px 18px;
  animation: statDropdownOpen 140ms ease;
}
.stat-detail-dropdown.hidden { display: none; }
.stat-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}
.stat-detail-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  margin-bottom: 4px;
}
.stat-detail-pct {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}
.stat-detail-sub {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 4px;
}
.stat-detail-secondary {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 10px;
}
.stat-detail-secondary-pct {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-2);
}
.stat-detail-secondary-label {
  font-size: 11px;
  color: var(--text-3);
}
.modal-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: var(--radius-md);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.modal-close:hover { background: var(--bg-hover); color: var(--text); }
.stat-detail-rooms {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stat-room-row {
  display: grid;
  grid-template-columns: 130px 1fr 70px;
  align-items: center;
  gap: 10px;
}
.stat-room-name {
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-room-bar-wrap {
  height: 6px;
  background: var(--bg-hover);
  border-radius: 99px;
  overflow: hidden;
}
.stat-room-bar {
  height: 100%;
  border-radius: 99px;
  transition: width 400ms ease;
  min-width: 2px;
}
.stat-room-nums {
  font-size: 11px;
  color: var(--text-2);
  text-align: right;
  white-space: nowrap;
}
.stat-room-pct {
  color: var(--text-3);
  font-size: 10px;
}

/* ================================================================
   FILTERS
   ================================================================ */
.filters {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-sub);
  flex-shrink: 0;
}

.filters label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

.filter-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  outline: none;
  white-space: nowrap;
  line-height: 1.4;
}
.filter-btn:hover {
  background: var(--bg-raised);
  color: var(--text);
  border-color: #606060;
}
.filter-btn.active {
  background: var(--text);
  color: #000;
  border-color: var(--text);
  font-weight: 700;
}

/* Search box */
.search-box {
  margin-left: auto;
  position: relative;
  display: flex;
  align-items: center;
}
.search-box input {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  padding: 5px 10px 5px 30px;
  outline: none;
  transition: border-color var(--transition), background var(--transition);
  width: 200px;
}
.search-box input::placeholder {
  color: var(--text-3);
}
.search-box input:hover {
  background: var(--bg-hover);
  border-color: #606060;
}
.search-box input:focus {
  border-color: var(--blue);
  background: var(--bg-raised);
}
.search-box::before {
  content: '';
  position: absolute;
  left: 10px;
  width: 12px;
  height: 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  pointer-events: none;
}

/* ================================================================
   TABLE WRAPPER
   ================================================================ */
.table-wrapper {
  flex: 1;
  overflow: auto;
  background: var(--bg-base);
}

/* ================================================================
   TABLE
   ================================================================ */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-base);
  table-layout: auto;
}

/* Head */
thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-surface);
  color: var(--text-2);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 9px 9px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: normal;
  line-height: 1.3;
  user-select: none;
}
thead th:first-child {
  padding-left: 16px;
}

/* Body rows */
tbody tr {
  border-bottom: 1px solid #333333;
  transition: background var(--transition);
}
tbody tr:hover {
  background: var(--bg-surface);
}
tbody tr:last-child {
  border-bottom: none;
}

/* Cells */
td {
  color: var(--text);
  padding: 10px 9px;
  font-size: 12px;
  vertical-align: middle;
  white-space: normal;
  word-break: break-word;
  overflow: visible;
}
td:first-child {
  padding-left: 16px;
}

/* Room cell — purple accent */
td.room-cell {
  color: var(--purple);
  background: #2a2a2a;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 0;
}
.room-cell-inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 10px 9px 10px 16px;
  min-height: 100%;
}
.room-cell-content {
  flex: 1;
  min-width: 0;
}

/* Sheet tab */
.sheet-tab {
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  cursor: pointer;
}
.sheet-tab:hover {
  color: var(--blue);
}

/* Sub-space row */
.sub-space {
  color: rgba(167, 139, 250, 0.6);
  font-size: 11px;
}
.sub-space:hover td {
  background: #302f35;
}

/* Add Row button */
.add-row-tr td {
  border-top: 1px dashed var(--border);
}
.add-row-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 18px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.add-row-btn:hover {
  background: var(--bg-raised);
  color: var(--text);
  border-color: #606060;
}

/* Row controls (checkbox + drag handle) */
.row-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.row-select {
  width: 13px;
  height: 13px;
  accent-color: var(--blue);
  cursor: pointer;
  flex-shrink: 0;
}
.drag-handle {
  cursor: grab;
  color: var(--text-3);
  font-size: 14px;
  line-height: 1;
  padding: 2px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  user-select: none;
}
.drag-handle:hover {
  color: var(--text);
  background: var(--bg-raised);
}
.drag-handle:active {
  cursor: grabbing;
}

/* Sub-space placeholder */
.sub-space-placeholder {
  color: var(--text-3);
  opacity: 0.4;
  font-style: italic;
  font-size: 10px;
}

/* Drag feedback */
tr.dragging {
  opacity: 0.3;
}
.drag-placeholder td {
  padding: 0 !important;
  border: none !important;
}
.drag-line {
  height: 2px;
  background: var(--blue);
  border-radius: 1px;
  box-shadow: 0 0 6px rgba(59, 130, 246, 0.5);
}

/* Batch action bar */
#batch-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 4px 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--text);
  animation: toast-in 180ms ease;
}
#batch-count {
  font-weight: 600;
  color: var(--text-2);
}
.batch-delete-btn {
  padding: 3px 10px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.batch-delete-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--text-3);
}
[data-theme="white"] .batch-delete-btn {
  background: rgba(0, 0, 0, 0.04);
}
[data-theme="white"] .batch-delete-btn:hover {
  background: rgba(0, 0, 0, 0.09);
  border-color: var(--text-3);
}
.batch-cancel-btn {
  padding: 3px 8px;
  font-family: inherit;
  font-size: 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.batch-cancel-btn:hover {
  background: var(--bg-raised);
  color: var(--text);
}
.batch-duplicate-btn {
  padding: 3px 10px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.batch-duplicate-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--text-3);
}
[data-theme="white"] .batch-duplicate-btn {
  background: rgba(0, 0, 0, 0.04);
}
[data-theme="white"] .batch-duplicate-btn:hover {
  background: rgba(0, 0, 0, 0.09);
  border-color: var(--text-3);
}


/* Price cell — green */
td.price-cell {
  color: var(--green);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* Link cell */
td.link-cell a {
  color: var(--blue);
  text-decoration: none;
  transition: color var(--transition), text-decoration var(--transition);
}
td.link-cell a:hover {
  color: #93bbfd;
  text-decoration: underline;
}

/* Editable cells */
td.editable {
  position: relative;
  cursor: text;
}
td.editable:hover::after {
  content: '✎';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--text-3);
  pointer-events: none;
  opacity: 0.7;
}

td.editable input,
td.editable select,
td.editable textarea {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--blue);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  padding: 4px 7px;
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
  transition: border-color var(--transition), box-shadow var(--transition);
}
td.editable textarea {
  resize: vertical;
  min-height: 60px;
}
td.editable input:focus,
td.editable select:focus,
td.editable textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}
td.editable select option {
  background: var(--bg-raised);
  color: var(--text);
}

/* Sub-edit input */
.sub-edit-input {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  padding: 4px 7px;
  outline: none;
  transition: border-color var(--transition);
  width: 100%;
}
.sub-edit-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
}
.status-badge.status-pending {
  color: var(--amber);
  background: rgba(245, 158, 11, 0.10);
  border: 1px solid rgba(245, 158, 11, 0.22);
}
.status-badge.status-submitted {
  color: var(--blue);
  background: rgba(59, 130, 246, 0.10);
  border: 1px solid rgba(59, 130, 246, 0.22);
}
.status-badge.status-approved {
  color: var(--green);
  background: rgba(34, 197, 94, 0.10);
  border: 1px solid rgba(34, 197, 94, 0.22);
}
.status-badge.status-ordered {
  color: var(--purple);
  background: rgba(167, 139, 250, 0.10);
  border: 1px solid rgba(167, 139, 250, 0.22);
}
.status-badge.status-shipped {
  color: var(--blue);
  background: rgba(59, 130, 246, 0.10);
  border: 1px solid rgba(59, 130, 246, 0.22);
}
.status-badge.status-delivered {
  color: var(--cyan);
  background: rgba(6, 182, 212, 0.10);
  border: 1px solid rgba(6, 182, 212, 0.22);
}

.confirm-badge-y {
  background: rgba(72, 199, 142, 0.15);
  color: var(--green);
  border: 1px solid rgba(72, 199, 142, 0.4);
}
.confirm-badge-n {
  background: rgba(255, 99, 99, 0.15);
  color: #ff6363;
  border: 1px solid rgba(255, 99, 99, 0.4);
}
.confirm-badge-none {
  background: transparent;
  color: var(--text-3);
  border: 1px solid transparent;
}

/* Fetch price inline button */
.fetch-price-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(120, 120, 120, 0.35);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  outline: none;
  white-space: nowrap;
}
.fetch-price-btn:hover {
  background: rgba(120, 120, 120, 0.12);
  border-color: rgba(120, 120, 120, 0.55);
}
.fetch-price-btn.fetch-ok {
  border-color: rgba(34, 197, 94, 0.45);
  color: var(--green);
  background: rgba(34, 197, 94, 0.08);
}
.fetch-price-btn.fetch-ok:hover {
  background: rgba(34, 197, 94, 0.15);
}
.fetch-price-btn.fetch-fail {
  border-color: rgba(255, 99, 99, 0.45);
  color: #ff6363;
  background: rgba(255, 99, 99, 0.08);
}
.fetch-price-btn.fetch-fail:hover {
  background: rgba(255, 99, 99, 0.15);
}

/* Image thumbnail cell */
td.img-cell {
  text-align: center;
  padding: 6px;
  width: 72px;
}
.row-thumb {
  width: 100%;
  height: auto;
  max-height: 120px;
  object-fit: contain;
  border-radius: 4px;
  border: 1px solid var(--border);
  display: block;
  transition: opacity var(--transition);
}
.row-thumb:hover {
  opacity: 0.8;
}

/* Dirty cell — unsaved change indicator */
td.dirty {
  background: #2e2800;
  box-shadow: inset 2px 0 0 var(--amber);
}
[data-theme="white"] td.dirty {
  background: rgba(255, 200, 0, 0.15);
}

/* Loading cell */
.loading-cell {
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  padding: 24px 0;
  font-style: italic;
}

/* Empty state — no projects */
.empty-state {
  text-align: center;
  padding: 80px 20px !important;
}
.empty-icon {
  font-size: 40px;
  margin-bottom: 16px;
  opacity: 0.5;
}
.empty-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.empty-sub {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
}

/* ================================================================
   PRICE PANEL  (fixed bottom-right)
   ================================================================ */
.price-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 280px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4);
  z-index: 200;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.price-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.price-panel-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
}

.price-panel-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-2);
}
.price-panel-row .val {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.price-panel-close {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
  transition: color var(--transition);
}
.price-panel-close:hover {
  color: var(--text);
}

/* Price fetch log */
.price-log {
  padding: 10px 14px;
  max-height: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.log-line {
  font-size: 11px;
  padding: 2px 0;
  line-height: 1.4;
}
.log-fetch { color: var(--text-3); }
.log-ok    { color: var(--green); }
.log-fail  { color: var(--red); }
.log-skip  { color: var(--text-3); }
.log-done  { color: var(--cyan); font-weight: 700; }

/* Fetch summary (shown after done) */
.fetch-summary {
  display: flex;
  gap: 10px;
  padding: 8px 0 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.sum-ok   { color: var(--green); font-size: 12px; font-weight: 700; }
.sum-fail { color: var(--red);   font-size: 12px; font-weight: 700; }
.sum-skip { color: var(--text-3);font-size: 12px; font-weight: 600; }

.fetch-section { margin-bottom: 10px; }
.fetch-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.ok-title   { color: var(--green); }
.fail-title { color: var(--red); }

/* ================================================================
   MODAL
   ================================================================ */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.72);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal.open {
  display: flex;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7), 0 4px 16px rgba(0, 0, 0, 0.5);
  padding: 28px;
  width: min(440px, calc(100vw - 40px));
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: toast-in 180ms ease;
}

.modal-box h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.modal-box p {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.6;
}

.modal-box label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  display: block;
  margin-bottom: 5px;
}
.label-optional {
  font-weight: 400;
  opacity: 0.5;
  text-transform: none;
  letter-spacing: 0;
}

.modal-box input,
.modal-box select,
.modal-box textarea {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 11px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.modal-box input:focus,
.modal-box select:focus,
.modal-box textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.modal-box input::placeholder,
.modal-box textarea::placeholder {
  color: var(--text-3);
}
.modal-box textarea {
  resize: vertical;
  min-height: 80px;
}
.modal-box select option {
  background: var(--bg-raised);
  color: var(--text);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.modal-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  outline: none;
}
.modal-btn:hover {
  background: var(--bg-raised);
  color: var(--text);
  border-color: #606060;
}
.modal-btn.primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.modal-btn.primary:hover {
  background: #5294f7;
  border-color: #5294f7;
}
.modal-btn.danger {
  color: var(--red);
  border-color: rgba(239, 68, 68, 0.35);
}
.modal-btn.danger:hover {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.55);
}

/* ================================================================
   TOAST
   ================================================================ */
.toast {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 600;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 18px;
  white-space: nowrap;
  pointer-events: none;
  animation: toast-in 180ms ease;
}
.toast.show {
  display: block;
}
.toast.error {
  border-color: rgba(239, 68, 68, 0.5);
  background: #3a2020;
  color: #fca5a5;
}
.toast.success {
  border-color: rgba(34, 197, 94, 0.4);
  background: #1e3025;
  color: #86efac;
}

/* Action toast (with confirm/dismiss buttons) */
.action-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 601;
  background: var(--bg-raised);
  border: 1px solid var(--amber);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  animation: toast-in 180ms ease;
}
.action-toast.hidden { display: none; }
.action-toast-btns { display: flex; gap: 6px; }
.action-toast-btns button {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-hover);
  color: var(--text);
  transition: background var(--transition);
}
.action-toast-btns button:first-child {
  background: var(--amber);
  border-color: var(--amber);
  color: #000;
}
.action-toast-btns button:first-child:hover { opacity: 0.85; }
.action-toast-btns button:last-child:hover { background: var(--bg-base); }

[data-theme="white"] .action-toast {
  border-color: var(--border);
}
[data-theme="white"] .action-toast-btns button:first-child {
  background: var(--bg-hover);
  border-color: var(--border);
  color: var(--text);
}

/* ================================================================
   MISC UTILITIES
   ================================================================ */
button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
}

.hidden {
  display: none !important;
}

/* ── Cell utility classes ─────────────────────────────────── */
.cell-center { text-align: center; }
.add-row-cell { padding: 12px; }

/* Thin divider used inside panels */
.divider {
  height: 1px;
  background: var(--border);
  margin: 2px 0;
}

/* ── Budget warning on stat card ─────────────────────────────── */
.stat-card.budget-warning {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.06);
}
.stat-card.budget-warning .stat-value {
  color: var(--amber);
}
.stat-card.budget-critical {
  border-color: rgba(245, 158, 11, 0.7);
  background: rgba(245, 158, 11, 0.09);
  animation: amber-pulse 2s infinite;
}
.stat-card.budget-critical .stat-value {
  color: var(--amber);
}
.stat-card.over-budget {
  border-color: rgba(239, 68, 68, 0.6);
  background: rgba(239, 68, 68, 0.07);
}
.stat-card.over-budget .stat-value {
  color: var(--red);
}
.stat-remaining {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0;
  margin-top: 1px;
}
.stat-limit {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-3);
  letter-spacing: 0;
}


/* Room Complete badge on filter buttons */
.filter-btn .room-complete {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  margin-left: 4px;
  vertical-align: middle;
}

/* Duplicate highlight */
.row-highlight {
  animation: highlight-flash 1.5s ease;
}
@keyframes highlight-flash {
  0%   { background: rgba(59, 130, 246, 0.2); }
  100% { background: transparent; }
}

/* ── Budget modal inputs ──────────────────────────────────────── */
.budget-inputs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}
.budget-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.budget-row-total label {
  font-size: 13px;
  font-weight: 700;
  color: var(--blue);
}
.budget-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 6px 0;
}
.budget-row label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  margin: 0;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.budget-input-wrap {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-raised);
  overflow: hidden;
  flex-shrink: 0;
}
.budget-currency {
  padding: 6px 8px;
  color: var(--text-3);
  font-size: 12px;
  border-right: 1px solid var(--border);
  background: var(--bg-hover);
  line-height: 1;
}
.budget-input-wrap input {
  width: 110px;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  padding: 6px 8px;
  outline: none;
}
.budget-input-wrap input:focus {
  box-shadow: none;
}

/* ── Column widths (15 cols) ── */
thead th:nth-child(1),  tbody td:nth-child(1)  { width: 115px; min-width: 115px; }  /* Room */
thead th:nth-child(2),  tbody td:nth-child(2)  { width: 115px; min-width: 105px; }  /* Fixture */
thead th:nth-child(3),  tbody td:nth-child(3)  { width:  42px; min-width:  42px; }  /* Qty */
thead th:nth-child(4),  tbody td:nth-child(4)  { width: 100px; min-width:  90px; }  /* Brand */
thead th:nth-child(5),  tbody td:nth-child(5)  { width: 110px; min-width: 100px; }  /* Type / Color */
thead th:nth-child(6),  tbody td:nth-child(6)  { width: 191px; min-width: 176px; }  /* Dimension */
thead th:nth-child(7),  tbody td:nth-child(7)  { width:  80px; min-width:  75px; }  /* Price */
thead th:nth-child(8),  tbody td:nth-child(8)  { width:  56px; min-width:  56px; }  /* Fetch $ */
thead th:nth-child(9),  tbody td:nth-child(9)  { width:  72px; min-width:  72px; }  /* Image */
thead th:nth-child(10), tbody td:nth-child(10) { width:  52px; min-width:  52px; }  /* Link */
thead th:nth-child(11), tbody td:nth-child(11) { width:  68px; min-width:  68px; }  /* Client Confirm */
thead th:nth-child(12), tbody td:nth-child(12) { width: 128px; min-width: 116px; }  /* Notes */
thead th:nth-child(13), tbody td:nth-child(13) { width: 205px; min-width: 205px; }  /* Shipping Info */
thead th:nth-child(14), tbody td:nth-child(14) { width:  80px; min-width:  72px; }  /* Status */
thead th:nth-child(15), tbody td:nth-child(15) { width:  52px; min-width:  48px; }  /* Spec Sheet */

/* Center data cells (not headers) for button-type columns */
tbody td:nth-child(11) { text-align: center; }  /* Client Confirm */
tbody td:nth-child(14) { text-align: center; }  /* Status */

/* Dimension cell — wrappable */
tbody td:nth-child(6) {
  white-space: normal;
  line-height: 1.4;
}

/* ── Gmail integration ─────────────────────────────────────────── */

/* Auth banner */
.gmail-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  background: rgba(59, 130, 246, 0.08);
  border-bottom: 1px solid rgba(59, 130, 246, 0.2);
  font-size: 12px;
  color: var(--text-2);
  flex-shrink: 0;
}
.gmail-banner.hidden { display: none; }
.gmail-banner span { flex: 1; }
.gmail-banner button {
  padding: 3px 10px;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: var(--radius-sm);
  color: #7eb3f8;
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
  transition: background var(--transition);
  white-space: nowrap;
}
.gmail-banner button:hover { background: rgba(59, 130, 246, 0.25); }
.gmail-banner-logout {
  background: transparent !important;
  border: 1px solid rgba(239,68,68,0.3) !important;
  color: #f98080 !important;
}
.gmail-banner-logout:hover { background: rgba(239,68,68,0.1) !important; }
.gmail-banner-dismiss {
  background: transparent !important;
  border: none !important;
  color: var(--text-3) !important;
  font-size: 13px !important;
  padding: 2px 6px !important;
}
.gmail-banner-dismiss:hover { color: var(--text-2) !important; }

/* Per-row Gmail fetch button in the Shipping Info cell */
.gmail-fetch-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  margin-left: 0;
  margin-right: 4px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(120, 120, 120, 0.35);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  outline: none;
  white-space: nowrap;
  vertical-align: middle;
}
.gmail-fetch-btn:hover { background: rgba(120, 120, 120, 0.12); border-color: rgba(120, 120, 120, 0.55); color: var(--text); }
.gmail-fetch-btn:disabled { opacity: 0.45; cursor: default; }
.gmail-fetch-btn.ok   { border-color: rgba(34,197,94,0.45);  color: var(--green); background: rgba(34,197,94,0.08); }
.gmail-fetch-btn.ok:hover  { background: rgba(34,197,94,0.15); }
.gmail-fetch-btn.fail { border-color: rgba(255,99,99,0.45);   color: #ff6363;      background: rgba(255,99,99,0.08); }
.gmail-fetch-btn.fail:hover { background: rgba(255,99,99,0.15); }

/* ── Shipping Info compound cell ────────────────────────────── */
.shipping-info-cell {
  padding: 4px 6px;
  min-width: 180px;
}
.shipping-info-inner {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.shipping-info-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ship-field {
  display: flex;
  align-items: baseline;
  gap: 6px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.ship-field:hover {
  background: var(--bg-hover);
}
.ship-label {
  font-size: 10px;
  color: var(--text-3);
  white-space: nowrap;
  min-width: 58px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.ship-value {
  font-size: 12px;
  color: var(--text);
  word-break: break-all;
}
.ship-value a {
  color: var(--blue);
  text-decoration: none;
}
.ship-value a:hover {
  text-decoration: underline;
}
.ship-edit-input {
  width: 100%;
  font-family: inherit;
  font-size: 12px;
  padding: 2px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  outline: none;
}
.ship-edit-input:focus {
  border-color: var(--blue);
}

/* Gmail confirm modal — wider box */
.gmail-confirm-box { min-width: 520px; max-width: 640px; }

/* Results list */
.gmail-results-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
  max-height: 220px;
  overflow-y: auto;
}
.gmail-result-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-sub);
  background: var(--bg-raised);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.gmail-result-item:hover { border-color: var(--border); background: var(--bg-hover); }
.gmail-result-item.selected { border-color: rgba(59,130,246,0.5); background: rgba(59,130,246,0.07); }
.gmail-result-radio {
  width: 13px; height: 13px; flex-shrink: 0; margin-top: 2px;
  border-radius: 50%;
  border: 2px solid var(--border);
  transition: border-color var(--transition), background var(--transition);
}
.gmail-result-item.selected .gmail-result-radio {
  border-color: #7eb3f8;
  background: #7eb3f8;
}
.gmail-result-info { flex: 1; min-width: 0; }
.gmail-result-subject {
  font-size: 12px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gmail-result-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.gmail-result-meta strong { color: var(--text-2); }
.gmail-confidence-high   { color: var(--green); }
.gmail-confidence-medium { color: var(--amber); }
.gmail-confidence-low    { color: var(--text-3); }

/* Gmail confirm modal fields */
.gmail-meta {
  font-size: 11px;
  color: var(--text-2);
  margin-bottom: 12px;
  padding: 8px 10px;
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-sub);
  line-height: 1.7;
}
.gmail-search-row {
  display: flex;
  gap: 8px;
  margin: 10px 0 4px;
}
.gmail-search-row input {
  flex: 1;
  padding: 6px 10px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-1);
  font-size: 12px;
  font-family: inherit;
}
.gmail-search-row input:focus { outline: none; border-color: var(--text-2); }
.gmail-search-btn {
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-2);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.gmail-search-btn:hover { border-color: var(--text-1); color: var(--text-1); }
.gmail-search-btn:disabled { opacity: 0.5; cursor: default; }

.gmail-confirm-fields {
  display: flex;
  gap: 12px;
}
.gmail-confirm-fields label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  color: var(--text-2);
}
.gmail-confirm-fields input {
  padding: 6px 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
}

/* ── Shipping Report Modal ──────────────────────────────────── */
.sr-modal-box {
  width: 640px;
  max-width: 96vw;
  max-height: 86vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.sr-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.sr-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}
.sr-section {
  border-top: 1px solid var(--border-sub);
  padding: 16px 0 8px;
}
.sr-section.hidden { display: none; }
.sr-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-2);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sr-select-all-wrap {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 3px;
}
.sr-link-btn {
  background: none;
  border: none;
  color: var(--blue);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.sr-section-label > .sr-link-btn {
  font-size: 11px;
  margin-left: auto;
}
.sr-count {
  font-weight: 400;
  color: var(--text-3);
  text-transform: none;
  letter-spacing: 0;
}
.sr-project-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.sr-project-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  transition: border-color var(--transition), background var(--transition);
  user-select: none;
}
.sr-project-checkbox input { margin: 0; cursor: pointer; }
.sr-project-checkbox:hover { border-color: var(--blue); }
.sr-load-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
}
.sr-load-btn:hover { background: var(--bg-raised); }

/* Items table */
.sr-items-wrap { margin-bottom: 14px; }
.sr-project-group { margin-bottom: 16px; }
.sr-project-group-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}
.sr-item-row {
  display: grid;
  grid-template-columns: 1fr 90px 1fr;
  gap: 8px;
  align-items: center;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-sub);
  font-size: 12px;
}
.sr-item-row:last-child { border-bottom: none; }
.sr-item-name { color: var(--text); font-weight: 500; }
.sr-item-room { color: var(--text-3); font-size: 11px; }
.sr-item-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  text-align: center;
  width: fit-content;
}
.sr-status-Ordered  { background: rgba(59,130,246,0.15); color: var(--blue); }
.sr-status-Shipped  { background: rgba(59,130,246,0.25); color: var(--blue); }
.sr-status-Delivered{ background: rgba(34,197,94,0.15);  color: var(--green); }
.sr-date-text {
  width: 100%;
  font-family: inherit;
  font-size: 12px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 4px 8px;
  box-sizing: border-box;
}
.sr-date-text:hover, .sr-date-text:focus { border-color: var(--blue); outline: none; }
.sr-item-tracking {
  font-size: 11px;
  color: var(--text-3);
  grid-column: 1 / -1;
  padding-bottom: 2px;
}
.sr-item-tracking a { color: var(--blue); text-decoration: none; }
.sr-item-tracking a:hover { text-decoration: underline; }

/* Output */
.sr-output {
  width: 100%;
  height: 220px;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px;
  resize: vertical;
  box-sizing: border-box;
  margin-top: 8px;
}

/* ── Splash Screen ──────────────────────────────────────────── */
@keyframes splashScreenOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes splashTitleIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#splash-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #252525;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  /* 背景在 3.2s 後開始淡出，歷時 0.6s */
  animation: splashScreenOut 0.6s ease 1.9s forwards;
}

#splash-title {
  font-family: 'Century Gothic', 'CenturyGothic', 'AppleGothic', sans-serif;
  font-size: 2.2rem;
  font-weight: 400;
  letter-spacing: 0.18em;
  color: #e8e8e8;
  text-transform: uppercase;
  opacity: 0;
  /* 文字在 0.2s 後開始淡入，歷時 0.9s */
  animation: splashTitleIn 0.9s ease 0.2s forwards;
}

/* ================================================================
   MOBILE RESPONSIVE
   ================================================================ */
@media (max-width: 640px) {

  /* Header */
  header {
    height: auto;
    min-height: 52px;
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 6px;
  }
  header h1 {
    display: none;
  }
  .header-left {
    gap: 4px;
    flex-wrap: wrap;
  }
  .header-right {
    gap: 4px;
  }
  #last-updated {
    display: none;
  }

  /* Stats bar — horizontal scroll */
  .summary-bar {
    overflow-x: auto;
    overflow-y: visible;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding: 8px 12px;
    gap: 8px;
    scrollbar-width: none;
  }
  .summary-bar::-webkit-scrollbar {
    display: none;
  }
  .stat-card {
    min-width: 105px;
    flex: 0 0 auto;
  }
  .stat-value {
    font-size: 16px;
  }
  .stat-label {
    font-size: 9px;
    white-space: nowrap;
  }
  .stat-label-note {
    display: none;
  }

  /* Filters */
  .filters {
    padding: 6px 12px;
    gap: 8px;
    flex-wrap: wrap;
  }
  /* Room tags — horizontal scroll instead of wrapping */
  .filter-buttons {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex: 1;
    min-width: 0;
  }
  .filter-buttons::-webkit-scrollbar {
    display: none;
  }

  /* Gmail banner */
  .gmail-banner {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    font-size: 12px;
  }

  /* Table wrapper — ensure horizontal scroll */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}
