/* ==============================================================
   DAR AYLA OPS — V2 · COMPONENTS CSS
   Composants signature : SuiteCard, KPI, Calendar, Chat, Tasks…
   ============================================================== */

/* ---------- KPI STRIP ---------- */
.kpi-strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 24px; }
@media (max-width: 1240px) { .kpi-strip { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 760px)  { .kpi-strip { grid-template-columns: repeat(2,1fr); } }
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  position: relative; overflow: hidden;
}
.kpi-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-l {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.kpi-d { color: var(--muted); font-size: 10px; }
.kpi-d.up { color: var(--ok); }
.kpi-d.dn { color: var(--danger); }
.kpi-v {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic; font-weight: 500; line-height: 1;
  font-size: 38px; color: var(--text); letter-spacing: -.02em;
  margin-top: 8px;
}
.kpi-v .unit { font-family: 'DM Sans', sans-serif; font-style: normal;
  font-size: 14px; color: var(--muted); font-weight: 400; margin-left: 3px; letter-spacing: 0; }
.kpi-sub { font-size: 11px; color: var(--muted); margin-top: 6px; }
.kpi.is-accent::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

/* Sparkline */
.spark { width: 100%; height: 32px; margin-top: 6px; display: block; }
.spark path.line { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.spark path.area { fill: var(--accent-soft); }

/* ---------- DASHBOARD GRID ---------- */
.dash-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 1240px) { .dash-grid { grid-template-columns: 1fr; } }

/* ---------- SUITE CARDS ---------- */
.suite-strip { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); }
.suite-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 14px 12px 16px;
  position: relative;
  cursor: pointer;
  transition: border-color .14s, background .14s, transform .14s;
}
.suite-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.suite-card .swatch {
  position: absolute; left: 0; top: 14px; bottom: 14px;
  width: 3px; border-radius: 0 3px 3px 0;
}
.suite-card-h {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 8px; margin-bottom: 8px;
}
.suite-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic; font-weight: 500;
  font-size: 18px; letter-spacing: -.005em; color: var(--text); line-height: 1;
}
.suite-meta { font-size: 10px; color: var(--muted); margin-top: 4px;
  font-family: 'JetBrains Mono', monospace; letter-spacing: .08em; }
.suite-guest { font-size: 13px; font-weight: 600; color: var(--text); margin-top: 6px; }
.suite-dates { font-size: 11px; color: var(--muted); margin-top: 2px; font-family: 'JetBrains Mono', monospace; }
.suite-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 9px; }

/* ---------- TIMELINE / CALENDAR ---------- */
.timeline-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.timeline-head {
  display: grid;
  grid-template-columns: 180px 1fr;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.timeline-head .corner {
  padding: 10px 14px;
  border-right: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.timeline-days {
  display: grid; grid-template-columns: repeat(var(--days,14), 1fr);
}
.timeline-day {
  padding: 8px 4px;
  text-align: center;
  border-right: 1px solid var(--border-soft);
  font-size: 11px;
}
.timeline-day:last-child { border-right: 0; }
.timeline-day .dow { font-family: 'JetBrains Mono', monospace; font-size: 9px;
  letter-spacing: .2em; text-transform: uppercase; color: var(--muted-2); }
.timeline-day .dom { font-size: 14px; font-weight: 500; color: var(--text-soft); }
.timeline-day.today .dom { color: var(--accent); }
.timeline-day.today { background: var(--accent-soft); }
.timeline-day.weekend { background: var(--surface-3); }

.timeline-row { display: grid; grid-template-columns: 180px 1fr; min-height: 56px;
  border-bottom: 1px solid var(--border-soft); }
.timeline-row:last-child { border-bottom: 0; }
.timeline-suite {
  padding: 12px 14px; border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex; align-items: center; gap: 10px;
  position: sticky; left: 0; z-index: 2;
}
.timeline-suite .swatch {
  width: 4px; height: 28px; border-radius: 2px; flex: none;
}
.timeline-suite .meta { line-height: 1.15; min-width: 0; }
.timeline-suite .nm { font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic; font-size: 16px; font-weight: 500; color: var(--text); }
.timeline-suite .sub { font-size: 10px; color: var(--muted); font-family: 'JetBrains Mono', monospace; letter-spacing: .08em; }
.timeline-cells {
  position: relative;
  display: grid; grid-template-columns: repeat(var(--days,14), 1fr);
}
.timeline-cells .cell {
  border-right: 1px solid var(--border-soft);
  position: relative;
}
.timeline-cells .cell.today { background: var(--accent-soft); }
.timeline-cells .cell.weekend { background: var(--surface-3); }

.tl-resa {
  position: absolute;
  top: 8px; bottom: 8px;
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 11px;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--text);
  overflow: hidden;
  transition: transform .14s;
  z-index: 1;
}
.tl-resa:hover { transform: translateY(-1px); z-index: 5; box-shadow: 0 6px 18px rgba(0,0,0,.3); }
.tl-resa .who { font-weight: 600; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.tl-resa .nights { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--muted); margin-left: auto; }
.tl-resa::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--bar-color, var(--accent));
}
.tl-resa.vip { background: linear-gradient(90deg, var(--gold-soft), var(--accent-soft));
  border-color: var(--gold); }

/* ---------- ACTIVITY FEED ---------- */
.activity-list { display: flex; flex-direction: column; }
.activity-item {
  display: grid; grid-template-columns: 28px 1fr auto;
  gap: 12px; align-items: flex-start;
  padding: 11px 0;
  border-bottom: 1px dashed var(--border-soft);
}
.activity-item:last-child { border-bottom: 0; }
.activity-icon {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center;
  color: var(--muted);
}
.activity-icon.arrival   { color: var(--ok);    background: var(--ok-soft);    border-color: rgba(125,160,106,.3); }
.activity-icon.departure { color: var(--danger);background: var(--danger-soft);border-color: rgba(192,106,106,.3); }
.activity-icon.cleaning  { color: var(--warn);  background: var(--warn-soft);  border-color: rgba(217,165,102,.3); }
.activity-icon.message   { color: var(--info);  background: var(--info-soft);  border-color: rgba(107,138,170,.3); }
.activity-icon.request   { color: var(--accent);background: var(--accent-soft);border-color: var(--accent-line); }
.activity-icon.incident  { color: var(--gold);  background: var(--gold-soft);  border-color: rgba(201,161,74,.3); }
.activity-text { font-size: 13px; color: var(--text-soft); line-height: 1.4; }
.activity-text .who { color: var(--text); font-weight: 600; }
.activity-time { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--muted); white-space: nowrap; }

/* ---------- LODGIFY CHAT ---------- */
.chat-wrap { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex; align-items: center; gap: 12px; flex: none;
}
.chat-header .avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent); color: #1a0f08;
  display: grid; place-items: center;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic; font-weight: 600; font-size: 16px;
  flex: none;
}
.chat-header .meta { line-height: 1.2; min-width: 0; }
.chat-header .nm { font-size: 14px; font-weight: 600; color: var(--text); }
.chat-header .sub { font-size: 11px; color: var(--muted); font-family: 'JetBrains Mono', monospace; letter-spacing: .04em; }
.chat-header .channel-tag {
  margin-left: auto;
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--muted);
  background: var(--surface-2); padding: 4px 10px; border-radius: 16px;
  border: 1px solid var(--border);
}
.chat-body {
  flex: 1; overflow-y: auto;
  padding: 18px;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--bg-soft);
}
.chat-day-sep {
  text-align: center; margin: 8px 0 4px;
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted-2);
}
.chat-msg {
  max-width: 78%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 13px; line-height: 1.5;
  position: relative;
  word-wrap: break-word;
}
.chat-msg.guest {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.chat-msg.staff {
  align-self: flex-end;
  background: var(--accent);
  color: #1a0f08;
  border-bottom-right-radius: 4px;
  font-weight: 500;
}
.chat-msg .mh {
  font-size: 10px; opacity: .7; margin-bottom: 3px;
  font-family: 'JetBrains Mono', monospace; letter-spacing: .04em;
  display: flex; gap: 8px;
}
.chat-msg.staff .mh { color: rgba(26,15,8,.7); }
.chat-msg.guest .mh { color: var(--muted); }
.chat-input-row {
  flex: none;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; align-items: flex-end;
  background: var(--surface);
}
.chat-input {
  flex: 1; resize: none;
  min-height: 40px; max-height: 120px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit; font-size: 13px;
  outline: none;
}
.chat-input:focus { border-color: var(--accent); }
.chat-quick {
  display: flex; gap: 6px; padding: 0 12px 8px;
  flex-wrap: wrap;
  background: var(--surface);
  border-top: 1px solid var(--border-soft);
  flex: none;
}
.chat-quick button {
  font-size: 11px; padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-soft);
  cursor: pointer;
}
.chat-quick button:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }

/* Drawer body split: chat | infos */
.drawer-split {
  display: grid;
  grid-template-columns: 1fr 360px;
  width: 100%;
  min-height: 0;
}
@media (max-width: 1024px) { .drawer-split { grid-template-columns: 1fr; } }

.drawer-side { border-left: 1px solid var(--border); padding: 18px 20px; overflow-y: auto;
  background: var(--surface); }
.drawer-side .sec { margin-bottom: 22px; }
.drawer-side .sec-h {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px; font-weight: 600;
}
.drawer-side .kvp {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 12px;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border-soft);
}
.drawer-side .kvp:last-child { border-bottom: 0; }
.drawer-side .kvp .k { color: var(--muted); }
.drawer-side .kvp .v { color: var(--text); font-weight: 500; text-align: right; }
.drawer-side .editable {
  cursor: text; padding: 4px 6px; border-radius: 4px; margin: -4px -6px;
}
.drawer-side .editable:hover { background: var(--surface-2); outline: 1px dashed var(--border-strong); }

.guest-portrait {
  text-align: center; padding: 8px 0 4px;
  border-bottom: 1px solid var(--border-soft); margin-bottom: 14px;
}
.guest-portrait .avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-hi));
  color: #1a0f08;
  display: grid; place-items: center;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic; font-weight: 600; font-size: 22px;
  margin: 0 auto 8px;
  border: 2px solid var(--bg-soft);
  box-shadow: 0 4px 16px rgba(192,125,85,.3);
}
.guest-portrait .nm { font-size: 14px; font-weight: 700; color: var(--text); }
.guest-portrait .sub { font-size: 11px; color: var(--muted); margin-top: 2px;
  font-family: 'JetBrains Mono', monospace; letter-spacing: .06em; }

.lodgify-sync {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; color: var(--ok);
  background: var(--ok-soft);
  padding: 3px 10px; border-radius: 12px;
  border: 1px solid rgba(125,160,106,.3);
  font-family: 'JetBrains Mono', monospace; letter-spacing: .04em;
}
.lodgify-sync .ping {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ok);
  animation: ping 1.6s ease-in-out infinite;
}
@keyframes ping {
  0%,100% { box-shadow: 0 0 0 0 rgba(125,160,106,.5); }
  50% { box-shadow: 0 0 0 4px rgba(125,160,106,0); }
}

/* ---------- TASK CARDS (HOUSEKEEPING) ---------- */
.task-row {
  display: grid; grid-template-columns: 28px 1fr auto;
  align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color .14s;
}
.task-row:hover { border-color: var(--border-strong); }
.task-row.done { opacity: .55; }
.task-row.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-check {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: transparent;
  cursor: pointer;
  display: grid; place-items: center;
}
.task-check.done {
  background: var(--ok); border-color: var(--ok); color: var(--bg);
}
.task-meta { line-height: 1.3; min-width: 0; }
.task-title { font-size: 13px; font-weight: 600; color: var(--text); }
.task-sub { font-size: 11px; color: var(--muted); font-family: 'JetBrains Mono', monospace; }
.task-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.assignee-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 8px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: 11px; color: var(--text-soft);
}
.assignee-chip .avatar {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); color: #1a0f08;
  display: grid; place-items: center;
  font-size: 9px; font-weight: 700;
}

/* ---------- INVENTORY ---------- */
.inv-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.inv-table th {
  text-align: left;
  padding: 10px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.inv-table td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-soft);
}
.inv-table tr:hover td { background: var(--surface-2); }
.inv-stock-bar {
  position: relative; width: 100%; height: 6px;
  background: var(--surface-2); border-radius: 3px;
  overflow: hidden;
}
.inv-stock-bar i {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--ok); border-radius: 3px;
}
.inv-stock-bar.low i { background: var(--warn); }
.inv-stock-bar.crit i { background: var(--danger); }
.inv-stock-bar .min-mark {
  position: absolute; top: -2px; bottom: -2px; width: 1px;
  background: var(--text-soft); opacity: .5;
}

/* ---------- INCIDENTS ---------- */
.incident-card {
  display: grid; grid-template-columns: 4px 1fr auto;
  gap: 14px; align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px 12px 0;
  margin-bottom: 8px;
}
.incident-card .swatch { background: var(--accent); border-radius: 0 3px 3px 0; align-self: stretch; }
.incident-card.high .swatch { background: var(--danger); }
.incident-card.normal .swatch { background: var(--warn); }
.incident-card.low .swatch { background: var(--muted); }
.incident-card.resolved { opacity: .55; }

/* ---------- VENDORS ---------- */
.vendor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.vendor-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 14px 12px;
  display: flex; gap: 12px; align-items: flex-start;
}
.vendor-card .avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface-3); color: var(--text);
  display: grid; place-items: center;
  font-size: 14px; font-weight: 700;
  border: 1px solid var(--border);
  flex: none;
}

/* ---------- COMMAND PALETTE OVERLAY ---------- */
.palette-back {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(0,0,0,.55); backdrop-filter: blur(6px);
  display: grid; place-items: flex-start center;
  padding-top: 14vh;
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.palette-back.open { opacity: 1; pointer-events: auto; }
.palette {
  width: min(620px, 92vw);
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-3);
  overflow: hidden;
}
.palette-input {
  width: 100%; padding: 16px 18px;
  background: transparent; border: 0; outline: 0;
  color: var(--text); font-family: inherit; font-size: 16px;
  border-bottom: 1px solid var(--border);
}
.palette-list { max-height: 340px; overflow-y: auto; padding: 6px; }
.palette-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  font-size: 13px; color: var(--text-soft); cursor: pointer;
}
.palette-item.on, .palette-item:hover { background: var(--accent-soft); color: var(--text); }
.palette-item .typ { margin-left: auto; font-family: 'JetBrains Mono', monospace;
  font-size: 9px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }

/* ---------- MOBILE PWA ---------- */
.mobile-frame {
  width: 380px; height: 760px;
  margin: 32px auto;
  border: 1px solid var(--border-strong);
  border-radius: 36px;
  background: var(--bg-soft);
  box-shadow: var(--shadow-3);
  overflow: hidden;
  position: relative;
  display: flex; flex-direction: column;
}
.mobile-status {
  height: 26px; padding: 0 22px;
  display: flex; align-items: center; justify-content: space-between;
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--text); flex: none;
}
.mobile-app { flex: 1; overflow-y: auto; padding: 12px 14px 80px; }
.mobile-tabbar {
  position: absolute; left: 8px; right: 8px; bottom: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 24px; padding: 8px;
  display: grid; grid-template-columns: repeat(5,1fr);
  box-shadow: var(--shadow-2);
}
.mobile-tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 9px; color: var(--muted); padding: 6px 0;
  font-family: 'JetBrains Mono', monospace; letter-spacing: .12em; text-transform: uppercase;
}
.mobile-tab.on { color: var(--accent); }

/* Section title */
.sec-title {
  display: flex; align-items: baseline; gap: 14px;
  margin: 0 0 14px;
}
.sec-title h2 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic; font-weight: 500;
  font-size: 26px; letter-spacing: -.01em; color: var(--text);
}
.sec-title .eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--muted);
}
.sec-title .grow { flex: 1; }

/* Compact density variant */
:root[data-density="compact"] .card { padding: 14px; }
:root[data-density="compact"] .kpi  { padding: 10px 12px; }
:root[data-density="compact"] .kpi-v { font-size: 30px; margin-top: 4px; }
:root[data-density="compact"] .nav-item { padding: 7px 10px; }
:root[data-density="compact"] .app-main { padding: 18px 22px 48px; }
