:root {
  /* Light theme (ChatGPT-like)
     - Main area: white
     - Sidebar: light gray
  */
  --bg: #ffffff;
  --panel: #ffffff;
  --panel2: #f3f4f6;
  --text: #111827;
  --muted: #6b7280;
  --border: rgba(0,0,0,0.08);
  --accent: #10a37f; /* ChatGPT-ish green */
  --shadow: rgba(0,0,0,0.10);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Meiryo", Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  /* The whole app is fixed to the viewport.
     Any scrolling must happen only inside the designated inner areas. */
  overflow: hidden;
}

a { color: inherit; text-decoration: none; }

.app {
  height: 100vh;
  width: 100vw;
  display: grid;
  grid-template-columns: 300px 1fr;
  overflow: hidden;
}

.app.is-sidebar-collapsed {
  grid-template-columns: 72px 1fr;
}

/* Sidebar */
.sidebar {
  background: var(--panel2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 260px;
  /* Prevent the sidebar itself from scrolling; only the thread list scrolls */
  overflow: hidden;
}

.app.is-sidebar-collapsed .sidebar {
  min-width: 72px;
}

.sidebar__top {
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
}

.brand--link {
  color: inherit;
  text-decoration: none;
}

.brand--link:hover {
  opacity: 0.92;
}

.brand__logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  box-shadow: 0 8px 24px var(--shadow);
}

.brand__name { font-weight: 700; }
.brand__sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.sidebar__toggle {
  flex: 0 0 auto;
  padding: 8px 10px;
}

.iconbtn--ghost {
  background: transparent;
}

.iconbtn--ghost:hover {
  background: rgba(0,0,0,0.04);
}

.sidebar__btn {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar__btnText { white-space: nowrap; }

.sidebar__btn {
  width: 100%;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.55);
  color: var(--text);
  cursor: pointer;
}

.sidebar__btn:hover { background: rgba(255,255,255,0.75); }
.sidebar__btn.secondary { background: transparent; }

.sidebar__sectionTitle {
  padding: 14px 14px 8px;
  font-size: 12px;
  color: var(--muted);
}

.threads {
  padding: 0 8px;
  overflow: auto;
  /* Allow this region to take the remaining sidebar height and scroll */
  flex: 1 1 auto;
  min-height: 0;
}
/* Threads list row */
.threadRow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  margin: 2px 0;
  position: relative;
}
.threadRow:hover { background: rgba(0,0,0,0.04); }
.threadRow.is-active { background: rgba(16,163,127,0.10); border: 1px solid rgba(16,163,127,0.25); }

.threadRow__link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.thread__icon { width: 20px; text-align: center; opacity: 0.9; }
.thread__title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.threadRow__actions {
  margin-left: auto;
  position: relative;
  display: flex;
  align-items: center;
}

.threadMenuBtn {
  padding: 6px 8px;
  border-radius: 10px;
}

/* Thread dropdown menu (shared for sidebar & topbar) */
.threadMenu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 200px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: 0 18px 50px var(--shadow);
  padding: 6px;
  display: none;
  z-index: 80;
}

.threadMenu.is-open { display: block; }

.threadMenu__item {
  width: 100%;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
  border: 0;
  background: none;
  cursor: pointer;
  text-align: left;
}

.threadMenu__item:hover { background: rgba(0,0,0,0.04); }

.threadMenu__item i {
  width: 18px;
  text-align: center;
  color: var(--muted);
  opacity: 0.95;
}

.threadMenu__item span { flex: 1; }

.sidebar__bottom {
  margin-top: auto;
  padding: 14px;
  border-top: 1px solid var(--border);
}

.userarea { position: relative; }

.userchip { display: flex; gap: 10px; align-items: center; margin: 0; }
.userchip--btn {
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.55);
  cursor: pointer;
  text-align: left;
}

.userchip--btn:hover { background: rgba(255,255,255,0.75); }

.userchip__avatar {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.06);
}

.userchip__caret {
  margin-left: auto;
  opacity: 0.8;
}

.userchip__name { font-size: 13px; font-weight: 600; }
.userchip__email { font-size: 12px; color: var(--muted); }

.usermenu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: 0 18px 50px var(--shadow);
  padding: 6px;
  display: none;
  z-index: 50;
}

.usermenu.is-open { display: block; }

.usermenu__item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 14px;
}

.usermenu__item:hover { background: rgba(0,0,0,0.04); }

/* ChatGPT-like icon + label alignment inside the popup menu */
.usermenu__item i {
  width: 18px;
  text-align: center;
  color: var(--muted);
  opacity: 0.95;
}

.usermenu__item span {
  flex: 1;
}

/* User menu form/button (for POST actions like logout) */
.usermenu__form {
  margin: 0;
}

.usermenu__item--button {
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  outline: none;
}

.usermenu__item--button:focus,
.usermenu__item--button:focus-visible {
  outline: none;
  box-shadow: none;
}

/* Sidebar collapsed */
.app.is-sidebar-collapsed .brand__text,
.app.is-sidebar-collapsed .sidebar__sectionTitle,
.app.is-sidebar-collapsed .thread__title,
.app.is-sidebar-collapsed .threadRow__actions,
.app.is-sidebar-collapsed .sidebar__btnText,
.app.is-sidebar-collapsed .userchip__meta,
.app.is-sidebar-collapsed .userchip__caret {
  display: none;
}

.app.is-sidebar-collapsed .threads { padding: 0 6px; }
.app.is-sidebar-collapsed .threadRow { justify-content: center; padding: 10px 0; }
.app.is-sidebar-collapsed .sidebar__btn { justify-content: center; }

.app.is-sidebar-collapsed .sidebar__toggle i { transform: rotate(180deg); }

/* A11y */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Small toast for actions (copy link / rename) */
.kobit-toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%) translateY(10px);
  opacity: 0;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.78);
  color: #fff;
  font-size: 13px;
  z-index: 200;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  max-width: 90vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kobit-toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Main */
.main {
  display: grid;
  grid-template-rows: 56px 1fr auto;
  min-width: 0;
  /* Ensure the middle row can become a scroll container */
  min-height: 0;
  /* Keep the right pane fixed to the viewport; allow scrolling only in
     the center message area / content area */
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.topbar__title { font-weight: 700; }

.topbar__actions {
  position: relative;
  display: flex;
  align-items: center;
}

.topbar__actions .threadMenu {
  top: calc(100% + 6px);
}
.iconbtn {
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.03);
  color: var(--text);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
}
.iconbtn:hover { background: rgba(0,0,0,0.06); }

.chat {
  overflow: auto;
  background: var(--panel);
  /* Required so grid row can shrink and the inner scrollbar works */
  min-height: 0;
}

/* Thread top message (sticky notice) */
.topmsg {
  position: sticky;
  top: 0;
  z-index: 5;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(6px);
}

.topmsg__inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 18px;
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
}

.topmsg__inner i {
  margin-top: 2px;
  color: rgba(0,0,0,0.60);
}

.topmsg__text {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Generic scrollable content area (used by top page etc.) */
.page {
  overflow: auto;
  background: var(--panel);
  min-height: 0;
}

.page__content {
  max-width: 980px;
  margin: 0 auto;
  padding: 18px;
}

.messages {
  max-width: 980px;
  margin: 0 auto;
  padding: 18px 18px 30px;
}

.msg {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius);
  margin: 10px 0;
  border: 1px solid var(--border);
}
.msg--assistant { background: #f9fafb; }
.msg--user { background: rgba(16,163,127,0.10); border-color: rgba(16,163,127,0.22); }

.msg__avatar img {
  width: 32px;
  height: 32px;
  border-radius: 12px;
}
.userdot {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.06);
}

.msg__content {
  line-height: 1.65;
  font-size: 15px;
  color: var(--text);
  white-space: normal;
  word-break: break-word;
}

/* GitHub Markdown CSS: chat bubble friendly overrides (scoped) */
.msg__content--md .markdown-body {
  /*background: transparent;*/
  background: #f9fafb;
  padding: 0;
  margin: 0;
  color: inherit;
  font-size: inherit;
}

.msg__content--md .markdown-body pre {
  overflow-x: auto;
}

.msg__content--md .markdown-body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
}

/* Composer */
.composer {
  border-top: 1px solid var(--border);
  background: var(--panel);
  padding: 12px 16px 14px;
}

.composer__form {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 10px;
  align-items: end;
}

.composer__form--with-attach {
  grid-template-columns: 44px 1fr 44px;
}

.composer__file {
  /* hidden but accessible; opened via button */
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.composer__attach {
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.composer__attach:hover {
  background: rgba(0,0,0,0.03);
}

.composer__filechip {
  max-width: 980px;
  margin: 8px auto 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  color: var(--text);
}

.composer__filechipName {
  max-width: 740px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer__filechipRemove {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
}

.composer__filechipRemove:hover { color: var(--text); }

.composer__input {
  width: 100%;
  resize: none;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #f9fafb;
  color: var(--text);
  font-size: 15px;
  outline: none;
  min-height: 44px;
  max-height: 180px;
}

.composer__input:focus {
  border-color: rgba(16,163,127,0.55);
  box-shadow: 0 0 0 3px rgba(16,163,127,0.15);
}

.composer__send {
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(16,163,127,0.35);
  background: rgba(16,163,127,0.16);
  color: var(--text);
  cursor: pointer;
}

.composer__send:hover { background: rgba(16,163,127,0.26); }

.composer__hint {
  max-width: 980px;
  margin: 8px auto 0;
  font-size: 12px;
  color: var(--muted);
}

/* Settings */
.settings {
  overflow: auto;
  background: var(--panel);
  padding: 18px;
}

.alert {
  max-width: 980px;
  margin: 0 auto 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 14px;
}
.alert--success { background: rgba(16,163,127,0.12); border-color: rgba(16,163,127,0.25); }
.alert--error { background: rgba(220,38,38,0.10); border-color: rgba(220,38,38,0.25); }

.tabs {
  max-width: 980px;
  margin: 0 auto 16px;
  display: flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(0,0,0,0.02);
}

.tab {
  text-decoration: none;
  color: var(--text);
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14px;
}

.tab:hover { background: rgba(0,0,0,0.04); }
.tab.is-active { background: rgba(16,163,127,0.14); border-color: rgba(16,163,127,0.25); }

.tabpane {
  max-width: 980px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  padding: 18px;
}

.settings__h {
  margin: 0 0 14px;
  font-size: 18px;
}

/* Settings: thread table */
.settings__tools{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin: 0 0 12px;
  flex-wrap: wrap;
}
.settings__search{
  position: relative;
  min-width: 260px;
  flex: 1 1 320px;
  max-width: 520px;
}
.settings__search i{
  position:absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events:none;
}
.settings__searchInput{
  width:100%;
  padding-left: 34px;
}
.settings__hint{
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.settings__scroll{
  overflow:auto;
  max-height: 560px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background:#fff;
}

/* Table UI (used in Settings > Thread) */
.table{
  width:100%;
  border-collapse: separate;
  border-spacing: 0;
}

.tableThread{
  display:flex;
  align-items:flex-start;
  gap: 10px;
}
.tableThread .thread__icon{
  flex: 0 0 20px;
  margin-top: 2px;
}
.tableThread__meta{ min-width: 0; }
.table__th{
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  text-align: left;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
  user-select: none;
}
.table__th.is-right{ text-align:right; }
.table__th.is-center{ text-align:center; }

.table__td{
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: top;
}
.table__td.is-right{ text-align:right; }
.table__td.is-center{ text-align:center; }

.table__primary{ font-weight: 600; }
.table__link{ color: inherit; text-decoration: none; }
.table__link:hover{ text-decoration: underline; }
.table__sub{ margin-top: 2px; font-size: 12px; color: var(--muted); }

.table__tr:hover .table__td{
  background: rgba(0,0,0,0.02);
}

.table__th.is-sort{
  cursor: pointer;
}
.table__th.is-sort::after{
  content: "↕";
  margin-left: 6px;
  font-size: 12px;
  opacity: 0.45;
}
.table__th.is-sorted[aria-sort="ascending"]::after{ content:"↑"; opacity: 0.9; }
.table__th.is-sorted[aria-sort="descending"]::after{ content:"↓"; opacity: 0.9; }

.form { display: grid; gap: 14px; }
.formrow { display: grid; gap: 8px; }
.formrow__label { font-weight: 700; font-size: 13px; }
.formrow__help { color: var(--muted); font-size: 12px; line-height: 1.5; }

.formrow__help .helpLink{ color: var(--muted); text-decoration: underline; font-weight: 700; }
.formrow__help .helpLink:hover{ color: var(--text); }
.formrow__help .helpLink i{ margin-right: 6px; }

.input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f9fafb;
  font-size: 14px;
  outline: none;
}
.input:focus {
  border-color: rgba(16,163,127,0.55);
  box-shadow: 0 0 0 3px rgba(16,163,127,0.15);
}

.formactions { display: flex; justify-content: flex-end; }
.btn {
  border: 1px solid rgba(16,163,127,0.35);
  background: rgba(16,163,127,0.16);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
}
.btn:hover { background: rgba(16,163,127,0.26); }

.btn--danger{
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.12);
}
.btn--danger:hover{ background: rgba(239, 68, 68, 0.20); }

/* Modal (Project Settings-like) */
.modal{
  position: fixed;
  inset: 0;
  display: none;
  z-index: 120;
}
.modal.is-open{ display:block; }
.modal__backdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,0.35);
}
.modal__panel{
  position: absolute;
  inset: 24px;
  margin: 0 auto;
  max-width: 860px;
  height: calc(100vh - 48px);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 70px var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal__panel--small{
  max-width: 640px;
}
.modal__header{
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
}
.modal__title{ font-weight: 800; font-size: 16px; }
.modal__close{ padding: 8px 10px; border-radius: 12px; }
.modal__body{
  padding: 16px;
  overflow: auto;
  min-height: 0;
}

.tsIcon{
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  align-items: start;
}
.tsIcon__preview{
  width: 56px;
  height: 56px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #f9fafb;
  display:grid;
  place-items:center;
  font-size: 22px;
}
.tsIcon__controls{ display: grid; gap: 10px; }
.tsIcon__row{ display:flex; gap: 10px; align-items:center; }
.tsIcon__color{ width: 64px; padding: 0; height: 42px; }

.tsDanger{
  border: 1px solid rgba(239, 68, 68, 0.22);
  background: rgba(239, 68, 68, 0.06);
  border-radius: 16px;
  padding: 14px;
}
.tsDanger__title{ font-weight: 800; font-size: 13px; margin-bottom: 10px; color: #991b1b; }
.tsDanger__grid{ display:flex; gap: 10px; flex-wrap: wrap; }

/* Thread Settings: Links table */
.tsLinks{ display: grid; gap: 8px; }
.tsLinks__toolbar{ display:flex; justify-content: flex-end; }
.tsLinks__tableWrap{
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: #ffffff;
}
.tsLinks__table{
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tsLinks__table thead th{
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: #f9fafb;
}
.tsLinks__table tbody{
  display: block;
  max-height: calc(48px * 5);
  overflow-y: auto;
}
.tsLinks__table thead,
.tsLinks__table tbody tr{
  display: table;
  width: 100%;
  table-layout: fixed;
}
.tsLinks__table td{
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tsLinks__table tbody tr:last-child td{ border-bottom: none; }
.tsLinks__colName{ width: 22%; }
.tsLinks__colType{ width: 16%; }
.tsLinks__colValue{ width: 50%; }
.tsLinks__colOp{ width: 12%; }
.tsLinks__value{
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tsLinks__empty{
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
}

/* Thread link modal */
.tlType{ display:flex; gap: 14px; flex-wrap: wrap; }
.tlType__item{ display:flex; gap: 8px; align-items:center; font-size: 13px; color: var(--text); }
.formactions--split{ display:flex; align-items:center; justify-content: space-between; gap: 10px; }
.formactions__left{ display:flex; gap: 10px; }
.formactions__right{ display:flex; gap: 10px; justify-content: flex-end; }

/* Thread Files modal */
.tfToolbar{ display:flex; align-items:center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.tfToolbar__hint{ font-size: 12px; color: var(--muted); }
.tfTableWrap{
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: #ffffff;
}
.tfTable{ width: 100%; border-collapse: collapse; font-size: 13px; }
.tfTable thead th{
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: #f9fafb;
}
.tfTable td{ padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tfTable tbody tr:last-child td{ border-bottom: none; }
.tfColName{ width: 26%; }
.tfColId{ width: 32%; }
.tfColSize{ width: 10%; }
.tfColCreated{ width: 16%; }
.tfColStatus{ width: 8%; }
.tfColOps{ width: 8%; }
.tfId{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tfStatus{ display:inline-flex; align-items:center; gap: 6px; font-size: 12px; color: var(--muted); }
.tfStatus--ok{ color: #065f46; }
.tfStatus--notfound{ color: #92400e; }
.tfStatus--error{ color: #991b1b; }
.tfOps{ display:flex; gap: 8px; justify-content: flex-end; }

/* Login */
.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f9fafb;
}

.login__card {
  width: min(420px, 100%);
  border: 1px solid var(--border);
  background: #ffffff;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 18px 50px var(--shadow);
}

.login__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.login__brand img {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.login__title { font-weight: 800; font-size: 18px; }
.login__subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }

.login__error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.22);
  color: #991b1b;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  margin: 10px 0 12px;
}

.field { display: grid; gap: 6px; margin: 10px 0; }
.field__label { font-size: 12px; color: var(--muted); }
.field__input {
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #f9fafb;
  color: var(--text);
  padding: 0 12px;
  outline: none;
}
.field__input:focus {
  border-color: rgba(16,163,127,0.55);
  box-shadow: 0 0 0 3px rgba(16,163,127,0.15);
}

.login__submit {
  width: 100%;
  margin-top: 8px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(16,163,127,0.35);
  background: rgba(16,163,127,0.16);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}
.login__submit:hover { background: rgba(16,163,127,0.26); }

.login__note { margin-top: 10px; font-size: 12px; color: var(--muted); }
.login__note code { color: var(--text); }

.login__divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin: 16px 0 12px;
  color: var(--muted);
  font-size: 12px;
}
.login__divider::before,
.login__divider::after {
  content: '';
  height: 1px;
  background: var(--border);
}
.login__divider span { padding: 0 2px; }

.login__oauths { display: grid; gap: 10px; }

.login__oauth {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  text-decoration: none;
  font-weight: 700;
  color: #ffffff;
}

.login__oauth--google { background: #4285f4; border-color: rgba(66, 133, 244, 0.55); }
.login__oauth--google:hover { filter: brightness(0.95); }

.login__oauth--yahoo { background: #ff0033; border-color: rgba(255, 0, 51, 0.55); }
.login__oauth--yahoo:hover { filter: brightness(0.95); }

/* Sidebar quick links */
.sidebar__quick {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 16px 10px;
}
.sidebar__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.65);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.sidebar__link:hover {
  background: rgba(16,163,127,0.08);
  border-color: rgba(16,163,127,0.35);
}

/* Top page */
.page { padding: 18px 18px 28px; }
.page__content { max-width: 1000px; margin: 0 auto; }
.topcards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,0.82);
  box-shadow: 0 10px 25px rgba(0,0,0,0.06);
  overflow: hidden;
}
.card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  font-weight: 800;
  border-bottom: 1px solid var(--border);
}
.card__body { padding: 12px 14px; color: var(--text); }
.card__body ul, .card__body ol { padding-left: 18px; margin: 8px 0; }
.card__body li { margin: 6px 0; }
.note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px dashed rgba(16,163,127,0.35);
  background: rgba(16,163,127,0.08);
  color: var(--text);
  font-size: 13px;
}

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

/* Mobile */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topcards { grid-template-columns: 1fr; }
}

/* =========================================================
   Global Busy / Loading (all screens)
   ========================================================= */

html.is-busy,
body.is-busy {
  cursor: progress;
}

html.is-busy * {
  cursor: progress !important;
}

.kobit-busy {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(1px);
  /* default hidden. The UA stylesheet sets [hidden]{display:none},
     but class rules can override it depending on order/specificity. */
  display: none;
  place-items: center;
}

/* show only when not hidden */
.kobit-busy:not([hidden]) {
  display: grid;
}

.kobit-busy__spinner {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 3px solid rgba(0, 0, 0, 0.12);
  border-top-color: rgba(0, 0, 0, 0.45);
  animation: kobitSpin 0.9s linear infinite;
}

@keyframes kobitSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* subtle feedback for disabled clickable elements */
.is-busy {
  opacity: 0.85;
}
