:root {
  --ink: #17212b;
  --muted: #697684;
  --line: #dfe6ec;
  --surface: #ffffff;
  --surface-soft: #f5f8fa;
  --navy: #102a43;
  --navy-2: #1b4965;
  --teal: #0f766e;
  --gold: #b7791f;
  --coral: #c05656;
  --blue: #2b6cb0;
  --green: #2f855a;
  --red: #c53030;
  --violet: #6b46c1;
  --shadow: 0 12px 30px rgba(15, 42, 67, 0.08);
  --radius: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: #eef3f6;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.is-hidden { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
  background: radial-gradient(circle at top left, #dceff0 0, transparent 38%), linear-gradient(135deg, #eef3f6, #dfe8ef);
}

.auth-card {
  width: min(100%, 520px);
  padding: 42px;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 24px;
  box-shadow: 0 28px 70px rgba(15, 42, 67, .16);
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(145deg, var(--navy), var(--teal));
  font-weight: 800;
  letter-spacing: .06em;
  box-shadow: 0 12px 24px rgba(15, 118, 110, .22);
}

.brand-mark.small { width: 38px; height: 38px; border-radius: 12px; font-size: 13px; }

.eyebrow {
  margin: 28px 0 8px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .13em;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.18; letter-spacing: -.025em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); color: var(--navy); }
h1 span { color: var(--teal); }
h2 { font-size: clamp(1.35rem, 2.5vw, 2rem); }
h3 { font-size: 1.08rem; }
h4 { font-size: .95rem; }
p { margin: 0; }

.auth-lead { margin: 18px 0 26px; color: var(--muted); }

.stack-form { display: grid; gap: 10px; }
.stack-form label, .field-label { color: var(--navy); font-size: 13px; font-weight: 750; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15, 118, 110, .12); }

.primary-button, .secondary-button, .danger-button, .ghost-button, .tiny-button {
  border: 0;
  border-radius: 10px;
  padding: 10px 15px;
  font-weight: 750;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.primary-button { color: #fff; background: var(--navy); box-shadow: 0 8px 16px rgba(16,42,67,.16); }
.primary-button:hover, .secondary-button:hover, .danger-button:hover { transform: translateY(-1px); }
.secondary-button { color: #fff; background: var(--teal); }
.danger-button { color: #fff; background: var(--red); }
.ghost-button { color: var(--navy); background: #edf3f6; }
.ghost-button:hover { background: #dce8ed; }
.tiny-button { padding: 6px 9px; color: var(--navy); background: #edf3f6; font-size: 12px; }

.auth-note { margin-top: 22px; padding: 13px 14px; border-left: 3px solid var(--gold); color: #6b4f1d; background: #fff9e8; font-size: 13px; }

.app-shell { min-height: 100vh; }
.topbar { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 28px; color: #fff; background: var(--navy); }
.topbar-brand, .topbar-user { display: flex; align-items: center; gap: 12px; }
.topbar-brand > div:last-child { display: grid; gap: 2px; }
.topbar-brand strong { font-size: 15px; }
.topbar-brand span { color: #b8ccd8; font-size: 12px; }
.topbar-user .ghost-button { color: #e6f3f5; background: rgba(255,255,255,.1); }
.user-badge { padding: 6px 10px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; color: #d8eff0; font-size: 12px; }

.app-layout { min-height: calc(100vh - 118px); display: grid; grid-template-columns: 232px minmax(0,1fr); }
.sidebar { display: flex; flex-direction: column; justify-content: space-between; padding: 24px 14px; background: #fff; border-right: 1px solid var(--line); }
.main-nav { display: grid; gap: 6px; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 11px; padding: 12px 13px; border: 0; border-radius: 10px; text-align: left; color: var(--muted); background: transparent; font-weight: 700; }
.nav-item span { width: 24px; color: #a6b3bc; font-size: 11px; }
.nav-item:hover, .nav-item.is-active { color: var(--navy); background: #e9f4f3; }
.nav-item.is-active span { color: var(--teal); }
.sidebar-foot { display: flex; align-items: center; gap: 8px; padding: 10px; color: var(--muted); font-size: 12px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(47,133,90,.12); }

.content-area { min-width: 0; padding: 32px clamp(18px, 4vw, 54px) 56px; }
.view-panel { max-width: 1500px; margin: 0 auto; }
.site-footer { display: flex; justify-content: space-between; gap: 16px; padding: 18px 28px; border-top: 1px solid var(--line); color: var(--muted); background: #fff; font-size: 12px; }

.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-heading p { max-width: 760px; margin-top: 9px; color: var(--muted); }
.heading-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.kicker { margin-bottom: 8px; color: var(--teal); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 22px; }
.metric-card, .surface-card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.metric-card { min-height: 128px; display: flex; flex-direction: column; justify-content: space-between; }
.metric-label { color: var(--muted); font-size: 13px; }
.metric-value { margin-top: 8px; color: var(--navy); font-size: 2rem; font-weight: 850; letter-spacing: -.04em; }
.metric-foot { color: var(--muted); font-size: 12px; }
.metric-card.accent-teal { border-top: 4px solid var(--teal); }
.metric-card.accent-gold { border-top: 4px solid var(--gold); }
.metric-card.accent-blue { border-top: 4px solid var(--blue); }
.metric-card.accent-green { border-top: 4px solid var(--green); }

.two-column { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(300px,.9fr); gap: 18px; }
.surface-card + .surface-card { margin-top: 18px; }
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.card-heading p { margin-top: 5px; color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.small-text { font-size: 13px; }

.timeline { display: grid; gap: 0; }
.timeline-item { position: relative; display: grid; grid-template-columns: 38px 1fr; gap: 12px; padding-bottom: 20px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item:not(:last-child)::before { content: ""; position: absolute; left: 17px; top: 30px; bottom: 0; width: 1px; background: #cbd8df; }
.timeline-number { z-index: 1; width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid #c7d8dd; border-radius: 50%; color: var(--teal); background: #eef8f7; font-weight: 800; font-size: 12px; }
.timeline-item strong { display: block; margin: 5px 0 3px; }
.timeline-item p { color: var(--muted); font-size: 13px; }

.info-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; margin-bottom: 18px; }
.info-chip { padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); }
.info-chip small { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.info-chip strong { color: var(--navy); font-size: 14px; }

.progress-strip { height: 10px; overflow: hidden; border-radius: 999px; background: #e5edf0; }
.progress-strip > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), #47a89e); transition: width .25s; }
.progress-label { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 7px; color: var(--muted); font-size: 12px; }

.panel-toolbar { display: grid; grid-template-columns: minmax(210px, .7fr) minmax(180px, .35fr) auto; align-items: end; gap: 12px; margin-bottom: 18px; }
.field-group { display: grid; gap: 6px; }
.panel-workspace { display: grid; grid-template-columns: 290px minmax(0,1fr); gap: 18px; align-items: start; }
.indicator-list { position: sticky; top: 18px; max-height: calc(100vh - 140px); overflow: auto; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.indicator-list-header { padding: 8px 8px 12px; color: var(--muted); font-size: 12px; font-weight: 750; }
.indicator-list-item { width: 100%; display: grid; grid-template-columns: 56px 1fr auto; gap: 8px; align-items: center; padding: 10px 8px; border: 0; border-left: 3px solid transparent; border-radius: 9px; text-align: left; background: transparent; }
.indicator-list-item:hover, .indicator-list-item.is-active { border-left-color: var(--teal); background: #edf8f7; }
.indicator-list-item code { color: var(--teal); font-size: 11px; font-weight: 800; }
.indicator-list-item strong { overflow: hidden; color: var(--navy); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.indicator-list-item small { color: var(--muted); font-size: 11px; }
.indicator-list-item.is-complete small { color: var(--green); font-weight: 800; }

.indicator-main { min-width: 0; }
.indicator-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.indicator-head h2 { font-size: clamp(1.3rem, 2.5vw, 1.85rem); }
.indicator-head p { margin-top: 6px; color: var(--muted); }
.indicator-code { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--teal); font-size: 12px; font-weight: 850; letter-spacing: .07em; }
.theme-pill { padding: 5px 9px; border-radius: 999px; color: #fff; background: var(--navy-2); font-size: 11px; letter-spacing: 0; }
.esg-map { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.esg-badge { min-width: 30px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 8px; text-align: center; color: var(--muted); background: #fff; font-size: 12px; font-weight: 800; }
.esg-badge.is-primary { border-color: #a7d7d1; color: var(--teal); background: #edf8f7; }
.esg-badge.is-related { border-color: #d9c896; color: #8d681e; background: #fff9e8; }

.definition-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-bottom: 18px; }
.definition-block { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfd; }
.definition-block h4 { margin-bottom: 7px; color: var(--navy); }
.definition-block p { color: #485767; font-size: 13px; }

.rating-section { margin-top: 18px; }
.rating-section > .card-heading { margin-bottom: 12px; }
.rating-grid { display: grid; gap: 12px; }
.rating-card { padding: 15px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.rating-card.is-low { border-color: #efc5b9; background: #fffaf8; }
.rating-card-head { display: flex; justify-content: space-between; gap: 12px; }
.rating-card-head h3 { color: var(--navy); }
.rating-card-head p { margin-top: 5px; color: var(--muted); font-size: 13px; }
.rating-controls { display: grid; grid-template-columns: 110px minmax(0,1fr); gap: 10px; align-items: end; margin-top: 12px; }
.score-select { font-weight: 800; }
.reason-select { background: #fbfdfe; }
.rating-comment { margin-top: 10px; }
.rating-comment textarea { min-height: 68px; }
.score-help { margin-top: 8px; color: var(--muted); font-size: 12px; }

.indicator-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.footer-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.submission-card { margin-top: 18px; }
.submission-grid { display: grid; grid-template-columns: minmax(180px,.55fr) minmax(0,1fr) auto; gap: 12px; align-items: end; }
.checkbox-line { display: flex; align-items: flex-start; gap: 8px; color: #485767; font-size: 13px; }
.checkbox-line input { width: auto; margin-top: 4px; }

.admin-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.admin-tab { padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); background: #fff; font-size: 12px; font-weight: 750; }
.admin-tab.is-active { border-color: var(--navy); color: #fff; background: var(--navy); }
.admin-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; font-size: 13px; }
th { color: var(--navy); background: #f4f7f9; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
td strong { color: var(--navy); }
.table-input { min-width: 150px; padding: 8px 9px; font-size: 12px; }
.table-textarea { min-width: 220px; min-height: 58px; padding: 8px 9px; font-size: 12px; }
.nowrap { white-space: nowrap; }
.score-summary { display: flex; flex-wrap: wrap; gap: 5px; }
.score-chip { padding: 3px 6px; border-radius: 6px; color: var(--navy); background: #edf3f6; font-size: 11px; }
.score-chip.empty { color: #9aa7af; background: #f5f7f8; }
.status-tag { display: inline-block; padding: 4px 7px; border-radius: 999px; color: #53636d; background: #edf3f6; font-size: 11px; font-weight: 750; }
.status-tag.good { color: #276749; background: #e7f6ec; }
.status-tag.warn { color: #8d681e; background: #fff5d7; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.form-grid .span-2 { grid-column: span 2; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.record-list { display: grid; gap: 10px; }
.record-item { padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfd; }
.record-item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.record-item p { color: #485767; font-size: 13px; }
.record-item small { color: var(--muted); }

.checklist { display: grid; gap: 10px; }
.checklist-row { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfd; }
.checklist-row input { width: auto; margin-top: 4px; }
.checklist-row strong { display: block; color: var(--navy); font-size: 13px; }
.checklist-row span { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }

.toast-root { position: fixed; z-index: 10; right: 18px; bottom: 18px; display: grid; gap: 8px; width: min(360px, calc(100% - 36px)); }
.toast { padding: 12px 14px; border: 1px solid #b7dcd5; border-left: 4px solid var(--teal); border-radius: 10px; color: #164e4a; background: #effaf8; box-shadow: var(--shadow); font-size: 13px; }
.toast.error { border-color: #efc5b9; border-left-color: var(--red); color: #7d2424; background: #fff7f4; }

@media (max-width: 1000px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .panel-workspace { grid-template-columns: 240px minmax(0,1fr); }
  .submission-grid { grid-template-columns: 1fr 1fr; }
  .submission-grid .full-row { grid-column: span 2; }
}

@media (max-width: 760px) {
  .topbar { align-items: flex-start; padding: 14px 16px; }
  .topbar-user { align-items: flex-end; flex-direction: column; gap: 6px; }
  .app-layout { display: block; }
  .sidebar { padding: 10px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .main-nav { display: flex; overflow: auto; }
  .nav-item { min-width: max-content; width: auto; padding: 9px 11px; }
  .sidebar-foot { display: none; }
  .content-area { padding: 24px 14px 38px; }
  .site-footer { flex-direction: column; padding: 15px 16px; }
  .page-heading, .indicator-head { flex-direction: column; }
  .heading-actions, .esg-map { justify-content: flex-start; }
  .two-column, .definition-grid, .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .info-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .panel-toolbar { grid-template-columns: 1fr; align-items: stretch; }
  .panel-workspace { display: block; }
  .indicator-list { position: static; max-height: 280px; margin-bottom: 18px; }
  .rating-controls { grid-template-columns: 1fr; }
  .indicator-footer, .submission-grid { display: grid; grid-template-columns: 1fr; }
  .submission-grid .full-row { grid-column: auto; }
  .footer-actions { justify-content: flex-start; }
  .auth-card { padding: 30px 22px; }
}

@media (max-width: 480px) {
  .metric-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .topbar-brand span { display: none; }
}
