/* Norliven AI client portal. Forest glass, teal and gold, after the owner's login_page and after_login art. */
:root {
  --bg: #08140f; --bg2: #0d211b; --panel: rgba(22, 48, 42, .62); --panel-solid: #14302a; --line: rgba(160, 220, 200, .14); --line-strong: rgba(160, 220, 200, .28);
  --text: #e9f3ef; --muted: #9fb9b1; --teal: #3fc2ae; --teal-d: #1f8f7f; --green: #5fae7c; --gold: #e8c27a; --red: #f08a7e; --amber: #f2c46d;
  --r: 14px; --r-sm: 9px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, "Noto Sans Arabic", sans-serif;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--teal); text-underline-offset: 3px; }
a:hover { color: #7fe0cf; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.65rem; } h2, .h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .88em; background: rgba(255,255,255,.06); padding: .1em .35em; border-radius: 5px; overflow-wrap: anywhere; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 50; background: var(--gold); color: #10201b; padding: 8px 14px; border-radius: 8px; }
.skip:focus { top: 12px; }
.ico { width: 20px; height: 20px; flex: none; }
.small { font-size: .85rem; } .muted { color: var(--muted); } .err-text { color: var(--red); }
.mark { width: 38px; height: 23px; color: var(--teal); flex: none; }

/* ---------- Buttons and fields */
.btn-primary, .btn-ghost, .btn-danger { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: 999px; font: 600 .95rem var(--font); cursor: pointer; text-decoration: none; border: 1px solid transparent; transition: filter .15s, background .15s; }
.btn-primary { color: #0c1f1a; background: linear-gradient(90deg, var(--gold), #9fd6a8 55%, var(--teal)); box-shadow: 0 6px 22px rgba(63, 194, 174, .22); }
.btn-primary:hover { filter: brightness(1.07); color: #0c1f1a; }
.btn-ghost { color: var(--text); background: rgba(255,255,255,.04); border-color: var(--line-strong); }
.btn-ghost:hover { background: rgba(255,255,255,.09); color: var(--text); }
.btn-danger { color: #ffd9d4; background: rgba(240, 138, 126, .1); border-color: rgba(240, 138, 126, .4); }
.btn-danger:hover { background: rgba(240, 138, 126, .2); }
.sm { min-height: 36px; padding: 0 14px; font-size: .86rem; }
button[disabled], .btn-primary[aria-busy="true"] { opacity: .55; cursor: progress; }
.stack { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label, fieldset legend { font-size: .86rem; font-weight: 600; color: #cfe2dc; }
.input { width: 100%; min-height: 44px; padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: rgba(5, 18, 14, .55); color: var(--text); font: inherit; }
textarea.input { resize: vertical; line-height: 1.5; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-inline-end: 36px; }
[dir="rtl"] select.input { background-position: 13px 50%, 18px 50%; }
.input:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px rgba(63, 194, 174, .22); }
.input[readonly] { opacity: .75; }
.has-error .input { border-color: var(--red); }
.hint { margin: 0; font-size: .82rem; color: var(--muted); } .err { margin: 0; font-size: .82rem; color: var(--red); }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-inline-end: 76px; }
.pw-toggle { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--teal); font: 600 .8rem var(--font); padding: 8px 10px; cursor: pointer; border-radius: 6px; }
.check { display: flex; gap: 10px; align-items: center; font-size: .92rem; }
.check input { width: 18px; height: 18px; accent-color: var(--teal); }
fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.two { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; }
.flash { padding: 10px 14px; border-radius: var(--r-sm); border: 1px solid; font-size: .92rem; }
.flash.error { color: #ffd9d4; background: rgba(240,138,126,.1); border-color: rgba(240,138,126,.4); }
.flash.ok { color: #d3f5e6; background: rgba(95,174,124,.12); border-color: rgba(95,174,124,.45); }
.flash.warn { color: #fbe6bd; background: rgba(242,196,109,.1); border-color: rgba(242,196,109,.4); }

/* ---------- Authentication pages: real form over the cleaned login artwork */
body.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; overflow-x: hidden; }
.auth-bg { position: fixed; inset: 0; z-index: -1; background: radial-gradient(ellipse at 50% 55%, rgba(8,20,15,.15), rgba(8,20,15,.75) 75%), url(/art/login-bg.webp) center / cover no-repeat, var(--bg); }
@media (max-width: 900px) { .auth-bg { background-image: radial-gradient(ellipse at 50% 50%, rgba(8,20,15,.35), rgba(8,20,15,.85) 70%), url(/art/login-bg-1200.webp); } }
.auth-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px clamp(16px, 4vw, 40px); flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 1.05rem; }
.langs { display: flex; gap: 4px; flex-wrap: wrap; }
.langs a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 999px; font-size: .85rem; }
.langs a[aria-current] { color: var(--text); background: rgba(255,255,255,.08); }
.auth-main { flex: 1; display: grid; place-items: center; padding: 16px; }
.auth-card { width: min(420px, 100%); padding: clamp(24px, 4vw, 36px); border-radius: 22px; background: linear-gradient(160deg, rgba(30, 64, 56, .72), rgba(12, 30, 25, .78)); border: 1px solid var(--line-strong); box-shadow: 0 30px 80px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.08); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.auth-card h1 { font-size: 1.5rem; text-align: center; }
.auth-card .lede { color: var(--muted); text-align: center; }
.auth-card .btn-primary { width: 100%; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 18px 0 0; font-size: .88rem; color: var(--muted); }
.auth-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 16px clamp(16px, 4vw, 40px); font-size: .82rem; color: var(--muted); }
.auth-foot a { color: var(--muted); }
.steps-list { padding-inline-start: 1.2em; display: grid; gap: 12px; }
.qr { background: #fff; border-radius: 12px; padding: 10px; width: 188px; margin: 10px auto; }
.qr svg { display: block; width: 100%; height: auto; }
.secret { display: inline-block; letter-spacing: .06em; }
.codes { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.codes code { display: block; text-align: center; padding: 8px; font-size: .95rem; }

/* ---------- Application shell */
body.app { background: radial-gradient(1200px 700px at 70% -10%, rgba(63,194,174,.10), transparent 60%), radial-gradient(900px 600px at 0% 100%, rgba(232,194,122,.06), transparent 60%), var(--bg); min-height: 100vh; }
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 20px 14px; background: linear-gradient(180deg, #0f2620, #0a1a15); border-inline-end: 1px solid var(--line); overflow-y: auto; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 22px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 1.05rem; }
.side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.side nav a, .side-foot a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; color: #c4d8d2; text-decoration: none; font-size: .94rem; }
.side nav a:hover, .side-foot a:hover { background: rgba(255,255,255,.05); color: var(--text); }
.side a[aria-current="page"] { color: #0c1f1a; font-weight: 600; background: linear-gradient(90deg, #7cc493, var(--green)); box-shadow: 0 6px 20px rgba(95,174,124,.25); }
.count { margin-inline-start: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--gold); color: #10201b; font-size: .75rem; display: grid; place-items: center; }
.side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 12px clamp(16px, 3vw, 32px); background: rgba(8, 20, 15, .82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.search { flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 999px; background: rgba(255,255,255,.05); border: 1px solid var(--line); color: var(--muted); }
.search input { flex: 1; min-width: 0; min-height: 40px; background: none; border: 0; color: var(--text); font: inherit; }
.search input:focus { outline: none; }
.search:focus-within { border-color: var(--teal); }
.top-right { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }
.ws-name { color: var(--muted); font-size: .88rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(255,255,255,.04); border: 1px solid var(--line); color: var(--text); cursor: pointer; }
.icon-btn .dot { position: absolute; top: 8px; inset-inline-end: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.side-toggle { display: none; }
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 999px; }
.user-menu summary::-webkit-details-marker { display: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #10201b; background: linear-gradient(135deg, var(--gold), var(--teal)); }
.user-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.menu-pop { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); min-width: 220px; padding: 10px; border-radius: var(--r); background: var(--panel-solid); border: 1px solid var(--line-strong); box-shadow: 0 20px 50px rgba(0,0,0,.5); display: grid; gap: 6px; }
.menu-pop > a, .menu-pop button { display: block; width: 100%; text-align: start; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; }
.menu-pop > a:hover, .menu-pop button:hover { background: rgba(255,255,255,.06); }
.content { padding: clamp(18px, 3vw, 32px); display: grid; gap: 18px; align-content: start; max-width: 1400px; width: 100%; }
.content:focus { outline: none; }
.page-head h1 { margin-bottom: .25em; }
.page-head p { max-width: 70ch; }
.sub { margin-top: 10px; }

/* ---------- Panels and lists */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: inset 0 1px 0 rgba(255,255,255,.04); min-width: 0; }
.panel > :last-child { margin-bottom: 0; }
.empty { color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr) minmax(260px, .8fr); gap: 18px; align-items: start; }
.side-panels { display: grid; gap: 18px; }
.art-panel { padding: 0; overflow: hidden; background: #071410; }
.art-toggle summary { padding: 14px 20px; cursor: pointer; color: var(--muted); font-size: .88rem; }
.art-toggle img { display: block; width: 100%; height: auto; }
.progress { display: block; width: 100%; height: 8px; border: 0; border-radius: 999px; background: rgba(255,255,255,.07); overflow: hidden; margin: 14px 0 6px; appearance: none; color: var(--teal); }
.progress::-webkit-progress-bar { background: rgba(255,255,255,.07); border-radius: 999px; }
.progress::-webkit-progress-value { background: linear-gradient(90deg, var(--gold), var(--teal)); border-radius: 999px; }
.progress::-moz-progress-bar { background: linear-gradient(90deg, var(--gold), var(--teal)); border-radius: 999px; }
.checklist { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 4px; }
.checklist li { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist li > a, .checklist li > span:nth-child(2) { flex: 1; min-width: 0; color: var(--text); text-decoration: none; }
.checklist li > a:hover { color: var(--teal); }
.tick { width: 20px; height: 20px; flex: none; border-radius: 50%; border: 1.5px solid var(--line-strong); }
.done .tick { border-color: var(--green); background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5.5 10.5 3 3 6-7' fill='none' stroke='%230c1f1a' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / 100%; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; background: rgba(255,255,255,.07); color: #cfe2dc; border: 1px solid var(--line); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.s-connected, .s-ok, .s-approved, .s-sent { color: #9fe3b8; background: rgba(95,174,124,.14); border-color: rgba(95,174,124,.35); }
.s-connecting, .s-drafting, .s-queued, .s-sending, .s-pending_review, .s-untested, .s-draft { color: #f6d796; background: rgba(242,196,109,.1); border-color: rgba(242,196,109,.3); }
.s-error, .s-failed, .s-expired, .s-revoked, .s-rejected { color: #ffb4aa; background: rgba(240,138,126,.1); border-color: rgba(240,138,126,.35); }
.s-degraded, .s-unknown { color: #ffcf9a; background: rgba(255,170,90,.1); border-color: rgba(255,170,90,.35); }
.mini-list, .act-list { list-style: none; margin: 0; padding: 0; display: grid; }
.mini-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.mini-list li:last-child, .act-list li:last-child { border-bottom: 0; }
.mini-list a { flex: 1; display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-width: 0; }
.mini-list a span { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .86rem; }
.act-list time { color: var(--muted); white-space: nowrap; }
.option-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.option { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.option p { color: var(--muted); flex: 1; }
.option.chosen { border-color: rgba(95,174,124,.55); box-shadow: 0 0 0 1px rgba(95,174,124,.3), inset 0 1px 0 rgba(255,255,255,.05); }
.option.off { opacity: .7; }
.conn-list, .kn-list { display: grid; gap: 14px; list-style: none; padding: 0; margin: 0; }
.conn-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.kv { display: grid; gap: 8px; margin: 10px 0; }
.kv div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; }
.kv dt { color: var(--muted); font-size: .86rem; } .kv dd { margin: 0; overflow-wrap: anywhere; }
.once { background: rgba(232,194,122,.14); border: 1px dashed var(--gold); color: #fbe6bd; }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.form-panel { max-width: 720px; }
.ai-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.kn-body { white-space: pre-wrap; color: #d5e5e0; max-height: 12em; overflow: auto; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters a { padding: 7px 14px; border-radius: 999px; color: var(--muted); text-decoration: none; border: 1px solid var(--line); font-size: .88rem; }
.filters a[aria-current] { color: #0c1f1a; background: var(--teal); border-color: var(--teal); font-weight: 600; }
.msg-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.msg-list a.panel { display: grid; gap: 4px; color: var(--text); text-decoration: none; padding: 16px 20px; }
.msg-list a.panel:hover { border-color: var(--line-strong); }
.msg-list p { margin: 0; color: #c4d8d2; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.msg-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); font-size: .82rem; }
.msg-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.msg-body { white-space: pre-wrap; padding: 14px; border-radius: var(--r-sm); background: rgba(5,18,14,.5); border: 1px solid var(--line); overflow-wrap: anywhere; }
.evidence { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.evidence li { display: grid; gap: 2px; padding: 10px 12px; border-inline-start: 3px solid var(--gold); background: rgba(232,194,122,.05); border-radius: 6px; font-size: .88rem; }
.evidence span { color: var(--muted); }
.table-wrap { overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: start; padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
td:first-child { white-space: nowrap; color: var(--muted); }

/* ---------- Responsive */
@media (max-width: 1200px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .side-panels { grid-column: 1 / -1; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 264px; z-index: 30; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 0 0 60px rgba(0,0,0,.6); }
  [dir="rtl"] .side { transform: translateX(105%); }
  .side.open { transform: none; }
  .side-toggle { display: inline-grid; }
  .ws-name, .user-name { display: none; }
  .dash-grid, .ai-grid, .msg-grid { grid-template-columns: minmax(0, 1fr); }
  .art-panel { order: 3; }
}
@media (max-width: 560px) {
  .search { display: none; }
  .two { grid-template-columns: minmax(0, 1fr); }
  .kv div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .panel { padding: 16px; }
  h1 { font-size: 1.4rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
