/* Design system of the VSME app.
   One place for colour, type and the handful of components the pages reuse. */

:root {
  --bg:        #f4f6f6;
  --surface:   #ffffff;
  --surface-2: #fafbfb;
  --line:      #e5e9ea;
  --line-soft: #eef1f1;

  --text:      #15191c;
  --text-soft: #47515a;
  --muted:     #79838c;

  --accent:      #00715c;
  --accent-soft: #e7f2ef;
  --accent-line: #b6d9cf;

  --ok:        #12805c;
  --ok-soft:   #e6f4ee;
  --warn:      #9a6206;
  --warn-soft: #fdf3e2;
  --bad:       #b3261e;
  --bad-soft:  #fcebe9;
  --info:      #5b4bb5;
  --info-soft: #eeecfa;

  --radius:   11px;
  --radius-s: 7px;
  --shadow:   0 1px 1px rgb(16 24 40 / 4%);
  --shadow-p: 0 -1px 0 var(--line), 0 -10px 24px -14px rgb(16 24 40 / 22%);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv05", "cv08", "ss03";
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.014em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.0625rem; }
h3 { font-size: 0.9375rem; }
p  { margin: 0; }
a  { color: inherit; }

[x-cloak] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.text-muted { color: var(--muted); }
.text-soft  { color: var(--text-soft); }

/* --- shell ------------------------------------------------------------- */

.app { display: flex; min-height: 100vh; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  box-shadow: 0 1px 0 rgb(16 24 40 / 3%);
  display: flex; align-items: center; gap: 1.5rem;
  height: 56px; padding: 0 1.25rem;
  background: rgb(255 255 255 / 85%);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; letter-spacing: -0.02em; }
.brand-mark {
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700; letter-spacing: 0;
}
.topnav { display: flex; gap: 0.25rem; }
.topnav a {
  padding: 0.35rem 0.7rem; border-radius: var(--radius-s);
  color: var(--text-soft); text-decoration: none; font-weight: 500;
}
.topnav a:hover { background: var(--line-soft); color: var(--text); }
.topnav a[aria-current] { background: var(--accent-soft); color: var(--accent); }

.layout { display: flex; flex: 1; align-items: flex-start; gap: 2rem;
          width: 100%; max-width: 1400px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.sidebar { position: sticky; top: 72px; width: 288px; flex: none;
           max-height: calc(100vh - 88px); overflow-y: auto; padding-right: 0.5rem; }
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: #dfe3e8; border-radius: 4px; }
.content { flex: 1; min-width: 0; }
.narrow { width: 100%; max-width: 560px; margin: 2.5rem auto; }

@media (max-width: 1023px) { .sidebar { display: none; } .layout { padding-top: 1rem; } }

/* --- cards ------------------------------------------------------------- */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card + .card { margin-top: .75rem; }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.65rem 1rem; background: var(--surface-2);
  border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0;
}
.card-title { font-size: 0.8125rem; font-weight: 600; color: var(--text-soft); }

/* --- form controls ----------------------------------------------------- */

.field {
  width: 100%; padding: 0.4rem 0.6rem;
  font: inherit; font-size: 0.875rem; color: var(--text);
  background: var(--surface); border: 1px solid #d4d9e0; border-radius: var(--radius-s);
  transition: border-color .12s, box-shadow .12s;
}
.field:hover:not(:disabled) { border-color: #bcc3cd; }
.field:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.field:disabled { background: #f3f5f7; color: var(--muted); cursor: not-allowed; }
.field::placeholder { color: #a6aeb9; }
select.field { appearance: none; padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none' stroke='%2379828f' stroke-width='1.5'%3E%3Cpath d='M3 4.5 6 7.5l3-3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.6rem center; background-size: 12px; }
textarea.field { min-height: 88px; resize: vertical; line-height: 1.55; }
input[type="number"].field { font-variant-numeric: tabular-nums; }
.field-sm { padding: 0.3rem 0.5rem; font-size: 0.8125rem; }
.field-error { border-color: var(--bad); }
.field-error:focus { box-shadow: 0 0 0 3px var(--bad-soft); }

.label { display: block; font-size: 0.875rem; font-weight: 500; }
.hint  { font-size: 0.75rem; color: var(--muted); }
.error { font-size: 0.75rem; color: var(--bad); }

/* --- buttons ----------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.45rem 0.85rem; border-radius: var(--radius-s);
  font: inherit; font-size: 0.875rem; font-weight: 500; line-height: 1.25;
  text-decoration: none; white-space: nowrap; cursor: pointer;
  background: var(--surface); color: var(--text-soft); border: 1px solid #d4d9e0;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--surface-2); border-color: #bcc3cd; color: var(--text); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #0c5b4c; border-color: #0c5b4c; color: #fff; }
.btn-ok { background: var(--ok-soft); border-color: var(--accent-line); color: var(--ok); }
.btn-ok:hover { background: #d8ece3; color: var(--ok); }
.btn-ghost { background: none; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--line-soft); color: var(--text-soft); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8125rem; }

/* --- pills, dots ------------------------------------------------------- */

.pill {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.1rem 0.5rem; border-radius: 999px;
  font-size: 0.6875rem; font-weight: 500; white-space: nowrap;
  background: var(--line-soft); color: var(--text-soft);
}
.pill-ok   { background: var(--ok-soft);   color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad  { background: var(--bad-soft);  color: var(--bad); }
.pill-info { background: var(--info-soft); color: var(--info); }
.pill-mute { background: var(--line-soft); color: var(--muted); }

.dot { width: 7px; height: 7px; border-radius: 999px; flex: none; background: #d3d8de; }
.dot-progress { background: #e0a32e; }
.dot-complete { background: var(--ok); }
.dot-na       { background: #c3c9d1; }
.dot-sensitive{ background: #8a7ce0; }

.code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.6875rem; color: var(--muted);
}

/* --- tables ------------------------------------------------------------ */

.grid-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.grid-table thead th {
  padding: 0.5rem 0.75rem; text-align: left; font-size: 0.6875rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
  background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.grid-table tbody td, .grid-table tbody th {
  padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line-soft);
  text-align: left; font-weight: 400; vertical-align: top;
}
.grid-table tbody tr:last-child td, .grid-table tbody tr:last-child th { border-bottom: 0; }
.grid-table tbody tr:hover { background: var(--surface-2); }
.grid-table td.num, .grid-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid-table .row-num { width: 2.5rem; color: var(--muted); font-size: 0.75rem;
                       font-variant-numeric: tabular-nums; }

/* --- questionnaire ------------------------------------------------------ */

.q {
  padding: 0.85rem 1rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 0.5rem;
  transition: border-color .12s;
}
.q:focus-within { border-color: var(--accent-line); }
.q-invalid { border-color: #efb4af; }
.q-computed { background: var(--surface-2); }
.q-label { display: block; font-size: 0.875rem; line-height: 1.45; color: var(--text); }
.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.65rem;
          margin-top: 0.25rem; font-size: 0.6875rem; color: var(--muted); }
.q-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.55rem; }
.q-input { flex: 1 1 260px; min-width: 0; }
.q-unit { flex: 0 0 auto; font-size: 0.8125rem; color: var(--text-soft);
          padding: 0.35rem 0.55rem; background: var(--line-soft); border-radius: var(--radius-s); }

.actionbar {
  position: sticky; bottom: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  margin: 1.25rem -1rem 0; padding: .75rem 1rem;
  background: rgb(255 255 255 / 92%);
  backdrop-filter: saturate(160%) blur(10px);
  box-shadow: var(--shadow-p);
  border-radius: var(--radius) var(--radius) 0 0;
}

/* --- the questionnaire, as rows --------------------------------------- */

.qcard { background: var(--surface); border: 1px solid var(--line);
         border-radius: var(--radius); box-shadow: var(--shadow);
         margin-bottom: .75rem; overflow: visible; }
.qrow { display: flex; gap: 1.25rem; padding: .7rem 1rem;
        border-bottom: 1px solid var(--line-soft); transition: background .1s; }
.qrow:last-child { border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); }
.qrow:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.qrow:hover { background: var(--surface-2); }
.qrow:focus-within { background: var(--accent-soft); }
.qrow-invalid { background: var(--bad-soft); }
.qrow-computed { background: var(--surface-2); }
.qrow-label { flex: 0 0 43%; min-width: 0; padding-top: .3rem; }
.qrow-label label { display: block; font-size: .8125rem; line-height: 1.45; color: var(--text); }
.qrow-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem;
             margin-top: .2rem; font-size: .6875rem; color: var(--muted); }
.qrow-input { flex: 1; min-width: 0; }
.qrow-control { display: flex; align-items: center; gap: .5rem; }
.unit-chip { flex: none; font-size: .75rem; color: var(--text-soft);
             padding: .25rem .5rem; background: var(--line-soft); border-radius: 5px; }
.linkish { border: 0; background: none; padding: 0; font: inherit; font-size: .6875rem;
           color: var(--muted); text-decoration: underline; cursor: pointer; }
.linkish:hover { color: var(--text-soft); }

@media (max-width: 860px) {
  .qrow { display: block; }
  .qrow-label { margin-bottom: .4rem; }
}

/* --- side menu ---------------------------------------------------------- */

.nav-group { margin-bottom: 1.1rem; }
.nav-group-title {
  padding: 0 0.5rem 0.35rem; font-size: 0.625rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em; color: #98a1ad;
}
.nav-area-title { padding: 0.25rem 0.5rem; font-size: 0.6875rem; font-weight: 500; color: var(--muted); }
.nav-item, .nav-toggle {
  display: flex; align-items: flex-start; gap: 0.45rem; width: 100%;
  padding: 0.32rem 0.5rem; border: 0; border-radius: var(--radius-s);
  background: none; font: inherit; font-size: 0.8125rem; text-align: left;
  color: var(--text-soft); text-decoration: none; cursor: pointer; line-height: 1.35;
  transition: background .1s, color .1s;
}
.nav-item:hover, .nav-toggle:hover { background: var(--line-soft); color: var(--text); }
.nav-item[aria-current] { background: var(--accent); color: #fff; font-weight: 500;
                          box-shadow: 0 1px 2px rgb(0 113 92 / 25%); }
.nav-item[aria-current] .pill { background: rgb(255 255 255 / 22%); color: #fff; }
.nav-item[aria-current] .dot { background: rgb(255 255 255 / 70%); }
.nav-children { margin-left: 0.85rem; padding-left: 0.5rem; border-left: 1px solid var(--line); }
.nav-code { font-weight: 600; flex: none; }
.chev { width: 11px; height: 11px; flex: none; margin-top: 0.2rem; transition: transform .15s; }
.chev-open { transform: rotate(90deg); }

/* --- progress ----------------------------------------------------------- */

.meter { height: 5px; border-radius: 999px; background: var(--line); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px;
                background: var(--accent); transition: width .3s ease; }

.stat { padding: 0.9rem 1rem; background: var(--surface); border: 1px solid var(--line);
        border-radius: var(--radius); box-shadow: var(--shadow); }
.stat-value { font-size: 1.55rem; font-weight: 650; letter-spacing: -0.028em;
              line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.75rem; color: var(--muted); margin-top: .2rem; }

/* --- page heading ------------------------------------------------------ */

.page-head { margin-bottom: 1.25rem; }
.page-head h1 { margin-top: .3rem; }
.page-head .sub { color: var(--muted); font-size: .8125rem; margin-top: .2rem; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }

/* --- banners ------------------------------------------------------------ */

.banner { padding: 0.75rem 1rem; border: 1px solid; border-radius: var(--radius); font-size: 0.875rem; }
.banner-ok   { background: var(--ok-soft);   border-color: var(--accent-line); color: #0b5a42; }
.banner-warn { background: var(--warn-soft); border-color: #f0dcb5; color: #7a4e05; }
.banner-bad  { background: var(--bad-soft);  border-color: #f2c4c0; color: #8c1d18; }
.banner-info { background: var(--info-soft); border-color: #d7d2f4; color: #443a8c; }

/* --- misc --------------------------------------------------------------- */

.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
              font-size: 0.75rem; color: var(--muted); }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { color: var(--text); text-decoration: underline; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }
.empty { padding: 3rem 1.5rem; text-align: center; color: var(--muted);
         background: var(--surface); border: 1px dashed #d4d9e0; border-radius: var(--radius); }

/* --- narrative report ---------------------------------------------------- */

.chapter-preview { font-size: .875rem; line-height: 1.6; }
.chapter-preview h3, .chapter-preview h4 { margin: 1rem 0 .35rem; font-size: .9375rem; }
.chapter-preview p { margin: 0 0 .6rem; }
.chapter-preview .missing { background: var(--bad-soft); color: var(--bad);
                            padding: 0 .2rem; border-radius: 3px; }
.chapter-preview .report-table { width: 100%; border-collapse: collapse; margin: .5rem 0;
                                 font-size: .75rem; }
.chapter-preview .report-table th { text-align: left; background: var(--surface-2);
                                    border: 1px solid var(--line); padding: .25rem .4rem; }
.chapter-preview .report-table td { border: 1px solid var(--line-soft); padding: .25rem .4rem; }
.chapter-preview .chart { margin: .5rem 0; }

@media (max-width: 1100px) { .editor { grid-template-columns: 1fr !important; } }


/* --- report: statements and index-shaped preview ----------------------- */

.sheet { width: 100%; border-collapse: collapse; margin: .6rem 0 .9rem;
         font-size: .875rem; border: 1px solid var(--line); border-radius: var(--radius-s);
         overflow: hidden; }
.sheet td { padding: .45rem .7rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.sheet tr:last-child td { border-bottom: 0; }
.sheet tr.odd td { background: var(--surface-2); }
.sheet .k { color: var(--text-soft); width: 62%; padding-right: 1rem;
            border-left: 3px solid var(--accent); }
.sheet .v { font-weight: 600; text-align: right; }
.sheet .v.long { text-align: left; }
.sheet.t-environment .k { border-left-color: #1f7a3d; }
.sheet.t-water .k { border-left-color: #2a78d6; }
.sheet.t-social .k { border-left-color: #d9731f; }
.sheet.t-governance .k { border-left-color: #4a3aa7; }

/* --- the "i" of a question: the regulation, one hover away ---------------- */
.helpspot { position: relative; display: inline-block; margin-left: .35rem; vertical-align: middle; }
.helpdot {
  width: 1.05rem; height: 1.05rem; padding: 0; border-radius: 999px; cursor: help;
  border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent);
  font: 600 0.6875rem/1 "Inter", system-ui, sans-serif; font-style: italic;
}
.helpdot:hover, .helpdot:focus-visible { background: var(--accent); color: #fff; outline: none; }
.helpbox {
  display: none; position: absolute; z-index: 60; left: 0; top: calc(100% + .4rem);
  width: min(30rem, 70vw); max-height: 20rem; overflow-y: auto;
  padding: .85rem .95rem; text-align: left;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 14px 34px rgba(16, 24, 32, .16);
  font-size: 0.8125rem; line-height: 1.55; color: var(--text-soft); font-weight: 400;
  white-space: normal; cursor: auto;
}
.helpspot:hover .helpbox, .helpspot:focus-within .helpbox { display: block; }
.helpbox-head { display: block; font-weight: 600; color: var(--text); font-size: 0.8125rem; }
.helpbox-label {
  display: block; margin-top: .6rem; font-size: 0.6875rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--accent);
}
.helpbox-text { display: block; margin-top: .25rem; }
.helpbox-text + .helpbox-text { margin-top: .5rem; }
.helpbox-note {
  display: block; margin-top: .45rem; padding: .35rem .5rem; border-radius: var(--radius-s);
  background: var(--warn-soft); color: #7a4e05; font-size: 0.75rem;
}
.helpbox-ref {
  display: block; margin-top: .7rem; padding-top: .5rem; border-top: 1px solid var(--line-soft);
  font-size: 0.6875rem; color: var(--muted);
}
/* Near the right edge the box would run off the page: it opens leftwards. */
/* In the narrow label column the box would hang off the card: it starts there
   and grows to the right, and the card no longer clips what sticks out. */
.qcard, .qrow { overflow: visible; }

/* --- the line under a table or a chart ----------------------------------- */
.caption { font-size: 0.8125rem; color: var(--text-soft); margin: -.2rem 0 1rem; }
