/* NaturGasConnect — portal styles. No external fonts or frameworks (strict CSP). */

:root {
  --navy-950: #071726;
  --navy-900: #0b1f33;
  --navy-800: #12304d;
  --navy-700: #1b4469;
  --blue-600: #1366c4;
  --blue-500: #1f7ae0;
  --blue-50: #eaf3fd;
  --flame-500: #f28c28;
  --flame-50: #fff3e6;
  --green-600: #0f8a5f;
  --green-50: #e7f6ef;
  --amber-600: #b26a00;
  --amber-50: #fff6e0;
  --red-600: #c4322b;
  --red-50: #fdecea;
  --violet-600: #6a4bc4;
  --violet-50: #f1edfb;
  --gray-950: #121a24;
  --gray-800: #2b3644;
  --gray-700: #445163;
  --gray-600: #5d6b7e;
  --gray-500: #7b8798;
  --gray-400: #a3adbb;
  --gray-300: #cdd4de;
  --gray-200: #e3e8ee;
  --gray-100: #eff2f6;
  --gray-50: #f6f8fb;
  --white: #fff;

  --bg: var(--gray-50);
  --surface: var(--white);
  --text: var(--gray-950);
  --text-muted: var(--gray-600);
  --border: var(--gray-200);
  --primary: var(--blue-600);
  --primary-hover: #0f56a6;
  --focus: 0 0 0 3px rgba(31, 122, 224, .28);

  --radius: 10px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --sidebar-w: 248px;
  --font: Inter, "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  font-feature-settings: "tnum" 1, "cv11" 1;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 650; }
h3 { font-size: 1rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
code, .mono { font-family: var(--mono); font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.icon-sm { width: 15px; height: 15px; }
.muted { color: var(--text-muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---------------------------------------------------------------- shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 30;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--navy-900), var(--navy-950));
  color: #c9d6e4; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: .6rem; padding: 1.15rem 1.2rem 1rem; color: var(--white); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; color: var(--flame-500); filter: drop-shadow(0 2px 6px rgba(242, 140, 40, .35)); }
.brand-text { font-size: 1.08rem; letter-spacing: -.01em; font-weight: 500; }
.brand-text strong { font-weight: 750; }
.nav { padding: .25rem .65rem 1rem; flex: 1; }
.nav-group { margin: 1.1rem .6rem .35rem; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #7f95ad; }
.nav-item {
  display: flex; align-items: center; gap: .7rem; padding: .5rem .65rem; margin: 1px 0;
  border-radius: var(--radius-sm); color: #c9d6e4; font-weight: 500;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: var(--white); text-decoration: none; }
.nav-item.is-active { background: rgba(31, 122, 224, .22); color: var(--white); box-shadow: inset 3px 0 0 var(--flame-500); }
.nav-badge { margin-left: auto; min-width: 22px; padding: 0 .4rem; border-radius: 999px; background: var(--flame-500); color: var(--navy-950); font-size: .75rem; font-weight: 700; text-align: center; line-height: 20px; }
.sidebar-foot { padding: .9rem 1.2rem; font-size: .75rem; color: #6f849b; border-top: 1px solid rgba(255, 255, 255, .06); }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .75rem;
  height: 60px; padding: 0 1.5rem; background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--border); backdrop-filter: blur(8px);
}
.topbar-title { flex: 1; min-width: 0; font-weight: 600; color: var(--gray-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: .5rem; }
.icon-button {
  position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--gray-700); cursor: pointer;
}
.icon-button:hover { background: var(--gray-100); text-decoration: none; }
.sidebar-toggle { display: none; }
.dot-count { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--red-600); color: var(--white); font-size: .68rem; font-weight: 700; line-height: 17px; text-align: center; }
.user-menu { position: relative; }
.user-menu summary { display: flex; align-items: center; gap: .55rem; padding: .3rem .5rem; border-radius: var(--radius-sm); cursor: pointer; list-style: none; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--gray-100); }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--blue-500), var(--navy-700)); color: var(--white); font-weight: 700; font-size: .85rem; }
.user-name { font-weight: 600; color: var(--gray-800); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-panel { position: absolute; right: 0; top: calc(100% + 6px); width: 260px; padding: .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.user-menu-panel a, .user-menu-panel .link-button { display: block; width: 100%; padding: .5rem .6rem; border-radius: var(--radius-sm); color: var(--gray-800); text-align: left; }
.user-menu-panel a:hover, .user-menu-panel .link-button:hover { background: var(--gray-100); text-decoration: none; }
.user-menu-head { display: flex; flex-direction: column; padding: .5rem .6rem .7rem; margin-bottom: .3rem; border-bottom: 1px solid var(--border); }
.link-button { border: 0; background: none; font: inherit; cursor: pointer; color: var(--primary); padding: 0; }

.content { padding: 1.5rem; max-width: 1400px; width: 100%; }
.messages { display: grid; gap: .5rem; margin-bottom: 1rem; }

/* ---------------------------------------------------------------- page header */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }
.page-head .subtitle { margin: .25rem 0 0; color: var(--text-muted); }
.breadcrumb { font-size: .85rem; color: var(--text-muted); margin-bottom: .35rem; }
.breadcrumb a { color: var(--text-muted); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ---------------------------------------------------------------- cards & layout */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 1rem; }
.grid > .card + .card { margin-top: 0; }  /* grid gap spaces them already */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { margin: 0; font-size: 1rem; }
.card-body { padding: 1.1rem; }
.card-foot { padding: .75rem 1.1rem; border-top: 1px solid var(--border); background: var(--gray-50); border-radius: 0 0 var(--radius) var(--radius); }
.card-flush .table { border-radius: 0 0 var(--radius) var(--radius); }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1rem; align-items: start; }
/* Columns never grow to their widest content (a wide table scrolls in its .table-wrap). */
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.split > *, .stack > *, .grid > * { min-width: 0; }
.section-title { margin: 1.5rem 0 .75rem; }

.stat { padding: 1rem 1.1rem; }
.stat-label { font-size: .8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-value { margin-top: .25rem; font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
.stat-note { font-size: .85rem; color: var(--text-muted); }
.stat-accent { border-top: 3px solid var(--primary); }
.stat-accent.flame { border-top-color: var(--flame-500); }
.stat-accent.green { border-top-color: var(--green-600); }
.stat-accent.violet { border-top-color: var(--violet-600); }

dl.facts { display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr); gap: .45rem 1.25rem; margin: 0; }
dl.facts dt { color: var(--text-muted); }
dl.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; position: relative; }  /* keeps .sr-only labels inside the scroller */
.table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table th, .table td { padding: .65rem .9rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table thead th { position: sticky; top: 0; background: var(--gray-50); font-size: .76rem; font-weight: 700; color: var(--gray-600); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.table tbody tr:hover { background: #fafcff; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { font-weight: 700; background: var(--gray-50); }
.table .num, .table th.num { text-align: right; }
.table-compact th, .table-compact td { padding: .45rem .7rem; }
.row-link { color: inherit; font-weight: 600; }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--text-muted); }
.empty .icon { width: 32px; height: 32px; color: var(--gray-400); margin-bottom: .5rem; }

.pagination { display: flex; gap: .35rem; align-items: center; justify-content: flex-end; padding: .75rem 1rem; }
.pagination a, .pagination span { padding: .3rem .65rem; border-radius: var(--radius-sm); border: 1px solid var(--border); color: var(--gray-700); background: var(--surface); }
.pagination .current { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* ---------------------------------------------------------------- badges */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .55rem; border-radius: 999px; font-size: .76rem; font-weight: 650; line-height: 1.5; white-space: nowrap; background: var(--gray-100); color: var(--gray-700); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-plain::before { display: none; }
.badge-neutral { background: var(--gray-100); color: var(--gray-700); }
.badge-info { background: var(--blue-50); color: var(--blue-600); }
.badge-success { background: var(--green-50); color: var(--green-600); }
.badge-warning { background: var(--amber-50); color: var(--amber-600); }
.badge-danger { background: var(--red-50); color: var(--red-600); }
.badge-violet { background: var(--violet-50); color: var(--violet-600); }
.badge-flame { background: var(--flame-50); color: #b85f0b; }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.chip { display: inline-block; padding: .1rem .55rem; border-radius: 999px; background: var(--gray-100); color: var(--gray-700); font-size: .78rem; font-weight: 600; }
.chip-restricted { background: var(--violet-50); color: var(--violet-600); }

/* ---------------------------------------------------------------- alerts */
.alert { display: flex; gap: .6rem; align-items: flex-start; padding: .75rem 1rem; border-radius: var(--radius-sm); border: 1px solid; font-weight: 500; }
.alert-info { background: var(--blue-50); border-color: #c8def7; color: #0d4a8f; }
.alert-success { background: var(--green-50); border-color: #bfe6d4; color: #0b6b4a; }
.alert-warning { background: var(--amber-50); border-color: #f2dba4; color: #7a4a00; }
.alert-error, .alert-danger { background: var(--red-50); border-color: #f4c4c0; color: #9c231d; }
.alert ul { margin: .25rem 0 0; padding-left: 1.1rem; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .52rem .95rem; border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--gray-800); font: inherit; font-weight: 600; line-height: 1.2;
  cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm); transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--gray-50); text-decoration: none; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible { outline: none; box-shadow: var(--focus); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--green-600); border-color: var(--green-600); color: var(--white); }
.btn-success:hover { background: #0b744f; }
.btn-danger { background: var(--surface); border-color: #efb3ae; color: var(--red-600); }
.btn-danger:hover { background: var(--red-50); }
.btn-warning { background: var(--surface); border-color: #edcd85; color: var(--amber-600); }
.btn-warning:hover { background: var(--amber-50); }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; color: var(--primary); }
.btn-ghost:hover { background: var(--blue-50); }
.btn-sm { padding: .32rem .65rem; font-size: .85rem; }
.btn-lg { padding: .75rem 1.25rem; font-size: 1rem; }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-microsoft { background: #2f2f2f; border-color: #2f2f2f; color: var(--white); }
.btn-microsoft:hover { background: #1f1f1f; }
.ms-logo { display: inline-grid; grid-template-columns: 8px 8px; gap: 2px; }
.ms-logo i { width: 8px; height: 8px; display: block; }
.ms-logo i:nth-child(1) { background: #f25022; } .ms-logo i:nth-child(2) { background: #7fba00; }
.ms-logo i:nth-child(3) { background: #00a4ef; } .ms-logo i:nth-child(4) { background: #ffb900; }

/* ---------------------------------------------------------------- forms */
.form { display: grid; gap: 1rem; }
.form-grid { display: grid; gap: 1rem 1.25rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
.field { display: grid; gap: .3rem; align-content: start; }
.field > label, .label { font-weight: 600; font-size: .88rem; color: var(--gray-800); }
.field .help { font-size: .8rem; color: var(--text-muted); }
.field .errorlist, .errorlist { margin: 0; padding: 0; list-style: none; color: var(--red-600); font-size: .84rem; font-weight: 600; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--red-600); }
.required-mark { color: var(--red-600); margin-left: 2px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local],
input[type=search], input[type=tel], input[type=url], input[type=file], select, textarea {
  width: 100%; padding: .55rem .7rem; border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font: inherit; line-height: 1.35;
}
input[type=file] { padding: .45rem; background: var(--gray-50); }
textarea { min-height: 90px; resize: vertical; }
select { appearance: none; padding-right: 2rem; background-image: linear-gradient(45deg, transparent 50%, var(--gray-500) 50%), linear-gradient(135deg, var(--gray-500) 50%, transparent 50%); background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
select[multiple] { background-image: none; padding-right: .7rem; min-height: 8rem; }
input[readonly] { background: var(--gray-50); color: var(--gray-600); }
.checkbox { display: flex; gap: .55rem; align-items: flex-start; font-weight: 500; cursor: pointer; }
.checkbox input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--primary); flex: none; }
.checkbox-list { display: grid; gap: .45rem; }
ul.checkbox-list { list-style: none; margin: 0; padding: 0; }
.checkbox-grid { display: grid; gap: .45rem 1rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); }
.filters .field { min-width: 160px; }
.filters input[type=search] { min-width: 240px; }
.inline-form { display: inline; }
.form-actions { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: flex-end; padding-top: .25rem; }
.dropzone { display: grid; place-items: center; gap: .4rem; padding: 1.6rem; border: 2px dashed var(--gray-300); border-radius: var(--radius); background: var(--gray-50); text-align: center; color: var(--text-muted); }
.dropzone .icon { width: 30px; height: 30px; color: var(--primary); }

/* Rich text editor (Quill, vendored) */
.richtext-shell { border: 1px solid var(--gray-300); border-radius: var(--radius-sm); background: var(--surface); }
.richtext-shell .ql-toolbar.ql-snow { border: 0; border-bottom: 1px solid var(--border); border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: var(--gray-50); }
.richtext-shell .ql-container.ql-snow { border: 0; font: inherit; font-size: .95rem; }
.richtext-shell .ql-editor { min-height: 140px; }
.richtext-shell.is-compact .ql-editor { min-height: 80px; }
.rich { overflow-wrap: anywhere; }
.rich > :last-child { margin-bottom: 0; }
.rich h2 { font-size: 1.05rem; margin-top: .75rem; }
.rich h3 { font-size: .98rem; margin-top: .6rem; }
.rich ul, .rich ol { padding-left: 1.3rem; margin: 0 0 .75rem; }
.rich blockquote { margin: 0 0 .75rem; padding-left: .8rem; border-left: 3px solid var(--gray-300); color: var(--gray-700); }
.rich table { border-collapse: collapse; margin-bottom: .75rem; }
.rich td, .rich th { border: 1px solid var(--border); padding: .3rem .5rem; }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; overflow-x: auto; }
.tab { padding: .6rem .9rem; border-bottom: 2px solid transparent; color: var(--gray-600); font-weight: 600; white-space: nowrap; }
.tab:hover { color: var(--gray-900, #1d2733); text-decoration: none; }
.tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---------------------------------------------------------------- workflow */
.wf-steps { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; margin: 0; padding: 0; list-style: none; }
.wf-step { position: relative; display: grid; justify-items: center; text-align: center; gap: .3rem; padding: 0 .3rem; }
.wf-step::before { content: ""; position: absolute; top: 15px; left: -50%; width: 100%; height: 2px; background: var(--gray-200); z-index: 0; }
.wf-step:first-child::before { display: none; }
.wf-dot { position: relative; z-index: 1; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--gray-300); background: var(--surface); color: var(--gray-500); font-size: .8rem; font-weight: 700; }
.wf-dot .icon { width: 15px; height: 15px; }
.wf-step-label { font-size: .8rem; font-weight: 700; color: var(--gray-800); }
.wf-step-actor { font-size: .76rem; color: var(--text-muted); }
.wf-step-when { font-size: .72rem; color: var(--text-muted); }
.wf-step.is-done .wf-dot { background: var(--green-600); border-color: var(--green-600); color: var(--white); }
.wf-step.is-done::before, .wf-step.is-current::before { background: var(--green-600); }
.wf-step.is-current .wf-dot { border-color: var(--blue-500); color: var(--blue-600); box-shadow: 0 0 0 4px rgba(31, 122, 224, .15); }
.wf-step.is-returned .wf-dot { border-color: var(--amber-600); background: var(--amber-50); color: var(--amber-600); }
.wf-step.is-rejected .wf-dot { border-color: var(--red-600); background: var(--red-50); color: var(--red-600); }
.wf-chain { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; font-size: .8rem; color: var(--text-muted); }
.wf-chain .icon { width: 13px; height: 13px; }
.wf-actions { display: grid; gap: .6rem; }
.wf-actions .buttons { display: flex; flex-wrap: wrap; gap: .5rem; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: .85rem; }
.timeline li { display: grid; grid-template-columns: 10px 1fr; gap: .7rem; }
.timeline .tl-dot { width: 10px; height: 10px; margin-top: .4rem; border-radius: 50%; background: var(--gray-300); }
.timeline .tl-dot.success { background: var(--green-600); }
.timeline .tl-dot.warning { background: var(--amber-600); }
.timeline .tl-dot.danger { background: var(--red-600); }
.timeline .tl-dot.info { background: var(--blue-500); }
.timeline .tl-meta { font-size: .8rem; color: var(--text-muted); }
.timeline .tl-comment { margin-top: .2rem; padding: .45rem .6rem; background: var(--gray-50); border-radius: var(--radius-sm); white-space: pre-line; }
.check-box { border-radius: var(--radius-sm); padding: .8rem .9rem; border: 1px solid var(--border); background: var(--gray-50); }
.check-box.passed { background: var(--green-50); border-color: #bfe6d4; }
.check-box.flagged { background: var(--amber-50); border-color: #f2dba4; }
.check-box.unavailable { background: var(--gray-100); }
.check-box h4 { display: flex; align-items: center; gap: .4rem; margin: 0 0 .35rem; font-size: .9rem; }
.findings { margin: .5rem 0 0; padding-left: 1.1rem; }
.findings li { margin-bottom: .25rem; }
.sev { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; margin-right: .3rem; }
.sev-high { color: var(--red-600); } .sev-medium { color: var(--amber-600); } .sev-low { color: var(--gray-600); }
.ai-tag { display: inline-flex; align-items: center; gap: .25rem; padding: .05rem .45rem; border-radius: 999px; background: var(--violet-50); color: var(--violet-600); font-size: .72rem; font-weight: 700; }
.ai-tag .icon { width: 12px; height: 12px; }

/* ---------------------------------------------------------------- charts */
.chart { width: 100%; height: auto; display: block; }
.chart-bar { fill: var(--blue-500); }
.chart-bar:hover { fill: var(--flame-500); }
.chart-grid { stroke: var(--gray-200); stroke-width: 1; }
.chart-axis { fill: var(--gray-500); font-size: 10px; font-family: var(--font); }
.meter { height: 8px; border-radius: 999px; background: var(--gray-100); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--green-600); }
.meter.low > span { background: var(--red-600); }
/* Meter widths are classes (w-0 … w-100, steps of 5) because inline styles are not allowed. */
.meter > span.w-0 { width: 0%; }
.meter > span.w-5 { width: 5%; }
.meter > span.w-10 { width: 10%; }
.meter > span.w-15 { width: 15%; }
.meter > span.w-20 { width: 20%; }
.meter > span.w-25 { width: 25%; }
.meter > span.w-30 { width: 30%; }
.meter > span.w-35 { width: 35%; }
.meter > span.w-40 { width: 40%; }
.meter > span.w-45 { width: 45%; }
.meter > span.w-50 { width: 50%; }
.meter > span.w-55 { width: 55%; }
.meter > span.w-60 { width: 60%; }
.meter > span.w-65 { width: 65%; }
.meter > span.w-70 { width: 70%; }
.meter > span.w-75 { width: 75%; }
.meter > span.w-80 { width: 80%; }
.meter > span.w-85 { width: 85%; }
.meter > span.w-90 { width: 90%; }
.meter > span.w-95 { width: 95%; }
.meter > span.w-100 { width: 100%; }

/* ---------------------------------------------------------------- auth pages */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr); background: var(--surface); }
.auth-hero { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: 3rem; color: #d5e2ef; background: radial-gradient(1200px 500px at 0% 0%, rgba(31, 122, 224, .35), transparent 60%), radial-gradient(800px 400px at 100% 100%, rgba(242, 140, 40, .25), transparent 60%), var(--navy-950); overflow: hidden; }
.auth-hero h1 { font-size: 2.3rem; color: var(--white); letter-spacing: -.03em; max-width: 520px; }
.auth-hero p { max-width: 480px; color: #a9bdd2; font-size: 1.02rem; }
.auth-hero ul { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: .6rem; }
.auth-hero li { display: flex; gap: .6rem; align-items: center; color: #c7d6e6; }
.auth-hero li .icon { color: var(--flame-500); }
.auth-panel { display: grid; place-items: center; padding: 2rem; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box .brand { padding: 0 0 1.5rem; color: var(--navy-900); }
.divider { display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0; color: var(--text-muted); font-size: .8rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------------------------------------------------------------- misc */
.kv-inline { display: flex; flex-wrap: wrap; gap: .3rem 1.25rem; color: var(--text-muted); font-size: .88rem; }
.kv-inline strong { color: var(--gray-800); font-weight: 600; }
.doc-frame { width: 100%; height: 900px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--gray-100); }
.lock-hero { max-width: 520px; margin: 3rem auto; text-align: center; }
.lock-hero .icon { width: 44px; height: 44px; color: var(--violet-600); }
.matrix th.rot { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; font-size: .74rem; padding: .6rem .3rem; text-transform: none; letter-spacing: 0; }
.matrix td.yes { text-align: center; color: var(--green-600); font-weight: 800; }
.matrix td.no { text-align: center; color: var(--gray-300); }
.notice-list { list-style: none; margin: 0; padding: 0; }
.notice-list li { display: flex; gap: .75rem; padding: .85rem 1.1rem; border-bottom: 1px solid var(--border); }
.notice-list li.unread { background: #f7fbff; }
.notice-list li:last-child { border-bottom: 0; }
.line-items input { min-width: 90px; }
.line-items td { vertical-align: middle; }
.line-items .desc { min-width: 260px; }
.total-box { display: grid; grid-template-columns: 1fr auto; gap: .35rem 1.5rem; max-width: 360px; margin-left: auto; padding: 1rem 1.1rem; }
.total-box .grand { font-size: 1.15rem; font-weight: 800; border-top: 1px solid var(--border); padding-top: .4rem; }

/* Panels on the dashboard and the customer page */
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.contract-summary { display: grid; gap: .5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.contract-summary:last-of-type { border-bottom: 0; padding-bottom: 0; }
.contract-summary-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; }
.bill-number { font-family: var(--mono); font-weight: 650; }
.mini-stats { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); }
.mini-stats div { display: grid; }
.mini-stats strong { font-size: 1.05rem; }
.mini-stats span { font-size: .78rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.inline-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.inline-actions form { display: inline; }
.panel-links { display: flex; flex-wrap: wrap; gap: .5rem; padding: .75rem 1.1rem; border-top: 1px solid var(--border); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  /* Hidden off-screen it is also out of the keyboard order (visibility), until opened. */
  .sidebar { transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility 0s .2s; box-shadow: var(--shadow-lg); }
  .sidebar.is-open { transform: none; visibility: visible; transition: transform .2s ease; }
  .main { margin-left: 0; }
  .sidebar-toggle { display: inline-grid; }
  .content { padding: 1rem; }
  .topbar { padding: 0 1rem; }
  .grid-2, .grid-3, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .user-name { display: none; }
  .auth-page { grid-template-columns: minmax(0, 1fr); }
  .auth-hero { display: none; }
  .doc-frame { height: 600px; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .page-head { align-items: flex-start; }
  .wf-step-actor, .wf-step-when { display: none; }
  dl.facts { grid-template-columns: minmax(0, 1fr); gap: .1rem; }  /* label above its value */
  dl.facts dd { margin-bottom: .55rem; }
}
@media print {
  .sidebar, .topbar, .actions, .no-print { display: none !important; }
  .main { margin: 0; }
  .card { box-shadow: none; }
}

/* Public pages without the sidebar (verification) */
.public-wrap { max-width: 980px; margin: 0 auto; padding: 2rem 1rem; }
.auth-note { margin-top: 1.25rem; }
