/* Portal layout and components, built on the TriBenn design tokens (tokens.css). */
@import "tokens.css";

* { box-sizing: border-box; }
body { background: var(--color-bg-primary); }
a { color: var(--olive-700); }
a:hover { color: var(--olive-600); }

.shell { min-height: 100vh; display: flex; flex-wrap: wrap; }
.side { flex: 1 1 240px; max-width: 100%; background: var(--forest); padding: 28px 16px; display: flex; flex-direction: column; gap: 24px; }
.side.staff { background: var(--black, #151816); }
.brand { padding: 0 14px; display: flex; flex-direction: column; gap: 6px; text-decoration: none; }
.brand b { font-family: var(--font-display); font-weight: 700; letter-spacing: .26em; color: var(--cream); font-size: 18px; }
.brand span { font-size: 11px; letter-spacing: .22em; color: var(--sage); font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 8px; color: var(--stone); font-weight: 500; font-size: 15px; text-decoration: none; }
.nav a:hover { color: var(--cream); background: #222B25; }
.nav a[aria-current="page"] { background: #2B342D; color: var(--cream); }
.count { background: var(--sage); color: #151816; border-radius: 4px; font-size: 12px; font-weight: 700; padding: 2px 7px; }
.who { margin-top: auto; padding: 16px 14px 0; border-top: 1px solid #3A413B; display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--stone); }
.who strong { color: var(--cream); font-size: 14px; }
.who button { all: unset; cursor: pointer; color: var(--sage); margin-top: 6px; text-decoration: underline; }
.who button:focus-visible { outline: 2px solid var(--sage); outline-offset: 2px; }

main { flex: 999 1 560px; min-width: 0; padding: 40px 48px 64px; display: flex; flex-direction: column; gap: 32px; }
@media (max-width: 700px) { main { padding: 28px 16px 48px; } }

.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.head > div:first-child { display: flex; flex-direction: column; gap: 12px; }
.eyebrow { display: flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: #5E6340; }
.eyebrow::before { content: ""; width: 32px; height: 2px; background: var(--olive); }
h1 { font-size: 36px; line-height: 1.1; }
h2 { font-size: 20px; }
.lede { margin: 0; color: var(--color-text-secondary); font-size: 16px; }
.muted { color: #5A5850; font-size: 14px; }
.mono { font-family: var(--font-mono); font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.split > .wide { flex: 999 1 460px; min-width: 0; }
.split > .narrow { flex: 1 1 280px; }

.card { background: var(--color-surface-card); border: 1px solid var(--stone); border-radius: 8px; padding: 24px; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border-radius: 8px; border: 1px solid var(--forest); background: var(--forest); color: var(--cream); font: 600 13px/1 var(--font-body); letter-spacing: .14em; text-transform: uppercase; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--olive-700); border-color: var(--olive-700); color: var(--cream); }
.btn:active { background: #151816; }
.btn.outline { background: transparent; color: #151816; border-color: var(--stone); }
.btn.outline:hover { border-color: #151816; color: #151816; }
.btn.small { min-height: 36px; padding: 0 14px; }
.btn:focus-visible, .field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.badge { display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.b-ok { background: #E3E8DA; color: #3F5232; }
.b-warn { background: #F3E6D0; color: #73501C; }
.b-info { background: #E2E6E3; color: #3E4844; }
.b-err { background: #F2DFDA; color: #7A3729; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #5A5850; font-weight: 600; padding: 10px 12px; border-bottom: 1px solid #151816; }
td { padding: 14px 12px; border-bottom: 1px solid #DDD7CB; vertical-align: top; }
td a { font-weight: 600; }
.empty { padding: 24px 0; color: #5A5850; border-top: 1px solid #151816; }

/* Ruled to-do list (used instead of stat cards). */
.todo { display: flex; flex-direction: column; border-top: 1px solid #151816; }
.todo > div { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 16px 0; border-bottom: 1px solid #DDD7CB; }
.todo .tag { flex: 0 0 150px; font-size: 12px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; color: #5E6340; }
.todo .what { flex: 1 1 280px; }
.summary { margin: 0; padding: 14px 0; border-top: 1px solid #151816; border-bottom: 1px solid #DDD7CB; line-height: 1.6; }

.field { display: flex; flex-direction: column; gap: 6px; }
.row > .field { flex: 1 1 220px; }
.field label { font-size: 13px; font-weight: 600; color: #151816; }
.field input, .field textarea, .field select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--stone); border-radius: 4px; background: var(--color-surface-card); font: 15px var(--font-body); color: #151816; }
.field textarea { min-height: 110px; resize: vertical; }
.hint { font-size: 13px; color: #5A5850; }

.notice { padding: 14px 16px; border-radius: 8px; border: 1px solid var(--stone); background: var(--color-surface-card-tonal, #EDE9DF); }
.notice.err { background: #F2DFDA; border-color: #D9B8AF; color: #5E2A1F; }

/* Conversation */
.thread { display: flex; flex-direction: column; gap: 20px; }
.msg { display: flex; flex-direction: column; gap: 4px; max-width: 620px; }
.msg .meta { font-size: 12px; color: #5A5850; }
.msg .body { background: #EDE9DF; border-radius: 8px; padding: 12px 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.mine { align-self: flex-end; }
.msg.mine .meta { text-align: right; }
.msg.staff .body { background: var(--forest); color: var(--cream); }
.msg .files { display: flex; gap: 8px; flex-wrap: wrap; }
.msg .files a { border: 1px solid var(--stone); border-radius: 4px; padding: 6px 10px; font-size: 14px; text-decoration: none; }
.msg.mine .files { justify-content: flex-end; }

.convo-list { display: flex; flex-direction: column; border-top: 1px solid #151816; }
.convo-list a { display: flex; justify-content: space-between; gap: 12px; padding: 14px 4px; border-bottom: 1px solid #DDD7CB; text-decoration: none; color: #151816; }
.convo-list a:hover { background: #EDE9DF; }
.convo-list .unread strong::after { content: " •"; color: var(--olive); }

.docs { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.docs ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--forest); }
.login .card { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 20px; }
