/* Colors and shapes shared with the Android app (android/.../ui/theme/Color.kt).
 * Keep the two in step so the console and the app read as one product. */
:root {
  --bg: #f5f6f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --border: #dce1e8;
  --text: #1a1c1e;
  --muted: #5a606b;
  --accent: #1e3a5f;
  --on-accent: #ffffff;
  --accent-soft: #d2e4ff;
  --on-accent-soft: #001c3a;
  --ok: #1f7a4d;
  --ok-soft: #ddf3e6;
  --warn: #8a5a00;
  --warn-soft: #fcefd2;
  --bad: #ba1a1a;
  --bad-soft: #ffdad6;
  --agent: #6b4fd8;
  --on-agent: #ffffff;
  --agent-soft: #ece6ff;
  --radius: 12px;
  --radius-sm: 8px;
  --pill: 999px;
  --shadow: 0 1px 2px rgb(16 24 40 / 5%), 0 1px 3px rgb(16 24 40 / 8%);
  --shadow-raised: 0 4px 12px rgb(16 24 40 / 10%), 0 1px 3px rgb(16 24 40 / 8%);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1217;
    --surface: #171b21;
    --surface-2: #21262e;
    --border: #2f3540;
    --text: #e3e5ea;
    --muted: #a3aab6;
    --accent: #a8c8f0;
    --on-accent: #0b2a4a;
    --accent-soft: #23446b;
    --on-accent-soft: #d2e4ff;
    --ok: #6fd39b;
    --ok-soft: #133a26;
    --warn: #f2c25b;
    --warn-soft: #3a2c0c;
    --bad: #ffb4ab;
    --bad-soft: #4a1714;
    --agent: #c6b5ff;
    --on-agent: #22005d;
    --agent-soft: #352a5c;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%);
    --shadow-raised: 0 6px 16px rgb(0 0 0 / 40%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 15px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.muted { color: var(--muted); }
.error { color: var(--bad); margin: 8px 0 0; }

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border-radius: var(--pill); border: 1px solid var(--border); background: var(--surface); padding: 7px 14px; font-weight: 500; }
button { transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s, filter .15s; }
button:hover { background: var(--surface-2); }
button:active:not(:disabled) { transform: scale(.97); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.primary:hover { filter: brightness(1.08); }
button.small { padding: 4px 11px; font-size: 13px; }
.ghost-btn { background: transparent; }
.link-btn { border: 0; background: none; color: var(--accent); padding: 2px 4px; }
input, select {
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
  padding: 8px 10px; width: 100%; min-width: 0;
}
input, select { transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }

/* Sign-in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px 28px; box-shadow: var(--shadow); display: grid; gap: 14px;
  justify-items: center; text-align: center;
}
.login-card h1 { font-size: 20px; font-weight: 600; }
.login-card p { margin: 0; }
.login-card label, .login-card button, .login-card .error { justify-self: stretch; }
.login-card label, .login-card .error { text-align: left; }
.login-card button.primary { padding: 10px 14px; margin-top: 4px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center; justify-content: space-between; padding: 10px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
/* The app's hotel icon in a soft circle */
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-soft); color: var(--on-accent-soft); flex: none;
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-mark.large { width: 64px; height: 64px; }
.brand-mark.large svg { width: 32px; height: 32px; }
.topbar-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.topbar-controls select { width: auto; }
.switch { display: flex; align-items: center; gap: 6px; color: var(--text); font-size: 14px; }
.switch input { width: auto; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live.on { color: var(--ok); }
.live.on::before { background: var(--ok); animation: pulse 2.4s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 45%, transparent); }
  70%, 100% { box-shadow: 0 0 0 6px transparent; }
}

/* Layout */
.layout { display: grid; grid-template-columns: 340px 1fr; gap: 16px; padding: 16px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
.feed, .console { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.feed { position: sticky; top: 70px; max-height: calc(100vh - 86px); display: flex; flex-direction: column; }
@media (max-width: 900px) { .feed { position: static; max-height: 420px; } }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.empty { padding: 14px; margin: 0; }

/* Tabs and views */
.tabs { position: relative; display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 10px 12px; color: var(--muted); white-space: nowrap; transition: color .2s, border-color .2s; }
.tab:hover { background: none; color: var(--text); }
.tab.active { color: var(--accent); font-weight: 600; }
.tab-indicator {
  position: absolute; left: 0; bottom: 0; height: 2px; width: 0; border-radius: 2px 2px 0 0;
  background: var(--accent); pointer-events: none; transition: transform .3s var(--ease), width .3s var(--ease);
}
.view { padding: 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }

/* Forms */
.inline-form { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; background: var(--surface-2); display: grid; gap: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Boards */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.board.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .board, .board.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .board, .board.three { grid-template-columns: 1fr; } }
.column { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 120px; }
.column h3 { margin-bottom: 8px; display: flex; gap: 6px; }
.count { color: var(--muted); font-weight: 400; }
.cards { display: grid; gap: 8px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: grid; gap: 6px;
  transition: box-shadow .2s var(--ease), transform .2s var(--ease), border-color .2s; }
.card:hover, .room:hover { box-shadow: var(--shadow-raised); transform: translateY(-1px); }
.card-title { font-weight: 600; overflow-wrap: anywhere; }
.card-meta { color: var(--muted); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.card-actions select { flex: 1 1 110px; padding: 4px 6px; }
.track { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 2px 0; }
.track span { height: 4px; border-radius: 2px; background: var(--border); transform-origin: left; }
.track span.reached { background: var(--accent); }
.badge { display: inline-block; font-size: 11.5px; font-weight: 500; padding: 1px 8px; border-radius: var(--pill); background: var(--surface-2); color: var(--muted); }
.badge.agent { background: var(--agent-soft); color: var(--agent); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: 12px; color: var(--muted); font-weight: 600; }
.table td.actions { text-align: right; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border-radius: 999px; padding: 4px 11px; font-size: 13px; }
.chip.active { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--on-accent-soft); }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.info-grid h3 { margin-bottom: 8px; }

/* Rooms */
.room-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.room { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: grid; gap: 4px; background: var(--surface);
  transition: box-shadow .2s var(--ease), transform .2s var(--ease); }
.room-number { font-size: 20px; font-weight: 700; }

/* Highlights */
@keyframes flash { from { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 60%, transparent); } to { box-shadow: 0 0 0 0 transparent; } }
.flash { animation: flash 1.6s ease-out; }
.enter { animation: rise .35s var(--ease), flash 1.6s ease-out; }
/* A job that moved on fills its newest status segment. */
@keyframes fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.flash .track .latest { animation: fill .5s var(--ease) .1s both; }
.highlight { outline: 2px solid var(--agent); outline-offset: 1px; background: var(--agent-soft) !important; transition: background-color .3s; }

.toast {
  position: fixed; bottom: 18px; left: 50%; z-index: 50;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-raised);
  opacity: 0; transform: translate(-50%, 10px); transition: opacity .25s var(--ease), transform .25s var(--ease);
  max-width: calc(100% - 32px);
}

/* Activity feed */
.feed-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; display: grid; gap: 8px; align-content: start; }
.turn, .note { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--surface); }
.turn { border-left: 3px solid var(--agent); display: grid; gap: 6px; }
.note { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; font-size: 13px; }
.turn-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; }
.turn-time { margin-left: auto; font-size: 12px; }
.turn-message { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.turn-message:empty { display: none; }
.turn-reply { margin: 0; padding: 8px 12px; border-radius: 4px 14px 14px 14px; background: var(--agent-soft); overflow-wrap: anywhere; }
.turn-error { margin: 0; color: var(--bad); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.step { display: grid; grid-template-columns: 16px 1fr; column-gap: 6px; font-size: 13px; }
.step::before { content: ""; width: 10px; height: 10px; margin-top: 4px; border-radius: 50%; border: 2px solid var(--border); }
.step.complete::before { border-color: var(--ok); background: var(--ok); }
.step.current::before { border-color: var(--agent); border-top-color: transparent; animation: spin .8s linear infinite; }
.step.failed::before { border-color: var(--bad); background: var(--bad); }
.step-detail { grid-column: 2; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
@keyframes spin { to { transform: rotate(360deg); } }


/* Agent replay */
.ghost {
  position: fixed; left: 0; top: 0; z-index: 40; pointer-events: none; color: var(--agent);
  opacity: 0; transition: opacity .2s ease-out; /* ghost.ts animates the position frame by frame */
  filter: drop-shadow(0 2px 3px rgb(0 0 0 / 25%));
}
.ghost.visible { opacity: 1; }
/* Put the arrow's tip (4, 2) on the ghost's position, and press toward the tip. */
.ghost svg { display: block; margin: -2px 0 0 -4px; transform-origin: 4px 2px; transition: transform .12s; }
.ghost.pressing svg { transform: scale(.82); }
.ghost-label {
  position: absolute; left: 14px; top: 16px; white-space: nowrap; font-size: 11.5px; font-weight: 600;
  background: var(--agent); color: var(--on-agent); padding: 2px 8px; border-radius: var(--pill);
}
.ghost-thinking { position: absolute; left: 82px; top: 16px; display: none; gap: 3px; padding: 5px 7px; border-radius: 999px; background: var(--agent-soft); }
.ghost.thinking .ghost-thinking { display: inline-flex; }
.ghost-thinking i { width: 5px; height: 5px; border-radius: 50%; background: var(--agent); animation: bob 1s infinite ease-in-out; }
.ghost-thinking i:nth-child(2) { animation-delay: .15s; }
.ghost-thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes bob { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.ghost-ripple {
  position: fixed; z-index: 39; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%;
  border: 2px solid var(--agent); pointer-events: none; animation: ripple .6s ease-out forwards;
}
@keyframes ripple { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
.ghost-press { box-shadow: 0 0 0 3px var(--agent-soft), 0 0 0 5px var(--agent) !important; }

/* Motion: short, quiet entrances, in step with the Android app's fade-and-rise. */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
.login-card { animation: rise .45s var(--ease); }
.layout > * { animation: rise .4s var(--ease) both; }
.layout > .console { animation-delay: .06s; }
.view { animation: fade .25s ease-out; }
.inline-form { animation: rise .25s var(--ease); }
.turn, .note { animation: slide-in .35s var(--ease); }
.step, .turn-reply, .turn-error { animation: rise .3s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
