/* ==========================================================================
   screens.css — per-screen layout: login, list, create, editor, chat.
   ========================================================================== */

/* ================================ login ================================= */
/* Split panel: teal brand side + white form side. The shell strips its own
   padding for this screen (see layout.css body[data-screen=...]). */

#screen-login { min-height: calc(100vh - var(--mah-topnav-h)); }
body[data-screen="screen-login"] #screen-login { min-height: 100vh; }

.login-split {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  min-height: 100vh;
}
.login-brand {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--mah-5);
  padding: var(--mah-10) var(--mah-9);
  background: var(--mah-gradient-brand);
  color: #fff;
}
.login-brand h1 { color: #fff; font-size: 34px; max-width: 14ch; }
.login-brand p { color: var(--mah-on-brand-2); max-width: 46ch; font-size: var(--mah-fs-lg); }
.login-brand .logo { align-self: flex-start; }
.login-points { list-style: none; margin: var(--mah-4) 0 0; padding: 0; display: grid; gap: var(--mah-3); }
.login-points li { display: flex; align-items: center; gap: 10px; color: #fff; font-size: var(--mah-fs-base); }
.login-points .icon { color: var(--mah-control); }

.login-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--mah-9) var(--mah-6);
  background: var(--mah-surface);
}
.login-card { width: min(400px, 100%); }
.login-card h2 { margin-bottom: 6px; }
.login-card .lead { margin: 0 0 var(--mah-6); font-size: var(--mah-fs-base); }
.login-card .btn { width: 100%; margin-top: var(--mah-2); }
#login-error { margin: 0 0 var(--mah-3); font-size: var(--mah-fs-sm); font-weight: 500; }

@media (max-width: 900px) {
  .login-split { grid-template-columns: minmax(0, 1fr); }
  .login-brand { padding: var(--mah-8) var(--mah-6); min-height: auto; }
  .login-brand h1 { font-size: 26px; }
  .login-points { display: none; }
  .login-form-side { padding: var(--mah-7) var(--mah-5) var(--mah-9); align-items: flex-start; }
}

/* =============================== list ================================== */

#list-stats { margin-bottom: var(--mah-5); }

.cell-knowledge { min-width: 170px; }
.cell-updated { white-space: nowrap; color: var(--mah-ink-3); font-size: var(--mah-fs-sm); }

/* Row kebab menu (rendered on demand by views.js). */
.row-menu {
  position: absolute;
  z-index: var(--mah-z-dropdown);
  min-width: 190px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--mah-line);
  border-radius: var(--mah-r-lg);
  box-shadow: var(--mah-sh-overlay);
}
.row-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: var(--mah-r-md);
  background: transparent;
  font: inherit;
  font-size: var(--mah-fs-base);
  color: var(--mah-ink-2);
  text-align: left;
  cursor: pointer;
}
.row-menu button:hover { background: var(--mah-n100); color: var(--mah-ink); }
.row-menu button.danger { color: var(--mah-bad); }
.row-menu button.danger:hover { background: var(--mah-bad-bg); }
.row-menu .icon { width: 16px; height: 16px; }

/* =============================== editor ================================= */

.editor-grid {
  display: grid;
  grid-template-columns: var(--mah-editor-rail-w) minmax(0, 1fr) var(--mah-editor-preview-w);
  gap: var(--mah-5);
  align-items: start;
}

.rail { display: grid; gap: 4px; position: sticky; top: calc(var(--mah-topnav-h) + var(--mah-6)); }
.rail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: var(--mah-r-lg);
  background: transparent;
  font-family: var(--mah-font-sans);
  font-size: var(--mah-fs-base);
  font-weight: 500;
  color: var(--mah-ink-2);
  text-align: left;
  cursor: pointer;
  transition: background var(--mah-dur-2) var(--mah-ease),
              border-color var(--mah-dur-2) var(--mah-ease),
              box-shadow var(--mah-dur-2) var(--mah-ease);
}
.rail-item:hover { background: var(--mah-n100); color: var(--mah-ink); }
.rail-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  flex: 0 0 24px;
  border-radius: var(--mah-r-md);
  background: var(--mah-n100);
  color: var(--mah-ink-3);
  font-family: var(--mah-font-brand);
  font-weight: 700;
  font-size: var(--mah-fs-sm);
  transition: background var(--mah-dur-2) var(--mah-ease), color var(--mah-dur-2) var(--mah-ease);
}
.rail-text { flex: 1; min-width: 0; }
.rail-count {
  padding: 1px 7px;
  border-radius: var(--mah-r-pill);
  background: var(--mah-n100);
  color: var(--mah-ink-3);
  font-size: var(--mah-fs-xs);
  font-weight: 700;
}
.rail-item.is-active {
  background: #fff;
  border-color: var(--mah-line);
  box-shadow: var(--mah-sh-panel);
  color: var(--mah-ink);
  font-weight: 600;
}
.rail-item.is-active .rail-num { background: var(--mah-brand); color: #fff; }
.rail-item.is-active .rail-count { background: var(--mah-info-bg); color: var(--mah-link); }

.editor-main { min-width: 0; }
.section-panel { margin-bottom: 0; }

/* Live chat column. #preview-chat is a real, second instance of the chat panel
   (see chat.js), so it reuses .chat-wrapper and every message/markdown rule
   below — .preview-chat only tightens the sizing for the narrower column. */
.editor-preview { position: sticky; top: calc(var(--mah-topnav-h) + var(--mah-6)); }
.preview-label {
  margin: 0 0 8px;
  font-size: var(--mah-fs-xs);
  font-weight: 700;
  letter-spacing: var(--mah-track-caps);
  text-transform: uppercase;
  color: var(--mah-n500);
}
.preview-chat {
  height: min(620px, calc(100dvh - var(--mah-topnav-h) - 150px));
  min-height: 380px;
  border-radius: var(--mah-r-xl);
}
.preview-chat .chat-header { height: 60px; padding: 0 14px; gap: 10px; }
.preview-chat .chat-avatar { width: 34px; height: 34px; flex-basis: 34px; }
.preview-chat .chat-title strong { font-size: var(--mah-fs-base); }
.preview-chat .chat-body { gap: 12px; padding: 14px; }
.preview-chat .message-bubble { max-width: 84%; font-size: var(--mah-fs-base); padding: 9px 13px; }
.preview-chat .message-avatar { width: 26px; height: 26px; font-size: var(--mah-fs-2xs); }
.preview-chat .chat-footer { padding: 10px; }
/* Icon-only Send: the label would not survive the narrower composer. */
.preview-chat .chat-footer .btn { padding: 0 12px; }
.preview-caption { margin: var(--mah-2) 0 0; font-size: var(--mah-fs-sm); color: var(--mah-ink-4); }

@media (max-width: 1279px) { .editor-grid { grid-template-columns: var(--mah-editor-rail-w) minmax(0, 1fr) 340px; } }

@media (max-width: 1023px) {
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: static;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 6px;
  }
  .rail-item { flex: 0 0 auto; }
  /* Stacked below the sections: no longer sticky, and free to use full width. */
  .editor-preview { position: static; }
  .preview-chat { height: clamp(380px, 60dvh, 560px); }
}

@media (max-width: 767px) {
  .rail-text { display: none; }             /* numbered chips only */
  .rail-item { padding: 8px 10px; }
}

