/* ═══════════════════════════════════════════
   Casa Regal — HK Tracker
   hktracker.css  |  Standalone
   ═══════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg      : #f4f6f9;
  --surface : #ffffff;
  --border  : #e2e6ed;
  --text    : #1a1f2e;
  --muted   : #6b7280;
  --accent  : #4f6ef7;
  --radius  : 12px;
  --shadow  : 0 2px 12px rgba(0,0,0,.07);

  /* task type colours */
  --c-setup    : #3b82f6;
  --c-noguest  : #f59e0b;
  --c-cursory  : #8b5cf6;
  --c-cleaning : #22c55e;
  --c-skip     : #d1d5db;

  --bg-setup    : #eff6ff;
  --bg-noguest  : #fffbeb;
  --bg-cursory  : #f5f3ff;
  --bg-cleaning : #f0fdf4;
  --bg-skip     : #f9fafb;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
}

/* ── Auth screens ───────────────────────────── */
.hkt-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 14px;
  text-align: center;
  padding: 24px;
}
.hkt-screen h2 { font-size: 20px; font-weight: 700; }
.hkt-screen p  { color: var(--muted); font-size: 14px; max-width: 300px; }
.hkt-spin {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Header ─────────────────────────────────── */
.hkt-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 54px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.hkt-brand {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.3px;
  white-space: nowrap;
}
.hkt-brand span { color: var(--accent); }
.hkt-header-sep { flex: 1; }

/* ── Filter bar (search + pending — sits below header) ── */
.hkt-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 54px;
  z-index: 90;
}
.hkt-filter-bar .hkt-search-input {
  flex: 1;
  width: auto;
}

.hkt-date-input {
  padding: 4px 10px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  cursor: pointer;
}
.hkt-date-input:focus { outline: none; border-color: var(--accent); }

.hkt-search-input {
  padding: 4px 10px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  width: 160px;
  flex-shrink: 0;
  transition: border-color .15s;
}
.hkt-search-input:focus { outline: none; border-color: var(--accent); }
.hkt-search-input::placeholder { color: var(--muted); font-size: 12px; }


.hkt-btn {
  padding: 5px 12px;
  border-radius: 7px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.hkt-btn:hover           { border-color: var(--accent); color: var(--accent); }
.hkt-btn-danger:hover    { border-color: #dc2626; color: #dc2626; }
.hkt-btn-ops {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 700;
}
.hkt-btn-ops:hover { background: #3d5ce8; border-color: #3d5ce8; color: #fff; }

/* ── Loading bar ────────────────────────────── */
#hkt-loading-bar {
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #818cf8, var(--accent));
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Error bar ──────────────────────────────── */
#hkt-error {
  display: none;
  background: #fee2e2;
  color: #dc2626;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 20px;
  border-bottom: 1px solid #fecaca;
}

/* ── Live dot ───────────────────────────────── */
.hkt-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  transition: background .4s;
}
.hkt-live-dot.is-live {
  background: #22c55e;
  animation: live-pulse 2s ease-in-out infinite;
}
.hkt-live-dot.is-flash {
  background: #f59e0b !important;
  box-shadow: 0 0 8px 2px rgba(245,158,11,.5);
  animation: none !important;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,.5); }
  70%  { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

/* ── Main body ──────────────────────────────── */
main#hkt-body {
  padding: 18px 20px 32px;
  max-width: 1400px;
  margin: 0 auto;
}
.hkt-placeholder {
  text-align: center;
  padding: 64px 20px;
  color: var(--muted);
  font-size: 14px;
}

/* ── Progress tiles row ─────────────────────── */
.hkt-progress-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.hkt-prog-tile {
  flex: 1 1 140px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow);
  transition: border-color .2s;
}
.hkt-prog-tile.is-complete { border-color: #86efac; background: #f0fdf4; }
.hkt-prog-tile.tile-active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.hkt-prog-tile:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.1); }

.hkt-pending-btn {
  margin-left: auto;
  padding: 4px 14px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s, border-color .15s;
}
.hkt-pending-btn:hover { border-color: #f59e0b; color: #92400e; }
.hkt-pending-btn.active { background: #fef08a; border-color: #f59e0b; color: #78350f; }
.hkt-prog-tile-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}
.hkt-prog-tile-nums {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.hkt-prog-tile-done {
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}
.hkt-prog-tile-total {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.hkt-prog-bar-track {
  height: 5px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
}
.hkt-prog-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.hkt-prog-tile-pct {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.hkt-celebrate {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  width: 100%;
  animation: pop .35s cubic-bezier(.175,.885,.32,1.275) both;
}
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ── Schedule header ────────────────────────── */
.hkt-schedule-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.hkt-schedule-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.hkt-saved-lbl {
  font-size: 11px;
  color: var(--muted);
}

/* ── Lanes grid ─────────────────────────────── */
.hkt-lanes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

/* ── Lane (group) card ──────────────────────── */
.hkt-lane {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.hkt-lane.all-done {
  border: 2px solid #16a34a;
}
.hkt-lane-hdr {
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
}
.hkt-lane.all-done .hkt-lane-hdr { background: #dcfce7; }
.hkt-lane-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.hkt-lane-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}
.hkt-lane-frac {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.hkt-lane-bar-track {
  height: 4px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}
.hkt-lane-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .5s cubic-bezier(.4,0,.2,1);
}
.hkt-lane.all-done .hkt-lane-bar-fill { background: #22c55e; }

/* Staff chips */
.hkt-staff-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.hkt-staff-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.hkt-no-staff {
  font-size: 11px;
  color: var(--muted);
  font-style: italic;
}

/* ── Property cards inside lane ─────────────── */
.hkt-lane-body { display: flex; flex-direction: column; }

.hkt-card {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border);
  transition: background .15s;
}
.hkt-card:last-child { border-bottom: none; }
.hkt-card.is-done {
  background: #dcfce7;
  border-left: 4px solid #16a34a;
}
.hkt-card.is-done .hkt-card-accent {
  background: #16a34a !important;  /* override inline task-colour */
}
.hkt-card.is-arrived { background: #eff6ff; }

.hkt-card-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
}
.hkt-card-accent {
  width: 4px;
  min-height: 38px;
  border-radius: 999px;
  flex-shrink: 0;
  align-self: stretch;
}
.hkt-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hkt-card-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hkt-card-type {
  font-size: 11px;
  font-weight: 600;
}
.hkt-card-status { flex-shrink: 0; }

.hkt-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.hkt-status-pending { background: #fffbeb; color: #92400e; }
.hkt-status-arrived { background: #eff6ff; color: #1e40af; }
.hkt-status-done    { background: #16a34a; color: #fff; }

/* Done notes */
.hkt-card-notes {
  margin: 0 14px 10px 28px;
  font-size: 11px;
  color: var(--muted);
  background: #f8f9fa;
  border-radius: 6px;
  padding: 5px 8px;
  border-left: 2px solid var(--border);
  line-height: 1.5;
  word-break: break-word;
}

/* ── Empty state ────────────────────────────── */
.hkt-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.hkt-empty-icon { font-size: 40px; margin-bottom: 12px; }
.hkt-empty-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.hkt-empty-sub { font-size: 13px; }

/* ── Responsive ─────────────────────────────── */
@media (max-width: 640px) {
  /* ── Header: hide labels, keep icons only ── */
  .hkt-header { padding: 0 10px; gap: 6px; height: 48px; }
  .hkt-brand  { display: none; }                       /* remove brand text */
  .hkt-filter-bar { padding: 8px 12px; top: 48px; }
  .hkt-pending-btn  { padding: 3px 8px; font-size: 11px; }
  .hkt-btn { padding: 4px 8px; font-size: 11px; }
  .hkt-btn-ops { padding: 4px 8px; }
  /* Refresh and logout — icon only */
  #hkt-refresh { font-size: 16px; padding: 4px 7px; }
  #hkt-logout  { font-size: 16px; padding: 4px 7px; border-color: #dc2626; color: #dc2626; }
  .hkt-timestamp { display: none; }

  /* ── Body ── */
  main#hkt-body { padding: 10px 10px 24px; }

  /* ── Progress tiles: 2 per row, compact ── */
  .hkt-progress-row { gap: 8px; margin-bottom: 14px; }
  .hkt-prog-tile { flex: 1 1 calc(50% - 4px); padding: 8px 10px; gap: 4px; border-radius: 8px; }
  .hkt-prog-tile-label { font-size: 9px; }
  .hkt-prog-tile-done  { font-size: 20px; }
  .hkt-prog-tile-total { font-size: 12px; }
  .hkt-prog-tile-pct   { font-size: 10px; }
  .hkt-prog-bar-track  { height: 3px; }
  .hkt-celebrate { font-size: 13px; width: 100%; }

  /* ── Schedule header ── */
  .hkt-schedule-hdr { margin-bottom: 8px; }
  .hkt-schedule-title { font-size: 11px; }
  .hkt-saved-lbl { display: none; }

  /* ── Lanes: 1 column ── */
  .hkt-lanes { grid-template-columns: 1fr; gap: 10px; }
  .hkt-lane-hdr { padding: 8px 12px; }
  .hkt-lane-title { font-size: 12px; }

  /* ── Cards ── */
  .hkt-card { padding: 0; }
  .hkt-card-row { padding: 8px 10px; gap: 8px; }
  .hkt-card-name { font-size: 13px; }
}

/* ── Manager note on card ──────────────────── */
.hkt-card-note {
  margin: 0 14px 10px 28px;
}
.hkt-note-view {
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: background .15s, border-color .15s;
  border: 1.5px dashed var(--border);
}
.hkt-note-view:hover { border-color: var(--accent); }
.hkt-note-filled {
  background: #fffbeb;
  border-style: solid;
  border-color: #fde68a;
}
.hkt-note-empty { background: transparent; }
.hkt-note-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.hkt-note-arr {
  font-size: 11px;
  font-weight: 700;
  color: #92400e;
}
.hkt-note-txt {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
  word-break: break-word;
}
.hkt-note-placeholder {
  font-size: 11px;
  color: #9ca3af;
  font-style: italic;
}
.hkt-note-edit-icon {
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}

/* Note edit form */
.hkt-note-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1.5px solid var(--border);
}
.hkt-note-field-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.hkt-note-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.hkt-note-time-inp {
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  width: 130px;
}
.hkt-note-time-inp:focus { outline: none; border-color: var(--accent); }
.hkt-note-textarea {
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  resize: vertical;
  width: 100%;
}
.hkt-note-textarea:focus { outline: none; border-color: var(--accent); }
.hkt-note-btns {
  display: flex;
  gap: 6px;
  padding-top: 2px;
}
.hkt-note-save {
  padding: 4px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.hkt-note-save:hover { background: #3d5ce8; }
.hkt-note-cancel {
  padding: 4px 10px;
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.hkt-note-cancel:hover { border-color: var(--text); color: var(--text); }

/* ── Guest info line on card ───────────────── */
.hkt-card-guests {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}
.hkt-guest-out {
  font-size: 11px;
  font-weight: 600;
  color: #b45309;
  background: #fef3c7;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.hkt-guest-in {
  font-size: 11px;
  font-weight: 600;
  color: #1d4ed8;
  background: #dbeafe;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
.hkt-guest-stay {
  font-size: 11px;
  font-weight: 600;
  color: #15803d;
  background: #dcfce7;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ── Message buttons on cards ───────────────── */
.hkt-msg-row {
  display: flex;
  gap: 6px;
  padding: 6px 14px 8px 28px;
  flex-wrap: wrap;
}
.hkt-msg-btn {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: .2px;
  transition: opacity .15s;
}
.hkt-msg-btn:active { opacity: .75; }
.hkt-msg-airbnb { background: #ff5a5f; color: #fff; }
.hkt-msg-wa     { background: #22c55e; color: #fff; }

/* ── Booking comments from CRM ──────────────── */
.hkt-booking-comment { display:flex; gap:6px; align-items:baseline; }
.hkt-bc-label { font-size:10px; font-weight:800; color:#1d4ed8; white-space:nowrap; flex-shrink:0; }

  margin: 4px 14px 6px 28px;
  font-size: 12px;
  color: #1e40af;
  background: #eff6ff;
  border-left: 3px solid #93c5fd;
  padding: 5px 10px;
  border-radius: 0 6px 6px 0;
  line-height: 1.4;
}
