/* Layout and components shared by every section subdomain. Needs theme.css. */

/* ---------- shell + sidebar ---------- */
.shell { display: grid; grid-template-columns: 220px 1fr; height: 100%; }

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
}
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sidebar .mark { padding: 6px 8px 4px; }
.sidebar .markline { width: 44px; margin: 0 0 16px 8px; }
.menubtn { display: none; }
.navwrap { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.navlist { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.navlist a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border-left: 2px solid transparent;
  color: var(--ink-soft);
  font-size: 13px;
  text-decoration: none;
}
.navlist .dot { width: 6px; height: 6px; flex-shrink: 0; border: 1px solid var(--ink-faint); }
.navlist a:hover { color: var(--ink); background: var(--surface-2); }
.navlist a.active { color: var(--ink); border-left-color: var(--ink); font-weight: 600; background: var(--surface-2); }
.navlist a.active .dot { background: var(--ink); border-color: var(--ink); }

.sidefoot { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.sidefoot .btn { text-align: center; }
.whoami { font-size: 11.5px; color: var(--ink-faint); overflow-wrap: anywhere; }
.whoami b { color: var(--ink-soft); font-weight: 600; }

/* ---------- content ---------- */
.content { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 28px 34px; overflow-y: auto; }
.viewhead { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.viewhead h2 { margin: 0; font-family: "Archivo", sans-serif; font-weight: 800; font-size: 22px; }
.viewhead .sub { color: var(--ink-faint); font-size: 12.5px; }
.viewactions, .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
#viewBody { display: flex; flex-direction: column; flex: 1; min-height: 0; }

.emptynote { margin: 0; padding: 18px 0; color: var(--ink-faint); font-size: 13px; }
.warnbox { margin-bottom: 18px; padding: 10px 12px; border: 1px solid var(--ink-faint); color: var(--ink-soft); font-size: 12px; line-height: 1.5; }
.tag { display: inline-block; padding: 2px 7px; border: 1px solid var(--line-strong); font: 10.5px "IBM Plex Mono", monospace; letter-spacing: .03em; }
.linklike { padding: 0; background: none; border: none; color: var(--ink-soft); font-size: 12px; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.linklike:hover { color: var(--ink); }
.linklike:disabled { opacity: .4; cursor: not-allowed; }
.formerr { margin-top: 14px; padding: 9px 11px; border: 1px solid var(--danger); color: var(--danger); font-size: 12.5px; }

/* Sign-in / no-access notice */
.gatecard { max-width: 440px; padding: 28px; border: 1px solid var(--line); background: var(--surface); }
.gatecard h3 { margin: 0 0 8px; font-family: "Archivo", sans-serif; font-size: 18px; }
.gatecard p { margin: 0 0 18px; color: var(--ink-soft); font-size: 13.5px; line-height: 1.55; }

/* ---------- list + detail split ---------- */
.split {
  flex: 1;
  min-height: 420px;
  display: grid;
  grid-template-columns: 320px 1fr;
  border: 1px solid var(--line);
  background: var(--surface);
}
.listcol { overflow-y: auto; border-right: 1px solid var(--line); }
.detailcol { overflow-y: auto; min-width: 0; padding: 22px; }
.listcol .emptynote { padding: 18px; }
.detailcol .emptynote { padding: 0; }
.detailcol .back { display: none; }

.listitem {
  display: block;
  width: 100%;
  padding: 12px 14px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.listitem:hover, .listitem.active { background: var(--surface-2); }
.listitem .l1 { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.listitem.unread .l1 { font-weight: 600; }
.listitem .l2 { margin-top: 3px; font-size: 12px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.listitem .l3 { margin-top: 4px; font-size: 11px; color: var(--ink-faint); }

/* ---------- tables ---------- */
.tablewrap { overflow-x: auto; }
table.grid-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid-table th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--ink-faint);
  font: 500 11px "IBM Plex Mono", monospace;
  letter-spacing: .05em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
table.grid-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
table.grid-table tr:hover td { background: var(--surface-2); }
table.grid-table td.acts { white-space: nowrap; }
table.grid-table td.acts .linklike + .linklike { margin-left: 12px; }

/* ---------- modal ---------- */
dialog.modal {
  width: 92vw;
  max-width: 540px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
}
dialog.modal::backdrop { background: rgba(0, 0, 0, .45); }
.modalhead { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modalhead h3 { margin: 0; font-family: "Archivo", sans-serif; font-size: 16px; }
.modalbody { padding: 20px; }
.modalbody > .field:last-of-type { margin-bottom: 0; }
.modalbody p { margin: 0; font-size: 13.5px; line-height: 1.6; }
.modalfoot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--line); }
.iconbtn { padding: 4px; background: none; border: none; color: var(--ink-faint); font-size: 18px; line-height: 1; cursor: pointer; }
.iconbtn:hover { color: var(--ink); }
select {
  width: 100%;
  padding: 9px 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink);
  font-size: 13.5px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10;
  transform: translateX(-50%);
  padding: 9px 14px;
  background: var(--ink);
  color: var(--bg);
  font: 12px "IBM Plex Mono", monospace;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.toast.show { opacity: 1; }

/* ---------- small screens: hamburger menu ---------- */
@media (max-width: 820px) {
  .shell { display: flex; flex-direction: column; }
  .sidebar { flex: none; padding: 14px 16px; border-right: none; border-bottom: 1px solid var(--line); }
  .sidebar .mark { padding: 4px 0; }
  .sidebar .markline { margin: 0; }
  .topbar { align-items: center; }
  .menubtn {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 38px;
    height: 38px;
    padding: 0 10px;
    background: none;
    border: 1px solid var(--line);
    cursor: pointer;
  }
  .menubtn span { display: block; height: 1.5px; background: var(--ink); }
  .navwrap { display: none; padding-top: 14px; }
  .sidebar.open .navwrap { display: flex; }
  .navlist a { padding: 11px 8px; }
  .content { flex: 1; padding: 18px 16px; }
  .split { grid-template-columns: 1fr; }
  .listcol { border-right: none; }
  .detailcol { display: none; }
  .split.reading .listcol { display: none; }
  .split.reading .detailcol { display: block; }
  .detailcol .back { display: inline-block; }
}
