/* ============================================================
   Hermes AI Platform — Mega Agent
   Production UI shell (re-implemented from the Claude Design export)
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  /* Surface */
  --bg: #08090D;
  --surface-1: #0B0D11;
  --surface-2: #0F1218;
  --surface-3: #12151B;
  --surface-4: #16191F;
  --field: #0E1015;
  --field-2: #0A0C10;

  /* Borders */
  --border: #1A1E26;
  --border-2: #1C2029;
  --border-3: #14171E;
  --border-4: #232833;
  --border-hover: #2F3A52;

  /* Text */
  --text-hi: #F3F4F8;
  --text: #E8EAF0;
  --text-2: #C7CBD4;
  --text-mid: #8A93A3;
  --text-dim: #6A7180;
  --text-low: #565D6B;
  --text-cap: #4A5060;

  /* Brand + accents */
  --primary: #6E86F5;
  --primary-2: #8A96F5;
  --primary-600: #5566E0;
  --gold: #D4B36A;         /* Hermes Agent (Claude / analysis) */
  --cyan: #45C0D6;         /* OpenClaw Agent (Codex / automation) */

  /* Semantic */
  --success: #4FB07A;
  --success-2: #6FC593;
  --warning: #E0A55B;
  --danger: #E1746A;
  --info: #4FA9EE;

  /* Radii + spacing scale */
  --r-sm: 8px;
  --r-md: 11px;
  --r-lg: 14px;
  --r-xl: 16px;
  --pad: 26px;
  --gap: 18px;
  --sec-gap: 26px;
  --card-pad: 19px;

  --font-sans: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --sidebar-w: 248px;
}

[data-theme="light"] {
  --bg: #F5F6F8;
  --surface-1: #FFFFFF;
  --surface-2: #F8F9FB;
  --surface-3: #F0F1F4;
  --surface-4: #E8EAEF;
  --field: #FFFFFF;
  --field-2: #F5F6F8;
  --border: #DDE0E6;
  --border-2: #E2E5EA;
  --border-3: #ECEEF2;
  --border-4: #D0D4DC;
  --border-hover: #BCC3D0;
  --text-hi: #1A1D24;
  --text: #252830;
  --text-2: #444852;
  --text-mid: #6A7180;
  --text-dim: #808898;
  --text-low: #9AA0AC;
  --text-cap: #B0B6C0;
  --primary: #5566E0;
  --primary-2: #6E86F5;
  --primary-600: #4455CC;
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
:where(button, input, textarea) { font-family: inherit; }
input::placeholder, textarea::placeholder { color: var(--text-low); }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; }
a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #22262F; border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #30353F; background-clip: content-box; }

/* ---------- Animations ---------- */
@keyframes hpulse { 0%,100%{opacity:1;} 50%{opacity:.35;} }
@keyframes hspin  { to { transform: rotate(360deg); } }
@keyframes hup    { from { opacity:.35; transform: translateY(9px); } to { opacity:1; transform:none; } }
@keyframes hpop   { from { opacity:0; transform: translateY(-6px) scale(.98); } to { opacity:1; transform:none; } }
@keyframes hbar   { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ============================================================
   Shell layout
   ============================================================ */
.app {
  display: flex;
  min-height: 100vh;
  height: 100vh;
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(110,134,245,0.05), transparent 60%),
    var(--bg);
}
.main {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.content { flex: 1; min-height: 0; overflow-y: auto; }
.view {
  padding: var(--pad);
  max-width: 1480px;
  margin: 0 auto;
  animation: hup .32s ease;
}
.view[hidden] { display: none; }

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  height: 100%;
  background: var(--surface-1);
  border-right: 1px solid var(--border-3);
  display: flex;
  flex-direction: column;
  transition: width .2s;
}
.sidebar__brand {
  height: 60px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border-3);
}
.brand-mark {
  width: 30px; height: 30px; flex: none;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--primary), var(--primary-600));
  position: relative;
  box-shadow: 0 3px 12px rgba(110,134,245,0.35), inset 0 1px 0 rgba(255,255,255,0.25);
}
.brand-mark span {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 16px;
}
.brand-mark::after {
  content: ""; position: absolute; top: -2px; right: -2px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold); border: 2px solid var(--surface-1);
}
.brand-text { line-height: 1.1; min-width: 0; }
.brand-name {
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  letter-spacing: .02em; color: var(--text);
}
.brand-sub { font-size: 9.5px; letter-spacing: .18em; color: var(--text-low); font-weight: 600; }

.sidebar__nav {
  flex: 1; overflow-y: auto;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px;
}
.nav-cap {
  padding: 14px 10px 6px;
  font-size: 10px; font-weight: 700; letter-spacing: .13em; color: var(--text-cap);
}
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 8px 12px;
  border: 0; border-radius: 9px;
  background: transparent; color: #98A0AD;
  font-size: 13.5px; font-weight: 500; text-align: left;
  transition: background .13s, color .13s;
}
.nav-item:hover { background: rgba(110,134,245,0.07); color: var(--text); }
.nav-item.is-active { background: rgba(110,134,245,0.12); color: #EEF0F5; font-weight: 600; }
.nav-item.is-active::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 17px; border-radius: 0 3px 3px 0; background: var(--primary);
}
.nav-item__icon {
  width: 20px; flex: none;
  display: flex; align-items: center; justify-content: center; position: relative;
  font-size: 18px; color: #7A828F;
}
.nav-item.is-active .nav-item__icon { color: var(--primary-2); }
.nav-item__icon .live-dot {
  position: absolute; top: -1px; right: -1px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success); animation: hpulse 2s infinite;
}
.nav-item__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item__badge {
  flex: none; font-size: 10px; font-weight: 700;
  padding: 2px 6px; border-radius: 20px;
  background: var(--surface-4); color: var(--text-mid);
}

.sidebar__profile { flex: none; padding: 10px 14px; border-top: 1px solid var(--border-3); }
.profile-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px;
  border: 1px solid var(--border-2); border-radius: var(--r-md);
  background: #101318; transition: background .13s;
}
.profile-btn:hover { background: var(--surface-3); }
.profile-avatar {
  width: 30px; height: 30px; flex: none; border-radius: 9px;
  background: linear-gradient(135deg, #3A3F4B, #262A33);
  display: flex; align-items: center; justify-content: center;
  color: var(--text); font-weight: 700; font-size: 13px; position: relative;
}
.profile-avatar::after {
  content: ""; position: absolute; bottom: -1px; right: -1px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--success); border: 2px solid #101318;
}
.profile-meta { flex: 1; min-width: 0; text-align: left; line-height: 1.25; }
.profile-name { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-mail { display: block; font-size: 11px; color: var(--text-low); font-family: var(--font-mono); }
.profile-btn .ph { font-size: 15px; color: var(--text-low); flex: none; }

/* ============================================================
   Topbar / header
   ============================================================ */
.topbar {
  height: 60px; flex: none;
  display: flex; align-items: center; gap: 12px;
  padding: 0 var(--pad);
  border-bottom: 1px solid var(--border-3);
  background: var(--surface-1);
  position: relative; z-index: 20;
}
.topbar__titles { min-width: 0; flex: none; }
.topbar__title { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.topbar__sub { font-size: 11.5px; color: var(--text-low); }
.topbar__search-wrap { flex: 1; display: flex; justify-content: center; min-width: 0; }

.search-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; max-width: 440px;
  padding: 9px 12px;
  border: 1px solid var(--border-2); border-radius: var(--r-md);
  background: var(--field); color: var(--text-dim);
  font-size: 13px; transition: border-color .14s, background .14s;
}
.search-btn:hover { border-color: #2A3352; background: var(--surface-2); }
.search-btn .ph { font-size: 16px; }
.search-btn__label { flex: 1; text-align: left; }
.kbd {
  font-family: var(--font-mono); font-size: 10px;
  background: #181B22; border: 1px solid var(--border-4); border-radius: 5px;
  padding: 1px 5px; color: #8A93A3;
}

.topbar__actions { flex: none; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; flex: none;
  border: 1px solid var(--border-2); border-radius: 10px;
  background: #101318; color: #9AA1AE;
  display: flex; align-items: center; justify-content: center;
  position: relative; transition: background .13s, color .13s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .ph { font-size: 18px; }
.icon-btn__count {
  position: absolute; top: 7px; right: 8px;
  min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 20px; background: var(--danger); color: #fff;
  font-size: 9.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #101318;
}
.btn-primary {
  display: flex; align-items: center; gap: 6px;
  padding: 0 13px; height: 38px;
  border: 0; border-radius: 10px;
  background: var(--primary); color: #fff;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 2px 10px rgba(110,134,245,0.3);
}
.btn-primary:hover { background: var(--primary-600); }
.btn-primary .ph { font-size: 14px; }

/* Notification center dropdown */
.notif { position: relative; }
.notif-panel {
  position: absolute; top: 46px; right: 0;
  width: 352px;
  background: var(--surface-2); border: 1px solid var(--border-4); border-radius: var(--r-lg);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  z-index: 50; overflow: hidden;
  animation: hpop .16s ease;
}
.notif-panel[hidden] { display: none; }
.notif-panel__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 15px; border-bottom: 1px solid #191D25;
}
.notif-panel__head .left { display: flex; align-items: center; gap: 8px; }
.notif-panel__title { font-weight: 700; font-size: 13.5px; }
.pill-count {
  font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 20px;
  background: rgba(225,116,106,0.14); color: var(--danger);
}
.link-btn { border: 0; background: none; color: var(--primary); font-size: 12px; font-weight: 600; }
.link-btn:hover { color: var(--primary-2); }
.notif-list { max-height: 360px; overflow-y: auto; }
.notif-row {
  display: flex; gap: 11px; padding: 12px 15px;
  border-bottom: 1px solid var(--border-3);
  transition: background .12s;
}
.notif-row:hover { background: var(--surface-3); }
.notif-row.is-unread { background: rgba(110,134,245,0.04); }
.notif-ico {
  width: 32px; height: 32px; flex: none; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.notif-body { flex: 1; min-width: 0; }
.notif-title-row { display: flex; align-items: center; gap: 6px; }
.notif-title { font-size: 12.5px; font-weight: 600; color: var(--text); }
.unread-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--danger); flex: none; }
.notif-desc { font-size: 11.5px; color: var(--text-mid); margin-top: 2px; line-height: 1.4; }
.notif-meta { display: flex; align-items: center; gap: 7px; margin-top: 5px; }
.notif-cat { font-size: 9.5px; font-weight: 700; padding: 1px 7px; border-radius: 20px; }
.notif-time { font-size: 10.5px; color: var(--text-low); font-family: var(--font-mono); }
.notif-foot {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 11px; border: 0; border-top: 1px solid #191D25;
  background: var(--surface-1); color: var(--text-mid); font-size: 12px; font-weight: 600;
}
.notif-foot:hover { color: var(--text); }
.notif-foot .ph { font-size: 13px; }

/* ============================================================
   Generic building blocks
   ============================================================ */
.card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: var(--card-pad);
}
.section-title { font-size: 14.5px; font-weight: 700; color: var(--text); }
.tint-ico {
  display: flex; align-items: center; justify-content: center;
  flex: none; border-radius: var(--r-md);
}
.badge {
  font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px;
  background: var(--surface-4); color: var(--text-mid);
}
.chip {
  padding: 5px 11px; border: 1px solid var(--border-2); border-radius: var(--r-sm);
  background: var(--surface-1); color: #9AA1AE; font-size: 11.5px;
  white-space: nowrap; transition: border-color .12s, color .12s;
}
.chip:hover { border-color: var(--border-hover); color: var(--text-2); }

/* ============================================================
   Workspace view
   ============================================================ */
.greeting {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: var(--sec-gap);
}
.greeting__eyebrow {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text-dim); margin-bottom: 7px;
}
.dot-green { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.hero {
  margin: 0; font-size: 33px; font-weight: 700; letter-spacing: -.025em;
  color: var(--text-hi); line-height: 1.08;
}
.hero .grad {
  background: linear-gradient(90deg, var(--primary-2), var(--gold));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.hero-sub { margin: 9px 0 0; font-size: 14px; color: var(--text-mid); }
.greeting__aside { display: flex; align-items: center; gap: 14px; flex: none; }
.clock { text-align: right; line-height: 1.2; }
.clock__time { font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--text); letter-spacing: .01em; }
.clock__date { font-size: 11.5px; color: var(--text-low); }
.status-pill {
  display: flex; align-items: center; gap: 7px; padding: 7px 13px;
  background: rgba(79,176,122,0.1); border: 1px solid rgba(79,176,122,0.25);
  border-radius: 20px; font-size: 12px; font-weight: 600; color: var(--success-2);
}
.status-pill .glow {
  width: 8px; height: 8px; border-radius: 50%; background: var(--success);
  box-shadow: 0 0 0 3px rgba(79,176,122,0.2); animation: hpulse 2.5s infinite;
}

/* Palette CTA banner */
.palette-cta {
  display: flex; align-items: center; gap: 11px; width: 100%; margin-top: 12px;
  padding: 11px 15px; border: 1px solid var(--border-2); border-radius: 13px;
  background: linear-gradient(90deg, rgba(110,134,245,0.06), transparent);
  transition: border-color .13s;
}
.palette-cta:hover { border-color: #2A3352; }
.palette-cta > .ph { font-size: 17px; color: var(--primary-2); flex: none; }
.palette-cta__text { flex: 1; text-align: left; font-size: 13px; color: #9AA1AE; min-width: 0; }
.palette-cta__text b { color: var(--text); font-weight: 600; }
.palette-cta__keys { display: flex; gap: 3px; flex: none; }

/* Quick stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); margin-bottom: var(--sec-gap); }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--card-pad); position: relative; overflow: hidden; }
.stat__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.stat__ico { width: 38px; height: 38px; border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.stat__sub { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 20px; }
.stat__val { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--text-hi); line-height: 1; }
.stat__label { font-size: 12.5px; color: var(--text-mid); margin-top: 6px; }

/* Main dashboard grid */
.dash-grid { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: var(--gap); align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }

/* Quick launch */
.sec-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sec-head__left { display: flex; align-items: center; gap: 9px; }
.qlaunch { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; }
.qapp {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 14px 8px; border: 1px solid #191D25; border-radius: 13px;
  background: var(--surface-3); text-align: center;
  transition: border-color .14s, transform .14s, background .14s;
}
.qapp:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.qapp__ico { position: relative; width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 23px; }
.qapp__ico .stat-dot { position: absolute; top: -2px; right: -2px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--surface-3); }
.qapp__name { font-size: 11.5px; font-weight: 600; color: var(--text-2); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.qapp__stat { font-size: 9.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.qapp--add { border: 1px dashed var(--border-4); background: transparent; color: var(--text-low); justify-content: center; }
.qapp--add:hover { border-color: var(--border-hover); color: var(--text-mid); }
.qapp--add .qapp__ico { border: 1px dashed #2E333D; }

/* Recent tasks */
.task-badge {
  display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600;
  color: var(--primary-2); background: rgba(110,134,245,0.1); padding: 3px 9px; border-radius: 20px;
}
.task-badge .glow { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); animation: hpulse 1.6s infinite; }
.task-tabs { display: flex; gap: 6px; margin: 2px 0 4px; flex-wrap: wrap; }
.task-tab {
  padding: 5px 11px; border: 1px solid transparent; border-radius: 20px;
  background: transparent; color: var(--text-mid); font-size: 11.5px; font-weight: 600;
  white-space: nowrap; transition: all .12s;
}
.task-tab:hover { color: var(--text-2); }
.task-tab.is-active { background: var(--surface-4); color: var(--text); border-color: #2A2F3A; }
.task-row { display: flex; align-items: center; gap: 13px; padding: 13px 6px; border-bottom: 1px solid var(--surface-4); }
.task-row[hidden] { display: none; }
.task-row__ico { width: 38px; height: 38px; flex: none; border-radius: var(--r-md); display: flex; align-items: center; justify-content: center; font-size: 19px; position: relative; }
.task-row__spin { position: absolute; inset: -3px; border-radius: 13px; border: 1.5px solid transparent; animation: hspin 1s linear infinite; }
.task-row__body { flex: 1; min-width: 0; }
.task-row__title { font-size: 13.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-row__meta { display: flex; align-items: center; gap: 7px; margin-top: 3px; }
.task-row__agent { font-size: 11px; font-weight: 600; }
.task-row__sep { width: 3px; height: 3px; border-radius: 50%; background: #3A3F4B; }
.task-row__app { font-size: 11px; color: var(--text-low); }
.task-progress { margin-top: 8px; height: 4px; border-radius: 4px; background: var(--border); overflow: hidden; }
.task-progress__bar { height: 100%; border-radius: 4px; transform-origin: left; animation: hbar .8s ease; }
.task-row__end { flex: none; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.task-pill { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; }
.task-pill--pd { background: rgba(69,192,214,0.13); color: #45C0D6; font-size: 10px; }
.task-row--pd { border-left: 3px solid rgba(69,192,214,0.3); }

/* Archive */
.archive-section-title {
  font-size: 11px; font-weight: 700; color: var(--text-low);
  padding: 10px 8px 4px; text-transform: uppercase; letter-spacing: 0.5px;
}
.archive-section-title:first-child { padding-top: 4px; }
.task-row--dismissed { border-left: 3px solid rgba(138,147,163,0.25); }
.task-row--completed { border-left: 3px solid rgba(111,197,147,0.25); }
.dt-btn--restore {
  background: rgba(69,192,214,0.12); color: #45C0D6; border: none;
  font-size: 12px; padding: 4px 12px; border-radius: 6px; cursor: pointer;
  font-weight: 600; transition: background .15s;
}
.dt-btn--restore:hover { background: rgba(69,192,214,0.22); }

/* ── Pipeline Step Chain ── */
.step-chain { display: inline-flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.step-dot {
  font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 10px;
  white-space: nowrap;
}
.step-arrow { color: var(--text-low); font-size: 10px; margin: 0 1px; }
.sc-done { color: #6FC593; background: rgba(111,197,147,0.12); }
.sc-active { color: #45C0D6; background: rgba(69,192,214,0.15); font-weight: 700; }
.sc-pending { color: var(--text-low); background: rgba(138,147,163,0.08); }
.sc-fail { color: #EF4444; background: rgba(239,68,68,0.12); }
.sc-skip { color: var(--text-low); text-decoration: line-through; }
.pipeline-row__steps { margin: 4px 0 2px; }
.pipeline-row__meta { font-size: 11px; color: var(--text-low); margin-top: 2px; }
.pl-status { font-size: 11px; font-weight: 600; }
.pl-status--running { color: #45C0D6; }
.pl-status--completed { color: #6FC593; }
.pl-status--failed { color: #EF4444; }
.pl-status--paused { color: #E0A55B; }
.pl-status--planned { color: var(--text-mid); }
.pl-status--stopped { color: var(--text-low); }

/* ── Notification Toast ── */
.notif-toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px; min-width: 280px; max-width: 400px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
  animation: toastIn .3s ease; cursor: pointer;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.notif-toast--warning { border-left: 3px solid #E0A55B; }
.notif-toast--error { border-left: 3px solid #EF4444; }
.notif-toast__icon { font-size: 18px; flex: none; margin-top: 1px; }
.notif-toast__body { flex: 1; min-width: 0; }
.notif-toast__title { font-size: 13px; font-weight: 600; color: var(--text); }
.notif-toast__msg { font-size: 11.5px; color: var(--text-low); margin-top: 2px; }
.notif-toast__close {
  background: none; border: none; color: var(--text-low); font-size: 18px;
  cursor: pointer; padding: 0 2px; line-height: 1; flex: none;
}
.notif-toast__close:hover { color: var(--text); }

.task-time { font-size: 10.5px; color: var(--text-low); font-family: var(--font-mono); }

/* Dashboard Task action buttons */
.task-row__actions { flex: none; display: flex; gap: 5px; align-items: center; }
.dt-btn { font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 6px; border: 1px solid #2A2F3A; background: var(--surface-4); color: var(--text-mid); cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.dt-btn:hover { color: var(--text); border-color: #3A3F4B; }
.dt-btn--approve { background: rgba(69,192,214,0.12); border-color: rgba(69,192,214,0.25); color: #45C0D6; }
.dt-btn--approve:hover { background: rgba(69,192,214,0.2); color: #6FD5E6; }
.dt-btn--hold { background: rgba(224,165,91,0.12); border-color: rgba(224,165,91,0.2); color: #E0A55B; }
.dt-btn--hold:hover { background: rgba(224,165,91,0.2); color: #EABB7A; }
.dt-btn--dismiss { background: rgba(138,147,163,0.08); border-color: rgba(138,147,163,0.15); color: #8A93A3; }
.dt-btn--dismiss:hover { background: rgba(138,147,163,0.15); color: #A0A8B4; }
.dt-btn--loading { opacity: 0.7; pointer-events: none; }
.dt-btn--done { background: rgba(111,197,147,0.15); border-color: rgba(111,197,147,0.3); color: #6FC593; pointer-events: none; }

/* Schedule */
.sched-row { display: flex; gap: 13px; align-items: stretch; }
.sched-time { flex: none; width: 44px; text-align: right; font-family: var(--font-mono); font-size: 12px; font-weight: 600; padding-top: 9px; }
.sched-rail { flex: none; display: flex; flex-direction: column; align-items: center; }
.sched-dot { width: 11px; height: 11px; border-radius: 50%; margin-top: 10px; }
.sched-line { flex: 1; width: 2px; background: #191D25; }
.sched-body { flex: 1; min-width: 0; padding: 8px 0 14px; }
.sched-body-row { display: flex; align-items: center; gap: 8px; }
.sched-title { font-size: 13px; font-weight: 600; }
.sched-tag { font-size: 10px; font-weight: 600; color: var(--text-mid); background: var(--surface-4); border: 1px solid #20242E; padding: 1px 7px; border-radius: 20px; }
.sched-now { font-size: 10px; font-weight: 700; color: var(--primary); }

/* MCP Manager */
.mcp-layout { padding: 8px 0; }
.mcp-header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px; }
.mcp-title { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.mcp-title i { color: var(--primary); font-size: 20px; }
.mcp-subtitle { font-size: 12.5px; color: var(--text-low); }
.mcp-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.mcp-stat-card { background: var(--surface-3); border: 1px solid var(--surface-4); border-radius: var(--r-md); padding: 14px 16px; text-align: center; }
.mcp-stat--online { border-color: rgba(79,176,122,0.25); background: rgba(79,176,122,0.06); }
.mcp-stat-num { display: block; font-size: 24px; font-weight: 700; font-family: var(--font-mono); color: var(--text); }
.mcp-stat--online .mcp-stat-num { color: #6FC593; }
.mcp-stat-label { display: block; font-size: 11px; color: var(--text-low); margin-top: 4px; }
.mcp-filters { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.mcp-filter-btn { font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 6px; border: 1px solid var(--surface-4); background: var(--surface-3); color: var(--text-mid); cursor: pointer; transition: all 0.15s; }
.mcp-filter-btn:hover { border-color: #3A3F4B; color: var(--text); }
.mcp-filter-btn.is-active { background: var(--primary); border-color: var(--primary); color: #0D1117; }
.mcp-server-list { display: flex; flex-direction: column; gap: 6px; }
.mcp-server-card { background: var(--surface-3); border: 1px solid var(--surface-4); border-radius: var(--r-md); padding: 14px 16px; }
.mcp-server-card__header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.mcp-server-card__name { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.mcp-server-card__name i { font-size: 16px; color: var(--primary); }
.mcp-server-card__status { font-size: 11px; font-weight: 600; display: flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 20px; }
.mcp-status--online { color: #6FC593; background: rgba(111,197,147,0.1); }
.mcp-status--offline { color: #8A93A3; background: rgba(138,147,163,0.1); }
.mcp-status--degraded { color: #E0A55B; background: rgba(224,165,91,0.1); }
.mcp-status--pending { color: #A78BFA; background: rgba(167,139,250,0.1); }
.mcp-status--unknown { color: #8A93A3; background: rgba(138,147,163,0.1); }
.mcp-server-card__desc { font-size: 12px; color: var(--text-low); margin-bottom: 8px; }
.mcp-server-card__tools { display: flex; flex-wrap: wrap; gap: 4px; }
.mcp-tool-tag { font-size: 10.5px; padding: 2px 7px; border-radius: 4px; background: var(--surface-4); color: var(--text-mid); font-family: var(--font-mono); }
.mcp-server-card__meta { font-size: 11px; color: var(--text-low); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--surface-4); }

/* Tasks view */
.tasks-view { padding: 4px 0; }
.tasks-view__header { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.tasks-view__header h2 { font-size: 20px; font-weight: 700; margin: 0; }
.tasks-view__filters { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tasks-view__list { display: flex; flex-direction: column; }
.project-detail { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--surface-4); }
.project-detail__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.project-detail__title { margin: 0; font-size: 17px; font-weight: 700; color: var(--text); }
.project-detail__meta { margin-top: 5px; font-size: 12px; color: var(--text-low); }
.project-detail__goal { margin: 0 0 14px; font-size: 13px; line-height: 1.55; color: var(--text-mid); }
.project-steps { display: grid; gap: 9px; }
.project-step { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 11px; align-items: start; padding: 11px 12px; border: 1px solid var(--surface-4); border-radius: var(--r-md); background: var(--surface-2); }
.project-step__num { width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: rgba(69,192,214,0.12); color: #45C0D6; font-size: 11px; font-weight: 700; font-family: var(--font-mono); }
.project-step__title { font-size: 13px; font-weight: 700; color: var(--text); }
.project-step__desc { margin-top: 4px; font-size: 12px; line-height: 1.45; color: var(--text-mid); }
.project-step__role { font-size: 11px; color: var(--text-low); white-space: nowrap; }
.project-rules { margin-top: 14px; display: grid; gap: 8px; }
.project-rules__title { font-size: 12px; font-weight: 700; color: var(--text); }
.project-rule { display: grid; grid-template-columns: 18px minmax(0,1fr) auto; gap: 9px; align-items: start; padding: 9px 10px; border: 1px solid var(--surface-4); border-radius: var(--r-md); background: var(--surface-2); }
.project-rule input { margin-top: 2px; }
.project-rule__title { font-size: 12px; font-weight: 700; color: var(--text); }
.project-rule__desc { margin-top: 3px; font-size: 11.5px; line-height: 1.4; color: var(--text-mid); }
.project-rule__severity { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--text-low); font-family: var(--font-mono); }
.project-detail__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* Design Chat Panel */
.design-chat { margin-top: 16px; border: 1px solid var(--border-4); border-radius: var(--r-md); overflow: hidden; }
.design-chat__messages { max-height: 300px; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.design-chat__msg { font-size: 13px; line-height: 1.5; padding: 8px 12px; border-radius: var(--r-sm); max-width: 90%; }
.design-chat__msg--user { align-self: flex-end; background: var(--primary); color: #fff; }
.design-chat__msg--assistant { align-self: flex-start; background: var(--surface-4); color: var(--text); }
.design-chat__msg--system { align-self: center; font-size: 11px; color: var(--text-low); text-align: center; background: none; }
.design-chat__msg--loading { align-self: center; font-size: 12px; color: var(--text-low); text-align: center; background: none; animation: pulse 1.2s ease-in-out infinite; }
.design-chat__input { display: flex; gap: 6px; padding: 8px; background: var(--surface-3); border-top: 1px solid var(--border-4); }
.design-chat__input input { flex:1; padding:8px 12px; border-radius:var(--r-sm); border:1px solid var(--border-4); background:var(--field); color:var(--text); font-size:13px; }
.design-chat__input input:focus { outline:none; border-color:var(--primary); }

/* Draft Banner */
.design-draft-banner { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: rgba(224,165,91,0.1); border: 1px solid rgba(224,165,91,0.25); border-radius: var(--r-sm); margin: 8px 0; font-size: 13px; font-weight: 600; color: var(--warning); }
.design-draft-banner__hint { font-size: 11px; font-weight: 400; color: var(--text-low); }

/* Project design doc (markdown-like) */
.project-design-doc { padding: 12px 0; font-size: 13px; line-height: 1.7; color: var(--text-2); }
.project-design-doc h4 { font-size: 14px; font-weight: 700; color: var(--text); margin: 16px 0 6px; }
.project-design-doc h4:first-child { margin-top: 0; }
.project-design-doc li { margin: 3px 0 3px 16px; }
.project-design-doc .check-item { display: flex; align-items: center; gap: 8px; margin: 2px 0; font-size: 12.5px; }
.project-design-doc .check-box { width: 16px; height: 16px; border-radius: 3px; border: 1.5px solid var(--border-4); display: inline-flex; align-items: center; justify-content: center; font-size: 10px; color: var(--success); flex: none; }
.project-design-doc pre { background: var(--surface-4); border: 1px solid var(--border-4); border-radius: var(--r-sm); padding: 10px 14px; overflow-x: auto; font-family: var(--font-mono); font-size: 11.5px; line-height: 1.5; margin: 8px 0; }
.project-design-doc code { font-family: var(--font-mono); font-size: 12px; background: var(--surface-4); padding: 1px 5px; border-radius: 3px; }

/* Right rail — AI engines (System Status) + notifications */
.eng-row { display: flex; align-items: center; gap: 11px; padding: 8px 2px; border-bottom: 1px solid var(--surface-4); }
.eng-ico { width: 30px; height: 30px; flex: none; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.eng-name { flex: 1; min-width: 0; line-height: 1.25; }
.eng-name b { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); }
.eng-name span { display: block; font-size: 10.5px; color: var(--text-low); }
.eng-stat { display: flex; align-items: center; gap: 6px; flex: none; }
.eng-stat .dot { width: 7px; height: 7px; border-radius: 50%; }
.eng-stat .val { font-size: 11px; font-weight: 600; font-family: var(--font-mono); }
.notif-mini-row { display: flex; gap: 11px; padding: 12px 4px; border-bottom: 1px solid var(--surface-4); }
.notif-mini-row .notif-time { padding-top: 2px; flex: none; }
.notif-mini-row .notif-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   Apps view
   ============================================================ */
.apps-search-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.apps-search {
  flex: 1; min-width: 220px; display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border: 1px solid var(--border-2); border-radius: 12px; background: var(--field);
}
.apps-search .ph { font-size: 18px; color: var(--text-dim); }
.apps-search input { flex: 1; background: none; border: 0; outline: none; color: var(--text); font-size: 14px; }
.apps-count { font-size: 12.5px; color: var(--text-low); font-family: var(--font-mono); flex: none; }
.cat-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.cat-tab {
  padding: 7px 15px; border: 1px solid var(--border-2); border-radius: 20px;
  background: #101318; color: #9AA1AE; font-size: 12.5px; font-weight: 600;
  white-space: nowrap; transition: all .13s;
}
.cat-tab:hover { color: var(--text); }
.cat-tab.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }

.app-group { margin-bottom: 26px; }
.app-group[hidden] { display: none; }
.app-group__head { display: flex; align-items: center; gap: 9px; margin-bottom: 13px; }
.app-group__head .ph { font-size: 16px; color: var(--text-mid); }
.app-group__head h3 { font-size: 13.5px; font-weight: 700; color: var(--text-2); }
.app-group__count { font-size: 11px; color: var(--text-low); font-family: var(--font-mono); }
.app-group__rule { flex: 1; height: 1px; background: var(--surface-4); }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 14px; }
.app-card {
  display: flex; flex-direction: column; padding: 18px;
  border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--surface-2);
  text-align: left; transition: border-color .14s, transform .14s, background .14s;
}
.app-card[hidden] { display: none; }
.app-card:hover { border-color: var(--border-hover); transform: translateY(-2px); background: var(--surface-3); }
.app-card__top { display: flex; align-items: flex-start; justify-content: space-between; }
.app-card__ico { width: 50px; height: 50px; flex: none; border-radius: var(--r-lg); display: flex; align-items: center; justify-content: center; font-size: 27px; }
.app-card__tag { font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 20px; }
.app-card__name { margin-top: 14px; font-size: 14.5px; font-weight: 700; color: var(--text); }
.app-card__ko { margin-top: 3px; font-size: 12px; color: var(--text-mid); line-height: 1.4; }
.app-card__stat { display: flex; align-items: center; gap: 6px; margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--surface-4); }
.app-card__stat .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.app-card__stat span { font-size: 11px; font-weight: 600; }
.app-card--add {
  align-items: center; justify-content: center; gap: 11px;
  border: 1px dashed #2A2F3A; background: transparent; color: var(--text-low); min-height: 160px;
  transition: border-color .14s, color .14s;
}
.app-card--add:hover { border-color: #3A4355; color: var(--text-mid); transform: none; background: transparent; }
.app-card--add .app-card__ico { border: 1px dashed #333A46; }
.add-banner {
  width: 100%; margin-top: 22px; padding: 22px;
  border: 1px dashed var(--border-4); border-radius: var(--r-xl);
  display: flex; align-items: center; justify-content: center; gap: 12px;
  color: var(--text-mid); background: linear-gradient(90deg, rgba(110,134,245,0.05), transparent);
  transition: border-color .14s;
}
.add-banner:hover { border-color: #2A3352; }
.add-banner__ico { width: 36px; height: 36px; border-radius: var(--r-md); background: rgba(110,134,245,0.12); display: flex; align-items: center; justify-content: center; color: var(--primary-2); flex: none; font-size: 18px; }
.add-banner__text { font-size: 13.5px; }
.add-banner__text b { color: var(--text); font-weight: 700; }

/* ============================================================
   Placeholder views (Chat / Design etc.)
   ============================================================ */
.placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 14px; padding: 80px 20px; min-height: 60vh;
}
.placeholder__ico { width: 64px; height: 64px; border-radius: 18px; background: rgba(110,134,245,0.12); color: var(--primary-2); display: flex; align-items: center; justify-content: center; font-size: 32px; }
.placeholder h2 { font-size: 20px; color: var(--text-hi); }
.placeholder p { font-size: 14px; color: var(--text-mid); max-width: 420px; line-height: 1.6; margin: 0; }

/* ============================================================
   Command palette
   ============================================================ */
.palette-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(6,7,10,0.7); backdrop-filter: blur(4px);
  display: flex; justify-content: center; align-items: flex-start;
  padding: 12vh 20px 20px; animation: hpop .14s ease;
}
.palette-overlay[hidden] { display: none; }
.palette {
  width: 100%; max-width: 620px;
  background: var(--field); border: 1px solid var(--border-4); border-radius: var(--r-xl);
  box-shadow: 0 30px 90px rgba(0,0,0,0.6); overflow: hidden;
}
.palette__search { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid #191D25; }
.palette__search > .ph { font-size: 19px; color: var(--text-dim); }
.palette__search input { flex: 1; background: none; border: 0; outline: none; color: var(--text); font-size: 15px; }
.palette__list { max-height: 52vh; overflow-y: auto; padding: 8px; }
.palette__empty { padding: 34px; text-align: center; color: var(--text-low); font-size: 13px; }
.palette__empty[hidden] { display: none; }
.palette-group-head { padding: 12px 12px 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; color: var(--text-cap); }
.palette-group-head[hidden], .palette-item[hidden] { display: none; }
.palette-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border: 0; border-radius: 10px;
  text-align: left; background: transparent; transition: background .1s;
}
.palette-item:hover, .palette-item.is-active { background: #191D25; }
.palette-item__ico { width: 32px; height: 32px; flex: none; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 17px; }
.palette-item__body { flex: 1; min-width: 0; }
.palette-item__label { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); }
.palette-item__desc { display: block; font-size: 11.5px; color: var(--text-dim); }
.palette-item__tag { flex: none; font-size: 10.5px; color: var(--text-low); font-family: var(--font-mono); background: var(--surface-4); border: 1px solid #20242E; padding: 2px 8px; border-radius: 6px; }
.palette__foot { display: flex; align-items: center; gap: 16px; padding: 11px 18px; border-top: 1px solid #191D25; background: var(--surface-1); }
.palette__foot span { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-low); }

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 120;
  display: flex; align-items: center; gap: 10px; padding: 11px 18px;
  background: #161A21; border: 1px solid #2A2F3A; border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0,0,0,0.5); animation: hpop .18s ease;
}
.toast[hidden] { display: none; }
.toast .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.toast span { font-size: 13px; font-weight: 500; color: var(--text); }

/* ============================================================
   Mobile bottom nav
   ============================================================ */
.mobile-nav { display: none; }
.mobile-nav {
  flex: none; height: 62px;
  align-items: stretch; border-top: 1px solid var(--border-3); background: var(--surface-1);
}
.mobile-nav__btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 0; background: none; color: var(--text-dim);
}
.mobile-nav__btn .ph { font-size: 21px; }
.mobile-nav__btn span { font-size: 9.5px; font-weight: 600; }
.mobile-nav__btn.is-active { color: var(--primary-2); }

.topbar__menu { display: none; }

/* ============================================================
   Responsive — rail (tablet) and mobile
   ============================================================ */

/* Rail mode: collapse sidebar to icons only */
@media (max-width: 1119px) {
  :root { --sidebar-w: 74px; }
  .sidebar__brand { padding: 0 12px; justify-content: center; }
  .brand-text { display: none; }
  .sidebar__nav { padding: 12px 12px; }
  .nav-cap { display: none; }
  .nav-item { padding: 8px 0; justify-content: center; }
  .nav-item__label, .nav-item__badge { display: none; }
  .profile-meta, .profile-btn > .ph { display: none; }
  .profile-btn { justify-content: center; }
  .dash-grid { grid-template-columns: minmax(0,1fr) 340px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; }
}

/* Mobile mode: hide sidebar, show bottom nav */
@media (max-width: 759px) {
  :root { --pad: 16px; --gap: 14px; --sec-gap: 18px; --card-pad: 15px; }
  .sidebar { display: none; }
  .mobile-nav { display: flex; }
  .topbar__menu { display: flex; }
  .topbar__titles { display: none; }
  .topbar__sub { display: none; }
  .topbar__search-wrap { display: none; }
  .search-btn { display: none; }
  .btn-primary { display: none; }
  .hero { font-size: 24px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .qlaunch { grid-template-columns: repeat(3, 1fr); }
  .app-grid { grid-template-columns: repeat(2, 1fr); }
  .greeting__aside { display: none; }
  .notif-panel { position: fixed; top: 64px; left: 12px; right: 12px; width: auto; }
}

/* show/hide helpers driven by data-view on .app */
.app:not([data-view="workspace"]) .mobile-nav__btn[data-nav="workspace"],
.app[data-view] .mobile-nav__btn { }

/* OpenClaw live response */
.engine-response{
  margin-top:14px;
  padding:14px;
  border-radius:12px;
  background:#11161d;
  border:1px solid #2b3644;
}

.engine-response__title{
  font-size:12px;
  color:#45C0D6;
  margin-bottom:8px;
  font-weight:600;
}

.engine-response__text{
  white-space:pre-wrap;
  margin:0;
  color:#E8EDF5;
  font-family:inherit;
  font-size:13px;
  line-height:1.55;
}

/* ============================================================
   Chat view
   ============================================================ */
.view-chat {
  height: 100%;
  padding: 0;
  display: flex;
  flex-direction: column;
  max-width: none;
  animation: none;
}

.chat-layout {
  display: flex;
  height: 100%;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding: 0;
  gap: 0;
}

/* ── Conversation sidebar ── */
.chat-sidebar {
  width: 230px;
  flex: none;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-3);
  background: var(--surface-1);
  overflow-y: auto;
}

/* Agent filter tabs */
.chat-agent-tabs {
  display: flex;
  gap: 4px;
  margin: 12px 12px 0;
  padding: 4px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  border: 1px solid var(--border-4);
}

.chat-agent-tab {
  flex: 1;
  padding: 5px 8px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all .13s;
  white-space: nowrap;
}
.chat-agent-tab:hover { color: var(--text-2); background: var(--surface-3); }
.chat-agent-tab.is-active { background: var(--accent); color: #fff; }
.chat-agent-tab.is-active[data-agent-filter="hermes"]  { background: #6E86F5; color: #fff; }
.chat-agent-tab.is-active[data-agent-filter="openclaw"] { background: #34d399; color: #111827; }
.chat-agent-tab.is-active[data-agent-filter="all"]      { background: var(--accent); color: #fff; }

.chat-new-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 12px;
  padding: 8px 12px;
  border: 1px solid var(--border-4);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  transition: background .13s, border-color .13s;
}
.chat-new-btn:hover { background: var(--surface-3); border-color: var(--border-hover); }
.chat-new-btn .ph { font-size: 14px; }

.chat-conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 10px;
}

.chat-conv-item {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  width: 100%;
  padding: 9px 11px;
  margin-bottom: 2px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  text-align: left;
  transition: background .12s;
  cursor: pointer;
  position: relative;
}
.chat-conv-item:hover { background: rgba(110,134,245,0.07); }
.chat-conv-item.is-active { background: rgba(110,134,245,0.12); }

.chat-conv-item__main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-conv-item__title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-conv-item__title-input {
  font-weight: 600;
  font-size: 12.5px;
  width: 100%;
  border: 1px solid var(--primary);
  border-radius: 4px;
  padding: 2px 5px;
  background: var(--surface-1);
  color: var(--text-hi);
  outline: none;
}

.chat-conv-item__meta {
  font-size: 10.5px;
  color: var(--text-low);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Agent badge */
.chat-conv-item__agent {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.4;
}
.chat-conv-item__agent--hermes { background: rgba(99,102,241,.15); color: #818cf8; }
.chat-conv-item__agent--openclaw { background: rgba(16,185,129,.15); color: #34d399; }

.chat-conv-item__actions {
  display: none;
  gap: 2px;
  flex: none;
}
.chat-conv-item:hover .chat-conv-item__actions {
  display: flex;
}

.chat-conv-item__btn {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.chat-conv-item__btn:hover {
  background: rgba(110,134,245,0.15);
  color: var(--text-hi);
}
.chat-conv-item__btn[data-conv-delete]:hover {
  background: rgba(225,116,106,0.18);
  color: var(--danger);
}

/* ── Chat main area ── */
.chat-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 0 var(--pad);
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--pad) 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  padding: 60px 20px;
  margin: auto;
}

.chat-empty .placeholder__ico {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: rgba(167,139,250,0.12);
  color: #A78BFA;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
}

.chat-empty h2 {
  font-size: 20px;
  color: var(--text-hi);
  margin: 0;
}

.chat-empty p {
  font-size: 14px;
  color: var(--text-mid);
  max-width: 420px;
  line-height: 1.6;
  margin: 0;
}

.chat-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
  margin-top: 8px;
}

.chat-msg {
  display: flex;
  animation: hup .24s ease;
}

.chat-msg--user {
  justify-content: flex-end;
}

.chat-msg--user .chat-msg__bubble {
  background: var(--primary);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
  max-width: 72%;
}

.chat-msg--ai .chat-msg__bubble {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px 14px 14px 4px;
  max-width: 82%;
}

.chat-msg__bubble {
  padding: 12px 16px;
  min-width: 0;
}

.chat-msg__role {
  font-size: 10.5px;
  font-weight: 700;
  margin-bottom: 4px;
  opacity: 0.65;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.chat-msg__text {
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg--loading .chat-msg__bubble {
  min-width: 70px;
}

.chat-msg__dots {
  display: flex;
  gap: 5px;
  padding: 6px 0 2px;
}

.chat-msg__dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-mid);
  animation: hpulse 1.4s infinite;
}

.chat-msg__dots span:nth-child(2) { animation-delay: .2s; }
.chat-msg__dots span:nth-child(3) { animation-delay: .4s; }

.chat-input-bar {
  flex: none;
  padding: 14px 0 18px;
  background: var(--bg);
}

.chat-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px;
  border: 1px solid var(--border-4);
  border-radius: 14px;
  background: var(--field-2);
  transition: border-color .14s;
}

.chat-input-wrap:focus-within {
  border-color: var(--border-hover);
}

.chat-input-wrap input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: none;
  color: var(--text);
  font-size: 14px;
  padding: 9px 12px;
}

.chat-input-wrap input::placeholder {
  color: var(--text-low);
}

.chat-send {
  width: 36px;
  height: 36px;
  flex: none;
  border: 0;
  border-radius: 11px;
  background: #A78BFA;
  color: #0F0A1E;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: opacity .14s, background .14s;
}

.chat-send:hover {
  background: #8B6FDF;
}

.chat-send:disabled {
  opacity: 0.4;
  pointer-events: none;
}

@media (max-width: 759px) {
  .chat-msg--user .chat-msg__bubble { max-width: 85%; }
  .chat-msg--ai .chat-msg__bubble   { max-width: 90%; }
}

/* ── App Frame (embedded apps) ── */
.view-app-frame {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
}

.app-frame__toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex: none;
}

.app-frame__back {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border: 1px solid var(--border-4);
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  transition: background .14s;
}
.app-frame__back:hover { background: var(--surface-4); }

.app-frame__title {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
  color: var(--text-hi);
}

.app-frame__external {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-4);
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--text-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: background .14s, color .14s;
}
.app-frame__external:hover {
  background: var(--surface-4);
  color: var(--text-hi);
}

.app-frame__iframe {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}

/* ── Profile Dropdown ── */
.sidebar__profile { position: relative; }

.profile-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: 6px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 6px;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 100;
}

.profile-dropdown__info {
  padding: 8px 10px 4px;
}

.profile-dropdown__name {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-hi);
}

.profile-dropdown__role {
  font-size: 11px;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.profile-dropdown__sep {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

.profile-dropdown__item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background .12s;
  text-align: left;
}

.profile-dropdown__item:hover { background: rgba(110,134,245,0.1); }

.profile-dropdown__item--danger { color: var(--danger); }
.profile-dropdown__item--danger:hover { background: rgba(225,116,106,0.1); }

/* ── Settings Page ── */
.view-settings { padding: 24px 32px; overflow-y: auto; }

.settings-layout { max-width: 720px; display: flex; flex-direction: column; gap: 24px; }

.settings-section__title { font-size: 15px; font-weight: 700; color: var(--text-hi); margin: 0 0 12px; }

.settings-card { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 20px; }

.settings-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border-3); }
.settings-row:last-child { border-bottom: 0; }
.settings-label { font-size: 13px; color: var(--text-mid); }
.settings-value { font-size: 13px; color: var(--text-hi); font-weight: 500; }

.settings-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.settings-field label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.settings-field input { padding: 9px 12px; border: 1px solid var(--border-4); border-radius: var(--r-sm); background: var(--surface-1); color: var(--text-hi); font-size: 13px; outline: none; }
.settings-field input:focus { border-color: var(--primary); }

.settings-field-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.settings-field-inline input { padding: 8px 10px; border: 1px solid var(--border-4); border-radius: var(--r-sm); background: var(--surface-1); color: var(--text-hi); font-size: 13px; outline: none; flex: 1; min-width: 120px; }
.settings-field-inline select { padding: 8px 10px; border: 1px solid var(--border-4); border-radius: var(--r-sm); background: var(--surface-1); color: var(--text-hi); font-size: 13px; outline: none; }

.settings-msg { padding: 8px 12px; border-radius: var(--r-sm); font-size: 13px; margin-top: 10px; }
.settings-msg--ok { background: rgba(79,176,122,0.1); color: var(--success-2); border: 1px solid rgba(79,176,122,0.2); }
.settings-msg--err { background: rgba(225,116,106,0.1); color: var(--danger); border: 1px solid rgba(225,116,106,0.2); }

.btn-danger { background: var(--danger) !important; }
.btn-danger:hover { background: #c95a50 !important; }
.btn-sm { padding: 5px 10px; border: 1px solid var(--border-4); border-radius: 5px; background: var(--surface-3); color: var(--text); font-size: 11.5px; cursor: pointer; }
.btn-sm:hover { background: var(--surface-4); }
.btn-danger-sm { border-color: rgba(225,116,106,0.3); color: var(--danger); }
.btn-danger-sm:hover { background: rgba(225,116,106,0.1); }
.btn-ok-sm { border-color: rgba(79,176,122,0.3); color: var(--success-2); }
.btn-ok-sm:hover { background: rgba(79,176,122,0.1); }

.text-ok { color: var(--success-2); }
.text-err { color: var(--danger); }

.admin-create { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.admin-create h3, .admin-list h3 { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 0 0 12px; }

.admin-table { font-size: 12.5px; }
.admin-th, .admin-tr { display: grid; grid-template-columns: 1.2fr 0.7fr 0.7fr 1.2fr 2fr; gap: 8px; padding: 8px 4px; align-items: center; }
.admin-th { color: var(--text-low); font-weight: 600; font-size: 11px; text-transform: uppercase; border-bottom: 1px solid var(--border); }
.admin-tr { border-bottom: 1px solid var(--border-3); }
.admin-tr:last-child { border-bottom: 0; }
.admin-actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.admin-actions select { padding: 4px 6px; border: 1px solid var(--border-4); border-radius: 4px; background: var(--surface-1); color: var(--text); font-size: 11px; }

/* ── Task Section ── */
.task-section-head {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-low);
  padding: 10px 4px 6px;
}

.task-empty {
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-low);
}

/* ============================================================
   Workspace sidebar list
   ============================================================ */
.nav-cap { position: relative; display: flex; align-items: center; justify-content: space-between; }
.nav-cap__add {
  background: transparent; border: 1px solid var(--border-4); border-radius: 4px;
  color: var(--text-low); font-size: 14px; padding: 0 6px; cursor: pointer; line-height: 1.4;
  transition: color .13s, border-color .13s;
}
.nav-cap__add:hover { color: var(--text); border-color: var(--primary); }
.nav-cap__toggle {
  background: transparent; border: none; color: var(--text-low); font-size: 12px;
  padding: 0 2px; cursor: pointer; transition: color .13s;
}
.nav-cap__toggle:hover { color: var(--text); }

.sidebar__ws-list { padding: 0 0 4px; }
.ws-nav-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 6px 12px; border: none; border-radius: 6px;
  background: transparent; color: var(--text-low); font-size: 12.5px;
  cursor: pointer; text-align: left; transition: background .12s, color .12s;
}
.ws-nav-item:hover { background: var(--surface-3); color: var(--text); }
.ws-nav-item.is-active { background: rgba(99,102,241,0.12); color: var(--primary); }
.ws-nav-item__dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }

/* ============================================================
   Workspace View
   ============================================================ */
.ws-detail { padding: var(--pad); max-width: 960px; }
.ws-detail__head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.ws-detail__back {
  background: transparent; border: 1px solid var(--border-2); border-radius: var(--r-sm);
  color: var(--text-low); font-size: 12px; padding: 6px 10px; cursor: pointer;
  display: flex; align-items: center; gap: 4px;
}
.ws-detail__back:hover { color: var(--text); background: var(--surface-3); }
.ws-detail__info { flex: 1; }
.ws-detail__name { font-size: 20px; font-weight: 700; color: var(--text); margin: 0; }
.ws-detail__type {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  background: var(--surface-3); color: var(--text-low); padding: 2px 8px; border-radius: 4px;
  margin-left: 8px;
}
.ws-detail__status {
  font-size: 11px; color: var(--success-2); margin-left: 8px;
}
.ws-detail__actions { flex: none; display: flex; gap: 6px; align-items: center; }
.ws-new-conv-btn--oc {
  background: var(--oc-500, #10B981) !important;
  border-color: var(--oc-500, #10B981) !important;
  color: #fff !important;
}
.ws-new-conv-btn--oc:hover { background: var(--oc-600, #059669) !important; }
.ws-detail__body { }
.ws-detail__cols { display: grid; grid-template-columns: 1fr 280px; gap: 24px; }
.ws-detail__main h3, .ws-detail__side h4 {
  font-size: 13px; font-weight: 600; color: var(--text-mid); margin: 0 0 12px; text-transform: uppercase; letter-spacing: .04em;
}
.ws-conv-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--border-3); border-radius: var(--r-sm);
  margin-bottom: 6px; cursor: pointer; transition: background .12s;
}
.ws-conv-item:hover { background: var(--surface-2); }
.ws-conv-item__id { font-size: 11px; color: var(--text-dim); font-family: var(--font-mono); }
.ws-conv-item__agent {
  font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
  padding: 1px 6px; border-radius: 3px;
}
.ws-conv-item__agent--hermes { background: rgba(69,192,214,0.12); color: #45C0D6; }
.ws-conv-item__agent--openclaw { background: rgba(212,179,106,0.12); color: #D4B36A; }
.ws-conv-item__title { flex: 1; font-size: 13px; color: var(--text); }
.ws-conv-item__meta { font-size: 11px; color: var(--text-dim); }
.ws-card {
  border: 1px solid var(--border-2); border-radius: var(--r-md);
  padding: 14px; margin-bottom: 12px; background: var(--surface-1);
}
.ws-card h4 { margin: 0 0 6px !important; font-size: 11px !important; color: var(--text-low) !important; }
.ws-card p { font-size: 13px; color: var(--text-mid); margin: 0; line-height: 1.5; }

/* ============================================================
   Modal
   ============================================================ */
/* Ensure hidden attribute works even with explicit display rules */
[hidden] { display: none !important; }

.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center;
}
.modal {
  background: var(--surface-1); border: 1px solid var(--border-2); border-radius: var(--r-lg);
  width: 480px; max-width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border-3);
}
.modal__head h3 { font-size: 16px; font-weight: 700; color: var(--text); margin: 0; }
.modal__close { background: transparent; border: none; color: var(--text-low); font-size: 20px; cursor: pointer; }
.modal__close:hover { color: var(--text); }
.modal__body { padding: 20px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border-3); }
.modal__foot .btn-secondary { padding: 8px 16px; border: 1px solid var(--border-2); border-radius: var(--r-sm); background: transparent; color: var(--text-mid); cursor: pointer; font-size: 13px; }
.modal__foot .btn-primary { padding: 8px 16px; border: none; border-radius: var(--r-sm); background: var(--primary); color: #fff; cursor: pointer; font-size: 13px; font-weight: 600; }
.modal__foot .btn-primary:hover { background: #5558E6; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-mid); margin-bottom: 5px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border-2); border-radius: var(--r-sm);
  background: var(--field); color: var(--text); font-size: 13px; outline: none; box-sizing: border-box;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); }
.form-group textarea { resize: vertical; font-family: inherit; }

/* ============================================================
   Workspace Tabs
   ============================================================ */
.ws-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border-2); margin-bottom: 20px;
}
.ws-tab {
  padding: 10px 18px; border: none; border-bottom: 2px solid transparent;
  background: transparent; color: var(--text-low); font-size: 13px; cursor: pointer;
  transition: color .13s, border-color .13s;
}
.ws-tab:hover { color: var(--text); }
.ws-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.ws-tab-panel[hidden] { display: none; }

.ws-mem-add, .ws-mem-item {
  display: flex; gap: 8px; align-items: center; margin-bottom: 8px;
}
.ws-mem-add input {
  padding: 6px 10px; border: 1px solid var(--border-2); border-radius: var(--r-sm);
  background: var(--field); color: var(--text); font-size: 13px; outline: none;
}
.ws-mem-add input:focus { border-color: var(--primary); }
.ws-mem-item { padding: 8px 0; border-bottom: 1px solid var(--border-3); }
.ws-mem-item__key { font-weight: 600; color: var(--primary); min-width: 100px; font-size: 12px; }
.ws-mem-item__value { flex: 1; color: var(--text); font-size: 13px; word-break: break-all; }
.ws-mem-item__del { background: transparent; border: none; color: var(--danger); cursor: pointer; font-size: 14px; }
.ws-mem-item__edit { background: transparent; border: none; color: var(--text-dim); cursor: pointer; font-size: 13px; margin-right: 2px; }
.ws-mem-item__edit:hover { color: var(--primary); }
.ws-mem-item__input {
  flex: 1; padding: 4px 8px; border: 1px solid var(--primary); border-radius: 4px;
  background: var(--field); color: var(--text); font-size: 13px; outline: none;
}

.ws-snap-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--border-2); border-radius: var(--r-sm); margin-bottom: 6px;
  transition: border-color .15s, background .15s;
}
.ws-snap-item:hover { border-color: var(--primary); background: rgba(99,102,241,0.06); }
.ws-snap-item__idx { font-weight: 700; color: var(--primary); font-size: 14px; }
.ws-snap-item__info { flex: 1; }
.ws-snap-item__name { font-size: 13px; color: var(--text); }
.ws-snap-item__date { font-size: 11px; color: var(--text-dim); }

.ws-timeline-item {
  display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-3);
  font-size: 13px;
}
.ws-timeline-item__type { color: var(--text-dim); min-width: 32px; text-align: center; }
.ws-timeline-item__title { flex: 1; color: var(--text); }
.ws-timeline-item__date { color: var(--text-dim); font-size: 11px; white-space: nowrap; }

.ws-timeline-add { display: flex; gap: 8px; margin-top: 12px; align-items: center; }
.ws-timeline-add select {
  padding: 6px 8px; border: 1px solid var(--border-2); border-radius: 4px;
  background: var(--field); color: var(--text); font-size: 12px; outline: none;
}
.ws-timeline-add input {
  flex: 1; padding: 6px 8px; border: 1px solid var(--border-2); border-radius: 4px;
  background: var(--field); color: var(--text); font-size: 13px; outline: none;
}
.ws-timeline-add input:focus { border-color: var(--primary); }
.ws-timeline-add .btn-sm { white-space: nowrap; }

.ws-snap-detail__meta {
  display: flex; gap: 16px; margin-bottom: 16px; font-size: 12px; color: var(--text-dim);
}
.ws-field-ro {
  padding: 8px 10px; background: var(--field); border-radius: 4px;
  font-size: 13px; color: var(--text); white-space: pre-wrap; word-break: break-word;
  min-height: 28px; line-height: 1.5;
}

/* ============================================================
   Notification Panel (live data)
   ============================================================ */
.notif-empty { padding: 20px; text-align: center; color: var(--text-dim); font-size: 13px; }
.notif-item {
  display: flex; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border-3);
  cursor: pointer; transition: background .12s; align-items: flex-start;
}
.notif-item:hover { background: var(--surface-3); }
.notif-item.is-unread { background: rgba(99,102,241,0.06); }
.notif-item__icon { font-size: 16px; flex: none; margin-top: 2px; }
.notif-item__body { flex: 1; min-width: 0; }
.notif-item__title { font-size: 13px; color: var(--text); font-weight: 600; }
.notif-item__msg { font-size: 12px; color: var(--text-mid); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notif-item__time { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.notif-item__action {
  flex: none; padding: 4px 8px; background: var(--primary); color: #fff;
  border: none; border-radius: 4px; font-size: 11px; cursor: pointer;
}
.notif-item__action:hover { background: #5558E6; }


/* ── Live News ── */
.news-tabs { display: flex; gap: 6px; }
.news-tab {
  padding: 4px 12px; border: 1px solid var(--border); border-radius: 16px;
  background: transparent; color: var(--text-mid); font-size: 12px; cursor: pointer;
  transition: all .15s;
}
.news-tab:hover { color: var(--text); border-color: var(--border-hover); }
.news-tab.is-active { background: var(--primary, #6E86F5); border-color: var(--primary, #6E86F5); color: #fff; }

.news-item {
  display: block; padding: 8px 0; border-bottom: 1px solid var(--border-3);
  text-decoration: none; color: var(--text); transition: color .15s;
}
.news-item:last-child { border-bottom: none; }
.news-item:hover { color: var(--primary, #6E86F5); }
.news-item__title { display: block; font-size: 13px; font-weight: 500; line-height: 1.4; }
.news-item__desc { display: block; font-size: 11.5px; color: var(--text-mid); margin-top: 3px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.news-item__date { display: block; font-size: 10.5px; color: var(--text-low); margin-top: 2px; }

.news-briefing { font-size: 13px; line-height: 1.6; color: var(--text-2); padding: 4px 0; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Toggle switch ── */
.toggle-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--surface-3); border: 1px solid var(--border); border-radius: 24px; transition: .2s; }
.toggle-slider::before { content: ""; position: absolute; height: 16px; width: 16px; left: 3px; bottom: 3px; background: var(--text-low); border-radius: 50%; transition: .2s; }
.toggle-switch input:checked + .toggle-slider { background: var(--primary, #6E86F5); border-color: var(--primary, #6E86F5); }
.toggle-switch input:checked + .toggle-slider::before { background: #fff; transform: translateX(18px); }
.settings-hint { font-size: 11.5px; color: var(--text-low); margin-top: 6px; line-height: 1.5; }

/* ============================================================
   Mobile Phase A — Chat · Design · Automation
   ALL rules inside max-width:759px. 760px+ = zero effect.
   ============================================================ */
@media (max-width: 759px) {
  /* ── Mobile overlay (sidebar backdrop) ── */
  .mobile-overlay {
    position: fixed; inset: 0; z-index: 150;
    background: rgba(0,0,0,0.45);
    display: none;
  }
  .mobile-overlay.mobile-overlay-open { display: block; }

  /* ── Chat toggle button ── */
  .mobile-chat-toggle {
    display: flex !important; align-items: center; justify-content: center;
    width: 40px; height: 40px; flex: none;
    border: 1px solid var(--border-4); border-radius: var(--r-sm);
    background: var(--surface-3); color: var(--text-mid);
    font-size: 18px; cursor: pointer;
  }
  .chat-main__header {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; border-bottom: 1px solid var(--border-3);
  }

  /* ── Chat sidebar mobile ── */
  .chat-sidebar {
    position: fixed; top: 0; left: -100%;
    width: 280px; max-width: 85vw; height: 100%;
    z-index: 200; transition: left .25s ease;
    background: var(--surface-1); border-right: 1px solid var(--border-3);
    box-shadow: none;
  }
  .chat-sidebar.mobile-chat-open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  .chat-main { width: 100%; }

  /* ── Design Chat mobile fullscreen ── */
  .design-chat.mobile-design-fullscreen {
    position: fixed; inset: 0; z-index: 300; margin: 0;
    border-radius: 0; border: none;
    display: flex; flex-direction: column;
    background: var(--bg);
  }
  .design-chat.mobile-design-fullscreen .design-chat__messages {
    flex: 1; max-height: none;
  }
  .design-chat__close-mobile {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; flex: none;
    border: 1px solid var(--border-4); border-radius: var(--r-sm);
    background: var(--surface-3); color: var(--text-mid);
    font-size: 16px; cursor: pointer;
  }

  /* ── Automation mobile ── */
  .mobile-automation-expanded .auto-pipeline-card {
    padding: 12px; font-size: 12.5px;
  }
  .auto-step-chain { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* ── Touch targets (≥44px) ── */
  .btn-primary, .btn-secondary, .dt-btn,
  .task-tab, .chat-send, .icon-btn {
    min-height: 44px;
  }

  /* ── View padding ── */
  .view { padding: 12px; }

  /* ═══ Phase B: Tasks · Apps · Settings ═══ */

  /* ── Tasks filter tabs — horizontal scroll ── */
  .tasks-view__filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    gap: 5px;
  }
  .task-tab {
    flex: none;
    white-space: nowrap;
    font-size: 12px;
    padding: 7px 13px;
  }

  /* ── Task rows — compact single-col ── */
  .task-row {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 4px;
  }
  .task-row__body {
    min-width: 0;
    flex: 1 1 100%;
    order: 1;
  }
  .task-row__end {
    order: 2;
    flex-direction: row;
    align-items: center;
    gap: 6px;
  }
  .task-row__ico {
    width: 34px;
    height: 34px;
    font-size: 16px;
  }

  /* ── Project detail panel — full width ── */
  .project-detail[hidden] { display: none; }
  .project-detail:not([hidden]) ~ .tasks-view__list { display: none; }

  /* ── Apps grid — smaller cards ── */
  .app-grid {
    grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
    gap: 10px;
  }
  .app-card {
    padding: 14px;
  }
  .cat-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .cat-tab {
    flex: none;
    white-space: nowrap;
    font-size: 11.5px;
    padding: 6px 12px;
  }

  /* ── Settings — admin table → vertical stack ── */
  .admin-th, .admin-tr {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 8px 4px;
    font-size: 12px;
  }
  .admin-tr {
    border-bottom: 1px solid var(--border-2);
    padding: 10px 4px;
  }
  .admin-actions {
    margin-top: 4px;
  }
  .settings-layout {
    gap: 16px;
  }
  .settings-card {
    padding: 14px;
  }
  .settings-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 8px 0;
  }
  .settings-field-inline {
    flex-direction: column;
  }
  .settings-field-inline input {
    min-width: 0;
  }

  /* ── View header — compact ── */
  .tasks-view__header h2 {
    font-size: 16px;
  }

  /* ═══ Phase C: MCP Manager · Dashboard · Mobile Nav ═══ */

  /* ── MCP Manager: stats compact (3→2 col at narrow) ── */
  .mcp-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .mcp-stat-card {
    padding: 12px 10px;
  }
  .mcp-stat-num {
    font-size: 20px;
  }
  .mcp-stat-label {
    font-size: 10px;
  }

  /* ── MCP filters: horizontal scroll ── */
  .mcp-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    gap: 5px;
  }
  .mcp-filter-btn {
    flex: none;
    white-space: nowrap;
    font-size: 11px;
    padding: 6px 12px;
    min-height: 44px;
  }

  /* ── MCP server cards: compact ── */
  .mcp-server-card {
    padding: 12px;
  }
  .mcp-server-card__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .mcp-server-card__name {
    font-size: 13px;
  }
  .mcp-server-card__name i {
    font-size: 15px;
  }
  .mcp-server-card__desc {
    font-size: 11px;
    margin-bottom: 6px;
  }
  .mcp-server-card__tools {
    gap: 3px;
  }
  .mcp-tool-tag {
    font-size: 10px;
    padding: 2px 6px;
    min-height: 32px;
    display: flex;
    align-items: center;
  }
  .mcp-server-card__meta {
    font-size: 10px;
    margin-top: 6px;
    padding-top: 6px;
  }

  /* ── MCP header ── */
  .mcp-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .mcp-title {
    font-size: 16px;
  }

  /* ── Dashboard: greeting compact ── */
  .greeting {
    flex-direction: column;
    gap: 10px;
  }
  .greeting__eyebrow {
    font-size: 11px;
  }
  .hero {
    font-size: 22px;
  }
  .hero-sub {
    font-size: 13px;
  }
  .clock {
    text-align: left;
  }
  .clock__time {
    font-size: 18px;
  }

  /* ── Dashboard: palette CTA compact ── */
  .palette-cta {
    padding: 10px 12px;
    gap: 8px;
  }
  .palette-cta__text {
    font-size: 12px;
  }
  .palette-cta__keys {
    display: none;
  }

  /* ── Dashboard: section head compact ── */
  .sec-head {
    flex-wrap: wrap;
    gap: 8px;
  }
  .section-title {
    font-size: 15px;
  }

  /* ── Dashboard: system bars compact ── */
  .sys-bar {
    gap: 8px;
  }
  .sys-bar__label {
    min-width: 40px;
    font-size: 11px;
  }
  .sys-bar__val {
    font-size: 11px;
    min-width: 36px;
    text-align: right;
  }

  /* ── Dashboard: task tabs scroll ── */
  .task-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }

  /* ── Dashboard: card padding ── */
  .card {
    padding: 14px;
  }

  /* ── Mobile nav: more items → compact spacing ── */
  .mobile-nav {
    gap: 2px;
    padding: 6px 4px;
  }
  .mobile-nav__btn {
    min-height: 48px;
    padding: 6px 2px 4px;
    min-width: 0;
    flex: 1;
    gap: 2px;
    font-size: 9.5px;
  }
  .mobile-nav__btn .ph {
    font-size: 20px;
  }
  .mobile-nav__btn span {
    font-size: 9px;
    white-space: nowrap;
  }
}

/* ── Dashboard Card loading / degraded states ── */
.dash-card--loading {
  position: relative;
  overflow: hidden;
}
.dash-card--loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255,255,255,0.04) 40%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 60%,
    transparent 100%);
  animation: dash-shimmer 1.6s ease-in-out infinite;
}
@keyframes dash-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
.dash-card--degraded {
  opacity: 0.55;
  filter: grayscale(0.3);
}
.dash-card--degraded::before {
  content: '⚠️ 불러오기 실패';
  display: block;
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-low);
  text-align: center;
}
.dash-card--loaded {}

/* ── Calendar View ── */
.view-calendar { padding: 24px 32px; }
.calendar-layout { max-width: 1100px; }

.calendar-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-range {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  min-width: 160px;
  text-align: center;
  margin: 0;
}

.calendar-status {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}

.calendar-week {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.cal-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--surface);
}

.cal-body > div:last-child > div {
  border-bottom: none;
}
.cal-body > div > div:last-child {
  border-right: none;
}
