/* Section components used inside the appbar content area. Layout (appbar,
   .content, .viewhead) lives in theme.css. Needs theme.css. */

#viewBody { display: flex; flex-direction: column; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.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; }

/* No-access / error cards */
.gatecard { max-width: 460px; padding: 28px; border: 1px solid var(--line); background: var(--surface); }
.gatecard h3 { margin: 0 0 8px; font-family: "Chakra Petch", sans-serif; font-size: 18px; }
.gatecard p { margin: 0 0 18px; color: var(--ink-soft); font-size: 13.5px; line-height: 1.55; }
.gatecard .formerr { margin: 0 0 14px; }

/* ---------- list + detail split (mail, etc.) ---------- */
.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); max-height: 640px; }
.detailcol { overflow-y: auto; min-width: 0; padding: 22px; max-height: 640px; }
.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: "Chakra Petch", sans-serif; font-size: 16px; }
.modalbody { padding: 20px; }
.modalbody > .field:last-of-type { margin-bottom: 0; }
.modalbody p { margin: 0 0 14px; font-size: 13.5px; line-height: 1.6; }
.modalbody p:last-child { margin-bottom: 0; }
.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: 50; 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; }

@media (max-width: 820px) {
  .split { grid-template-columns: 1fr; }
  .listcol { border-right: none; border-bottom: 1px solid var(--line); max-height: 300px; }
  .detailcol { display: none; }
  .split.reading .listcol { display: none; }
  .split.reading .detailcol { display: block; }
  .detailcol .back { display: inline-block; }
}
