/* ELMWICH PORTAL · app components. Loads after ../assets/styles.css (tokens, buttons, forms).
   Same Swiss system: black / red / white, radius 0. */

.app { max-width: 1160px; margin: 0 auto; padding: 0 24px 70px; }

/* ---------- app topbar ---------- */
.apptop { position: sticky; top: 0; z-index: 40; background: var(--paper); border-bottom: 1px solid var(--line); }
.apptop .row { max-width: 1160px; margin: 0 auto; padding: 13px 24px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.apptop .mark { font-size: 14px; letter-spacing: 0.22em; font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; }
.apptop .mark .dot { color: var(--red); }
.apptop .clientname { font-size: 13px; color: var(--muted); border-left: 1px solid var(--line); padding-left: 14px; }
.apptop .right { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.apptop .right a { color: var(--muted); }
.apptop .right a:hover { color: var(--ink); }

/* ---------- engagement strip ---------- */
.engage { border-bottom: 1px solid var(--line); background: var(--wash); }
.engage .row { max-width: 1160px; margin: 0 auto; padding: 10px 24px; display: flex; gap: 26px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.engage b { color: var(--ink); font-variant-numeric: tabular-nums; }
.engage .plan { color: var(--red); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; font-size: 11px; align-self: center; }

/* ---------- tabs ---------- */
.apptabs { display: flex; gap: 26px; border-bottom: 1px solid var(--line); margin: 26px 0 0; flex-wrap: wrap; }
.apptabs button { appearance: none; background: none; border: none; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); padding: 10px 2px 12px; border-bottom: 2px solid transparent; }
.apptabs button:hover { color: var(--ink); }
.apptabs button.on { color: var(--ink); border-bottom-color: var(--red); }
.apptabs .badge { display: inline-block; min-width: 17px; text-align: center; background: var(--red); color: #fff; font-size: 10.5px; padding: 1px 5px; margin-left: 7px; }
.panel { display: none; padding-top: 26px; }
.panel.active { display: block; }
.panelhead { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.panelhead h2 { font-size: 21px; margin: 0; }
.panelhead .sub { font-size: 12.5px; color: var(--muted); }
.panelhead .right { margin-left: auto; font-size: 12.5px; color: var(--muted); }

/* ---------- filter chips ---------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters button { appearance: none; background: var(--card); border: 1px solid var(--line); cursor: pointer; font: inherit; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: var(--muted); padding: 5px 12px; }
.filters button:hover { border-color: var(--ink); color: var(--ink); }
.filters button.on { background: var(--ink); border-color: var(--ink); color: var(--paper); }

/* ---------- activity feed ---------- */
.pfeed { border-top: 2px solid var(--ink); }
.prow { display: grid; grid-template-columns: 60px 84px 1fr auto auto; gap: 14px; align-items: baseline; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.prow .fd { font-size: 11px; color: var(--tertiary); font-weight: 700; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.prow .tag { font-size: 9.5px; font-weight: 700; letter-spacing: 0.1em; color: var(--ink); border: 1px solid var(--line); padding: 2px 0; text-align: center; }
.prow .tag.ai { color: var(--red); border-color: var(--red); }
.prow .tx { font-size: 14px; color: var(--body); line-height: 1.5; }
.prow .tx b { color: var(--ink); }
.prow .rlink { font-size: 12px; font-weight: 700; white-space: nowrap; text-decoration: none; border-bottom: 2px solid var(--red); padding-bottom: 1px; color: var(--ink); cursor: pointer; }
.prow .st { font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em; color: var(--muted); white-space: nowrap; }
@media (max-width: 700px) { .prow { grid-template-columns: 56px 1fr auto; } .prow .tag, .prow .st { display: none; } }

/* ---------- status pills ---------- */
.pill { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.09em; padding: 3px 9px; white-space: nowrap; }
.pill.ship { background: var(--ink); color: var(--paper); }
.pill.prog { border: 1px solid var(--red); color: var(--red); }
.pill.queue { border: 1px solid var(--line); color: var(--muted); }

/* ---------- roadmap sprints ---------- */
.sprint { border: 1px solid var(--line); background: var(--card); margin-bottom: 18px; }
.sprint .shead { display: flex; align-items: baseline; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sprint .shead h3 { font-size: 15px; margin: 0; }
.sprint .shead .prog { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; margin-left: auto; }
.sprint .task { display: grid; grid-template-columns: 84px 1fr auto auto auto; gap: 14px; align-items: baseline; padding: 11px 18px; border-bottom: 1px solid var(--line); }
.sprint .task .ask { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: var(--muted); cursor: pointer; white-space: nowrap; }
.sprint .task .ask:hover { color: var(--ink); border-bottom: 2px solid var(--red); }
.sprint .task:last-child { border-bottom: none; }
.sprint .task .tx { font-size: 13.5px; color: var(--body); }
.sprint .task .rlink { font-size: 12px; font-weight: 700; text-decoration: none; border-bottom: 2px solid var(--red); padding-bottom: 1px; color: var(--ink); cursor: pointer; white-space: nowrap; }
@media (max-width: 700px) { .sprint .task { grid-template-columns: 1fr auto; } .sprint .task .tag { display: none; } }
.sprint .task .tag { font-size: 9.5px; font-weight: 700; letter-spacing: 0.1em; color: var(--ink); border: 1px solid var(--line); padding: 2px 0; text-align: center; }

/* ---------- reports list ---------- */
.replist { border-top: 2px solid var(--ink); }
.reprow { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; padding: 15px 2px; border-bottom: 1px solid var(--line); }
.reprow .racts { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.reprow .t { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.reprow .m { font-size: 12px; color: var(--muted); margin-top: 3px; }
.reprow .act { font-size: 12px; font-weight: 700; cursor: pointer; text-decoration: none; color: var(--ink); border-bottom: 2px solid var(--red); padding-bottom: 1px; white-space: nowrap; }
.reprow .act.mut { border-bottom-color: var(--line); color: var(--muted); cursor: default; }
@media (max-width: 700px) { .reprow { grid-template-columns: 1fr; gap: 8px; } }

/* ---------- AI visibility ---------- */
.sovgrid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 28px; align-items: start; }
@media (max-width: 820px) { .sovgrid { grid-template-columns: 1fr; } }
.sovbox { border: 1.5px solid var(--ink); background: var(--card); padding: 18px 18px 16px; }
.sovbox .sovh { font-size: 10.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); margin-bottom: 12px; }
.sovbox .sovh em { color: var(--red); font-style: normal; }
.sovrow2 { display: grid; grid-template-columns: 130px 1fr 74px; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); margin: 8px 0; }
.sovrow2 .tr { background: var(--wash); height: 12px; position: relative; overflow: hidden; }
.sovrow2 .fl { position: absolute; inset: 0 auto 0 0; }
.sovrow2 .val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.sovrow2 .val small { color: var(--muted); font-weight: 400; }
.sovnote2 { font-size: 11.5px; color: var(--tertiary); margin-top: 12px; }
.engtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.engtable th { text-align: left; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 8px 0; border-bottom: 2px solid var(--ink); }
.engtable td { padding: 10px 10px 10px 0; border-bottom: 1px solid var(--line); color: var(--body); font-variant-numeric: tabular-nums; }
.engtable td.up { color: var(--ink); font-weight: 700; }
.engtable td.up .d { color: var(--red); font-size: 11.5px; margin-left: 6px; }

/* ---------- messages ---------- */
.thread { border-top: 2px solid var(--ink); max-width: 780px; }
.msg { padding: 16px 2px; border-bottom: 1px solid var(--line); }
.msg .who { font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 7px; color: var(--muted); }
.msg.elm .who { color: var(--red); }
.msg .body { font-size: 14px; color: var(--body); line-height: 1.6; max-width: 68ch; white-space: pre-line; }
.msg .meta { font-size: 11px; color: var(--tertiary); margin-top: 7px; }
.composer { max-width: 780px; margin-top: 18px; }
.composer textarea { width: 100%; min-height: 92px; padding: 12px 13px; font: inherit; font-size: 14px; background: var(--card); color: var(--ink); border: 1px solid var(--line); resize: vertical; }
.composer textarea:focus-visible { outline: 2px solid var(--ink); }
.composer .crow { display: flex; gap: 12px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.composer .attach { font-size: 12px; color: var(--muted); cursor: pointer; border: 1px solid var(--line); padding: 8px 13px; background: var(--card); font-weight: 700; }
.composer .attach:hover { border-color: var(--ink); color: var(--ink); }
.composer .sla { font-size: 12px; color: var(--tertiary); margin-left: auto; }

/* ---------- report modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(17,20,23,0.62); display: none; z-index: 100; padding: 3vh 3vw; }
.modal.open { display: flex; }
.mpanel { background: var(--paper); border: 1.5px solid var(--ink); width: min(920px, 100%); margin: 0 auto; display: flex; flex-direction: column; max-height: 94vh; flex: 1; }
.mbar { display: flex; align-items: center; gap: 14px; padding: 11px 16px; border-bottom: 1.5px solid var(--ink); }
.mbar .sq { width: 9px; height: 9px; background: var(--red); }
.mbar b { font-size: 12px; letter-spacing: 0.1em; font-weight: 700; color: var(--ink); }
.mbar .macts { margin-left: auto; display: flex; gap: 16px; align-items: center; }
.mbar a, .mbar button.x { font-size: 12px; font-weight: 700; color: var(--ink); text-decoration: none; border-bottom: 2px solid var(--red); padding-bottom: 1px; background: none; border-top: none; border-left: none; border-right: none; cursor: pointer; font-family: inherit; }
.mpanel iframe { border: none; width: 100%; flex: 1; background: #FFFFFF; }

/* ---------- admin ---------- */
.acard { border: 1px solid var(--line); background: var(--card); padding: 22px; margin-bottom: 22px; }
.acard h3 { font-size: 15px; margin: 0 0 16px; }
.acard h3 .stub { font-size: 9.5px; letter-spacing: 0.1em; color: var(--muted); border: 1px solid var(--line); padding: 2px 7px; margin-left: 10px; vertical-align: 2px; }
.formgrid { display: grid; grid-template-columns: 130px 1fr 130px 130px; gap: 12px; align-items: start; }
@media (max-width: 820px) { .formgrid { grid-template-columns: 1fr; } }
.formgrid input[type="text"], .formgrid select, .acard input[type="text"], .acard select { width: 100%; padding: 10px 11px; font: inherit; font-size: 13.5px; background: var(--paper); color: var(--ink); border: 1px solid var(--line); }
.acard input[type="file"] { font-size: 12.5px; color: var(--muted); }
.arow { display: flex; gap: 12px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.flash { font-size: 12px; font-weight: 700; color: var(--red); opacity: 0; transition: opacity 0.2s; }
.flash.show { opacity: 1; }
.inbox .prow { grid-template-columns: 150px 1fr auto; }
.clienttable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.clienttable th { text-align: left; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 8px 12px 8px 0; border-bottom: 2px solid var(--ink); }
.clienttable td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--line); color: var(--body); font-variant-numeric: tabular-nums; }
.clienttable td b { color: var(--ink); }

/* ---------- login ---------- */
.authwrap { min-height: 88vh; display: grid; place-items: center; padding: 24px; }
.authcard { width: min(420px, 100%); border: 1.5px solid var(--ink); background: var(--card); padding: 38px 34px; }
.authcard .mark { font-size: 15px; letter-spacing: 0.24em; font-weight: 700; color: var(--ink); }
.authcard .mark .dot { color: var(--red); }
.authcard h1 { font-size: 26px; margin: 22px 0 8px; letter-spacing: -0.02em; }
.authcard p { font-size: 13.5px; color: var(--muted); margin: 0 0 22px; }
.authcard input[type="email"] { width: 100%; padding: 12px 13px; font: inherit; font-size: 15px; background: var(--paper); color: var(--ink); border: 1px solid var(--line); }
.authcard input[type="email"]:focus-visible { outline: 2px solid var(--ink); }
.authcard .btn { width: 100%; margin-top: 14px; }
.authcard .note { font-size: 12px; color: var(--tertiary); margin-top: 16px; }
.authcard .sent { display: none; }
.authcard.issent .sent { display: block; }
.authcard.issent .form { display: none; }

/* ---------- task-reference chips on messages ---------- */
.ctx { display: inline-flex; gap: 10px; align-items: center; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; border: 1px solid var(--red); color: var(--red); padding: 4px 10px; margin-bottom: 10px; }
.ctx button { background: none; border: none; color: var(--red); font: inherit; cursor: pointer; padding: 0; }
.msg .re { font-size: 10px; font-weight: 700; letter-spacing: 0.07em; color: var(--red); border: 1px solid var(--red); padding: 2px 8px; display: inline-block; margin-bottom: 7px; }

/* ---------- inline action icons ---------- */
.pacts { display: flex; gap: 12px; align-items: center; }
button.ico { background: none; border: none; padding: 0; cursor: pointer; color: var(--muted); display: inline-flex; }
button.ico:hover { color: var(--red); }
button.ico svg { display: block; }

/* ---------- analytics tab ---------- */
.concl { border-left: 4px solid var(--ink); background: var(--wash); padding: 18px 22px; margin-bottom: 28px; max-width: 76ch; }
.concl .ck { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--red); margin-bottom: 8px; }
.concl p { font-size: 15px; color: var(--body); margin: 0; white-space: pre-line; line-height: 1.6; }
.astats { display: grid; grid-template-columns: repeat(4, 1fr); border-left: 1px solid var(--line); margin-bottom: 28px; }
.astat { border-right: 1px solid var(--line); border-top: 2px solid var(--ink); padding: 10px 16px 12px; display: flex; flex-direction: column; gap: 2px; }
.astat b { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
.astat .l { font-size: 11.5px; color: var(--muted); }
.astat .d { font-size: 11px; font-weight: 700; color: var(--red); font-variant-numeric: tabular-nums; }
@media (max-width: 760px) { .astats { grid-template-columns: repeat(2, 1fr); } .astat { border-bottom: 1px solid var(--line); } }
.trendbox { border: 1px solid var(--line); background: var(--card); padding: 16px 18px 12px; margin-bottom: 28px; max-width: 560px; }
.trendbox .tlab { font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); margin-bottom: 12px; }
.trend { display: flex; gap: 8px; align-items: flex-end; height: 64px; }
.trend .tcol { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.trend .tcol b { display: block; background: var(--tertiary); width: 100%; }
.trend .tcol.cur b { background: var(--red); }
.trendlabels { display: flex; gap: 8px; margin-top: 6px; }
.trendlabels span { flex: 1; text-align: center; font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em; color: var(--tertiary); }
.antables { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 32px; align-items: start; }
@media (max-width: 880px) { .antables { grid-template-columns: 1fr; } }
.engtable td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.anh { font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); margin: 0 0 10px; }

/* ---------- empty states & attachments ---------- */
.emptystate { padding: 26px 0; color: var(--muted); font-size: 14.5px; max-width: 56ch; line-height: 1.6; }
.fatt { display: inline-flex; gap: 7px; align-items: center; border: 1px solid var(--line); padding: 4px 10px; font-size: 11.5px; font-weight: 700; color: var(--ink); text-decoration: none; margin: 8px 8px 0 0; }
a.fatt:hover { border-color: var(--ink); }
