:root {
  --bg: #0b1220;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-2: rgba(255, 255, 255, 0.09);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.65);
  --brand: #5dd6ff;
  --good: #35d07f;
  --warn: #ffcc66;
  --bad: #ff6b6b;
  --border: rgba(255, 255, 255, 0.12);
  --layout-max: 1440px;
  --layout-pad: clamp(16px, 2.5vw, 32px);
  --layout-inset: max(var(--layout-pad), calc((100vw - var(--layout-max)) / 2 + var(--layout-pad)));
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Tahoma, "Segoe UI", Arial, sans-serif;
  background: radial-gradient(1000px 500px at 10% 0%, rgba(93, 214, 255, 0.18), transparent),
    radial-gradient(900px 450px at 90% 10%, rgba(53, 208, 127, 0.14), transparent),
    var(--bg);
  color: var(--text);
}

.app-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title account"
    "nav nav"
    "status status";
  align-items: start;
  column-gap: 16px;
  row-gap: 10px;
  padding: 14px var(--layout-inset) 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 18, 32, 0.92);
  backdrop-filter: blur(10px);
}

.app-title {
  grid-area: title;
  min-width: 0;
}

.app-title__top {
  font-size: 20px;
  font-weight: 800;
}

.app-title__sub {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.app-account {
  grid-area: account;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.app-nav {
  grid-area: nav;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.app-status {
  grid-area: status;
  color: var(--muted);
  font-size: 13px;
  text-align: left;
  max-width: none;
  min-height: 1.2em;
}
.auth-badge {
  color: var(--muted);
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 10px;
  white-space: nowrap;
}
.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: var(--layout-pad);
}
.auth-card {
  width: min(100%, 460px);
}
.auth-card__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.auth-logo {
  display: block;
  width: min(180px, 55%);
  height: auto;
  object-fit: contain;
}
.auth-card__title {
  font-weight: 700;
}
.auth-lead {
  margin: 0 0 18px;
  color: var(--muted, #5b6472);
  line-height: 1.5;
  text-align: center;
}
.auth-form {
  display: grid;
  gap: 12px;
  margin-bottom: 8px;
}
.auth-form .control__input {
  width: 100%;
  min-width: 0;
}
.auth-hint {
  margin: 4px 0 0;
  font-size: 12px;
  text-align: center;
}
.auth-hint code {
  font-size: 12px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  color: var(--muted);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-card .form-actions {
  justify-content: stretch;
}
.auth-card .form-actions .btn {
  width: 100%;
  text-align: center;
  text-decoration: none;
}

.container {
  width: 100%;
  max-width: var(--layout-max);
  margin-inline: auto;
  padding: 18px var(--layout-pad) 40px;
  box-sizing: border-box;
}

main.container.auth-page {
  max-width: none;
}

.controls {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.control {
  display: grid;
  gap: 6px;
  min-width: 0;
  position: relative;
}

.control__label {
  font-size: 12px;
  color: var(--muted);
}

.control__input {
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid var(--border);
  color: #eef3fb;
  border-radius: 10px;
  padding: 11px 12px;
  min-width: 260px;
  outline: none;
  font-size: 15px;
  line-height: 1.45;
  font-weight: 500;
}

.control__input::placeholder {
  color: rgba(238, 243, 251, 0.42);
  font-weight: 400;
}

textarea.control__input {
  font-size: 15px;
  line-height: 1.5;
}

.control__input.is-invalid,
.entry-period__input.is-invalid {
  border-color: #f87171;
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.25);
}

select.control__input {
  background-color: rgba(255, 255, 255, 0.94);
  color: #111827;
}

select.control__input option {
  background: #ffffff;
  color: #111827;
}

.btn {
  background: linear-gradient(180deg, rgba(93, 214, 255, 0.35), rgba(93, 214, 255, 0.18));
  color: var(--text);
  border: 1px solid rgba(93, 214, 255, 0.5);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
}

.btn--ghost {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
}

.card__label {
  font-size: 12px;
  color: var(--muted);
}

.card__value {
  font-size: 24px;
  font-weight: 900;
  margin-top: 8px;
}

.cards--kpi-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card--over {
  border-color: rgba(56, 152, 255, 0.45);
}

.card--on-target {
  border-color: rgba(53, 208, 127, 0.45);
}

.card--under {
  border-color: rgba(255, 153, 51, 0.45);
}

.card--filter {
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.card--filter:hover {
  border-color: rgba(56, 152, 255, 0.55);
  box-shadow: 0 4px 14px rgba(56, 152, 255, 0.12);
}

.card--filter.card--active {
  border-color: rgba(56, 152, 255, 0.85);
  box-shadow: 0 0 0 2px rgba(56, 152, 255, 0.2);
  background: rgba(56, 152, 255, 0.08);
}

.card--filter.card--active.card--over {
  border-color: rgba(56, 152, 255, 0.85);
}

.card--filter.card--active.card--on-target {
  border-color: rgba(53, 208, 127, 0.75);
  box-shadow: 0 0 0 2px rgba(53, 208, 127, 0.18);
  background: rgba(53, 208, 127, 0.08);
}

.card--filter.card--active.card--under {
  border-color: rgba(255, 153, 51, 0.75);
  box-shadow: 0 0 0 2px rgba(255, 153, 51, 0.18);
  background: rgba(255, 153, 51, 0.08);
}

.card--filter:focus-visible {
  outline: 2px solid rgba(56, 152, 255, 0.85);
  outline-offset: 2px;
}

.composite-toggle {
  margin-bottom: 12px;
}

.composite-config {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.composite-hint {
  margin: 0 0 12px;
  font-size: 13px;
}

.sub-indicators-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.sub-indicator-row {
  display: grid;
  grid-template-columns: minmax(120px, 160px) 1fr auto;
  gap: 10px;
  align-items: end;
}

.composite-formula {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}

.composite-formula__ratio {
  margin-top: 10px;
}

.formula-insert-codes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.formula-preview {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(56, 152, 255, 0.08);
  border-radius: 10px;
  font-size: 13px;
}

.sub-results-panel {
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(56, 152, 255, 0.04);
}

.sub-results-panel__title {
  font-weight: 700;
  margin-bottom: 6px;
}

.computed-result-preview {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  font-size: 14px;
}

.kpi-name-with-info {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.info-btn-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
}

.info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(56, 152, 255, 0.45);
  background: rgba(56, 152, 255, 0.12);
  color: #3898ff;
  font-size: 12px;
  font-weight: 800;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
  cursor: help;
  vertical-align: middle;
  padding: 0;
  flex: 0 0 auto;
}

.info-btn:hover,
.info-btn:focus-visible {
  background: rgba(56, 152, 255, 0.22);
  outline: none;
}

.info-btn-wrap .info-tooltip {
  visibility: hidden;
  opacity: 0;
  position: fixed;
  z-index: 200;
  min-width: 160px;
  max-width: min(320px, 70vw);
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--panel, #1a2332);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  color: var(--text, #e8eef7);
  font-size: 13px;
  font-weight: 400;
  font-style: normal;
  font-family: inherit;
  line-height: 1.45;
  white-space: normal;
  pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s ease;
}

.info-btn-wrap:hover .info-tooltip,
.info-btn-wrap:focus-within .info-tooltip {
  visibility: visible;
  opacity: 1;
}

.label-with-info {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.kpi-desc-dialog {
  width: min(520px, calc(100vw - 32px));
}

.kpi-desc-body {
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 15px;
}

@media (max-width: 980px) {
  .sub-indicator-row {
    grid-template-columns: 1fr;
  }
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.panel__header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-weight: 800;
}

.panel__body {
  padding: 12px 14px;
}

.panel__footer {
  padding: 0 14px 12px;
  color: var(--muted);
  font-size: 12px;
}

.panel--table .panel__body {
  padding-top: 6px;
}

.table-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.table-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.link {
  color: var(--brand);
  font-weight: 700;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  vertical-align: top;
}

th {
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  font-weight: 800;
}

td {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
}

.table-row-clickable {
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.table-row-clickable:hover {
  background: rgba(93, 214, 255, 0.08);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 4px 10px;
  font-weight: 800;
  white-space: nowrap;
}

.supervisors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.supervisor-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
}

.supervisor-card__dept {
  font-weight: 800;
  margin-bottom: 8px;
}

.status-badge--success {
  background: rgba(53, 208, 127, 0.18);
  border-color: rgba(53, 208, 127, 0.6);
  color: #6ff0a7;
}

.status-badge--fail {
  background: rgba(255, 77, 77, 0.18);
  border-color: rgba(255, 77, 77, 0.6);
  color: #ff8f8f;
}

.status-badge--pending {
  background: transparent;
  border-color: rgba(255, 204, 102, 0.95);
  color: #ffffff;
}

.status-badge--review-pending {
  background: rgba(93, 214, 255, 0.16);
  border-color: rgba(93, 214, 255, 0.55);
  color: #9de8ff;
}

.status-badge--approved {
  background: rgba(53, 208, 127, 0.18);
  border-color: rgba(53, 208, 127, 0.6);
  color: #6ff0a7;
}

.status-badge--revision {
  background: rgba(255, 204, 102, 0.28);
  border-color: rgba(255, 204, 102, 0.85);
  color: #ffe08a;
}

.status-badge--over {
  background: rgba(56, 152, 255, 0.18);
  border-color: rgba(56, 152, 255, 0.6);
  color: #8ec5ff;
}

.status-badge--on-target {
  background: rgba(53, 208, 127, 0.18);
  border-color: rgba(53, 208, 127, 0.6);
  color: #6ff0a7;
}

.status-badge--under {
  background: rgba(255, 153, 51, 0.2);
  border-color: rgba(255, 153, 51, 0.7);
  color: #ffb066;
}

.status-badge--no-result {
  background: rgba(255, 77, 77, 0.18);
  border-color: rgba(255, 77, 77, 0.6);
  color: #ff8f8f;
}

.table-row--revision td {
  background: rgba(255, 204, 102, 0.14);
}

.table-row--revision td.cell--revision-highlight {
  background: rgba(255, 204, 102, 0.28);
  box-shadow: inset 0 0 0 1px rgba(255, 204, 102, 0.55);
}

.revision-alert {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 204, 102, 0.75);
  background: rgba(255, 204, 102, 0.18);
  color: #ffe7a8;
}

.revision-alert__title {
  font-weight: 900;
  margin-bottom: 4px;
}

.revision-alert__note {
  color: #fff3cf;
  white-space: pre-wrap;
}

.unread-alert {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(93, 214, 255, 0.65);
  background: rgba(93, 214, 255, 0.12);
  color: #c8f0ff;
}

.admin-as-user-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.08);
}

.admin-as-user-bar__mode,
.admin-as-user-bar__user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #cbd5e1;
}

.admin-as-user-bar__mode .control__input,
.admin-as-user-bar__user .control__input {
  min-width: 160px;
  width: auto;
}

.admin-as-user-bar__note {
  flex: 1 1 180px;
  font-size: 13px;
}

.unread-alert__title {
  font-weight: 900;
  margin-bottom: 4px;
}

.unread-alert__note {
  color: #e8f9ff;
  white-space: pre-wrap;
  font-size: 13px;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ff4d4d;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  vertical-align: middle;
}

.unread-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: #5dd6ff;
  box-shadow: 0 0 0 2px rgba(93, 214, 255, 0.35);
  vertical-align: middle;
}

.unread-badge {
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(93, 214, 255, 0.55);
  background: rgba(93, 214, 255, 0.16);
  color: #9de8ff;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  vertical-align: middle;
}

.table-row--unread td:first-child {
  box-shadow: inset 3px 0 0 #5dd6ff;
}

.table-row--unread td {
  background: rgba(93, 214, 255, 0.06);
}

.table-row--unread.table-row--revision td:first-child {
  box-shadow: inset 3px 0 0 #ffcc66;
}

.card--unread {
  border-color: rgba(93, 214, 255, 0.55);
  box-shadow: inset 0 0 0 1px rgba(93, 214, 255, 0.25);
}

.panel--revision-highlight {
  border-color: rgba(255, 204, 102, 0.75);
  box-shadow: inset 0 0 0 1px rgba(255, 204, 102, 0.35);
}

.panel--revision-highlight .panel__header {
  background: rgba(255, 204, 102, 0.16);
  color: #ffe08a;
}

.control__input--revision,
.control__input.control__input--revision {
  border-color: rgba(255, 204, 102, 0.85);
  background: rgba(255, 204, 102, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 204, 102, 0.35);
}

.quarterly-panel {
  margin-top: 12px;
}

.quarterly-panel__hint {
  margin-bottom: 10px;
  font-size: 13px;
}

.quarterly-results-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.quarterly-result-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
}

.quarterly-result-item__label {
  font-weight: 600;
  color: #ffffff;
}

.quarterly-result-item__value {
  grid-column: 2;
}

.review-check {
  font-weight: 900;
  margin-right: 4px;
}

.freq-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.freq-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}

.freq-option:hover {
  background: rgba(255, 255, 255, 0.08);
}

.freq-option:has(input:checked) {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.4);
}

.freq-option input:checked + span {
  font-weight: 700;
}

.attachment-hint {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.attachment-current {
  margin-top: 8px;
  font-size: 13px;
}

.attachment-current a {
  color: #38bdf8;
  text-decoration: underline;
}

.month-checkboxes {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

@media (max-width: 600px) {
  .month-checkboxes {
    grid-template-columns: repeat(4, 1fr);
  }
}

.month-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s, border-color 0.15s;
  user-select: none;
}

.month-checkbox:hover {
  background: rgba(255, 255, 255, 0.08);
}

.month-checkbox input:checked + span {
  font-weight: 700;
}

.month-checkbox:has(input:checked) {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.4);
}

.period-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 500px) {
  .period-fields-grid {
    grid-template-columns: 1fr;
  }
}

.period-field-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.period-field-card__label {
  font-weight: 700;
  font-size: 13px;
  color: #ffffff;
}

.period-field-card input,
.period-field-card textarea {
  width: 100%;
  box-sizing: border-box;
}

/* User dashboard — inline entry card layout */
.table-wrap--entry {
  overflow: visible;
}

.entry-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.entry-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.entry-card:hover {
  border-color: rgba(56, 152, 255, 0.28);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.entry-card--revision {
  border-color: rgba(251, 113, 133, 0.45);
  background: linear-gradient(165deg, rgba(251, 113, 133, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.entry-card--unread {
  border-left: 3px solid rgba(56, 189, 248, 0.75);
}

.entry-panel {
  padding: 4px 2px;
}

.entry-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.entry-card__title {
  flex: 1 1 280px;
  font-weight: 700;
  font-size: 14px;
  line-height: 1.45;
  min-width: 0;
  word-break: break-word;
}

.entry-card__title .kpi-name-with-info {
  white-space: normal;
  word-break: break-word;
}

.entry-card__revision-note {
  width: 100%;
  margin-top: 4px;
  font-size: 12px;
  color: rgba(251, 113, 133, 0.9);
}

.entry-card__actions {
  flex: 0 0 auto;
}

.entry-card__save {
  min-width: 72px;
}

.entry-card__locked-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  padding: 6px 10px;
}

.entry-card__periods {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  width: 100%;
}

.entry-card__attachment {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.04);
  display: grid;
  gap: 8px;
}

.entry-card__attachment-title {
  font-weight: 700;
  font-size: 13px;
}

.entry-card__attachment-required {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #b45309;
  background: rgba(251, 191, 36, 0.2);
}

.entry-card__attachment-hint {
  font-size: 12px;
}

.entry-card__attachment-current {
  font-size: 13px;
}

.entry-card__attachment-current a {
  color: var(--accent, #0ea5e9);
}

.entry-card__attachment-file,
.entry-card__attachment-note {
  display: grid;
  gap: 4px;
}

.entry-card__attachment-file-label {
  font-size: 12px;
  opacity: 0.75;
}

.entry-card__attachment-input {
  width: 100%;
  font-size: 13px;
}

.entry-card__no-period {
  grid-column: 1 / -1;
  font-size: 13px;
  padding: 8px 0;
}

.entry-card--needs-entry {
  border-color: rgba(250, 204, 21, 0.45);
  box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.12);
}

.entry-card__save--highlight {
  animation: entry-save-pulse 2.2s ease-in-out infinite;
}

@keyframes entry-save-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(56, 152, 255, 0.35);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(56, 152, 255, 0);
  }
}

.entry-period--required {
  border: 2px dashed rgba(250, 204, 21, 0.95) !important;
  background: transparent !important;
  color: #ffffff;
}

.entry-period--next {
  border-style: solid !important;
  border-color: #facc15 !important;
  background: transparent !important;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.22);
  color: #ffffff;
}

.entry-period__required-tag {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  background: transparent;
  color: #ffffff;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.02em;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(250, 204, 21, 0.95);
  box-shadow: none;
  white-space: nowrap;
}

.entry-period__input--required {
  border-color: rgba(250, 204, 21, 0.85) !important;
  background: rgba(255, 255, 255, 0.1) !important;
  color: #eef3fb !important;
}

.entry-period__input--required::placeholder {
  color: rgba(238, 243, 251, 0.55);
  font-weight: 600;
}

.entry-period__sub--required .entry-period__sub-label {
  color: #ffffff;
  font-weight: 700;
}

.entry-period--required .entry-period__label {
  color: #ffffff;
  font-weight: 900;
}

.entry-period {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 10px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.15);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.entry-period:focus-within:not(.entry-period--locked) {
  border-color: rgba(56, 152, 255, 0.55);
  border-style: solid;
  background: rgba(56, 152, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(56, 152, 255, 0.12);
}

.entry-period--filled:not(.entry-period--locked) {
  border-style: solid;
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.05);
}

.entry-period--locked {
  border-style: solid;
  border-color: rgba(34, 197, 94, 0.35);
  background: rgba(34, 197, 94, 0.07);
}

.entry-period--filled-locked {
  border-style: solid;
  border-color: rgba(250, 204, 21, 0.55);
  background: rgba(250, 204, 21, 0.06);
}

.entry-period--filled-locked .entry-period__input:disabled,
.entry-period--filled-locked .entry-period__input[readonly] {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(250, 204, 21, 0.45);
  color: #eef3fb;
}

.entry-period--composite {
  min-width: 0;
}

.entry-period__label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #ffffff;
  text-align: center;
}

.entry-period__input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.1);
  color: #eef3fb;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  line-height: 1.35;
  letter-spacing: 0.01em;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.entry-period__input::placeholder {
  color: rgba(238, 243, 251, 0.4);
  font-weight: 400;
}

.entry-period__input:focus {
  outline: none;
  border-color: rgba(56, 152, 255, 0.7);
  background: rgba(255, 255, 255, 0.14);
  color: #f7faff;
}

.entry-period__input:disabled,
.entry-period__input[readonly] {
  cursor: not-allowed;
  opacity: 0.95;
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.3);
  color: #e8f7ee;
}

.entry-period__badge {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 11px;
  font-weight: 800;
  color: #4ade80;
  line-height: 1;
}

.entry-period__badge--filled {
  top: 4px;
  right: 6px;
  color: #eef3fb;
  border: 1px solid rgba(250, 204, 21, 0.85);
  border-radius: 999px;
  padding: 2px 7px;
  background: transparent;
  font-size: 10px;
}

.entry-period__raw-summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.4;
  color: rgba(238, 243, 251, 0.78);
}

.entry-period__raw-summary strong {
  color: #eef3fb;
  font-weight: 700;
}

.control__input--locked,
.entry-period__input:disabled,
.entry-period__input[readonly] {
  color: #eef3fb !important;
}

.entry-locked-hint {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(250, 204, 21, 0.85);
  background: transparent;
  color: #eef3fb;
  font-size: 13px;
  font-weight: 600;
}

.entry-period__subs {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.entry-period__sub {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.entry-period__sub-label {
  font-size: 11px;
  line-height: 1.35;
  color: #ffffff;
  white-space: normal;
  overflow: visible;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.entry-period__input--sub {
  font-size: 15px;
  padding: 8px 10px;
}

.entry-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 12px;
}

.entry-card__meta-item {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 100%;
  word-break: break-word;
}

.entry-card__meta-label {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.45);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

@media (max-width: 520px) {
  .entry-card__periods {
    grid-template-columns: repeat(2, 1fr);
  }

  .entry-card__meta {
    flex-direction: column;
    align-items: flex-start;
  }
}

.period-field-card--filled {
  border-color: rgba(56, 189, 248, 0.3);
  background: rgba(56, 189, 248, 0.06);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ---------- AI Analysis Panel ---------- */
.ai-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ai-stat-cards {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

@media (max-width: 900px) {
  .ai-stat-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 520px) {
  .ai-stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

.ai-stat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
}

.ai-stat__label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 4px;
}

.ai-stat__value {
  font-size: 20px;
  font-weight: 800;
}

.ai-stat-detail {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
}

@media (max-width: 800px) {
  .ai-stat-detail {
    grid-template-columns: 1fr;
  }
}

.ai-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ai-mini-table th,
.ai-mini-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-mini-table th {
  color: rgba(255, 255, 255, 0.6);
  font-weight: 600;
}

.ai-rank-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-rank__title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  color: rgba(255, 255, 255, 0.7);
}

.ai-rank__item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.ai-rank__item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-ask__suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.ai-chip {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: inherit;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
}

.ai-chip:hover {
  background: rgba(56, 189, 248, 0.2);
}

.ai-ask__row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.ai-ask__row textarea {
  flex: 1;
  resize: vertical;
}

.ai-ask__row .btn {
  white-space: nowrap;
  align-self: flex-end;
}

.ai-result {
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 10px;
  padding: 14px 16px;
  background: rgba(56, 189, 248, 0.05);
}

.ai-result__head {
  font-weight: 800;
  margin-bottom: 8px;
  color: rgba(125, 211, 252, 0.95);
}

.ai-result__body p {
  margin: 6px 0;
  line-height: 1.6;
}

.ai-result__body h4 {
  margin: 12px 0 4px;
  font-size: 15px;
}

.ai-result__body ul {
  margin: 6px 0;
  padding-left: 20px;
}

.ai-result__body li {
  margin: 3px 0;
  line-height: 1.55;
}

.ai-loading {
  color: rgba(255, 255, 255, 0.7);
  font-style: italic;
}

.ai-error {
  color: #fca5a5;
}

.modal-open {
  overflow: hidden;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(4px);
}

.modal__dialog {
  position: relative;
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  margin: 20px auto;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.45);
}

.modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.modal__title {
  font-size: 18px;
  font-weight: 900;
}

.modal__subtitle {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.modal__body {
  max-height: calc(100vh - 130px);
  overflow: auto;
  padding: 16px 18px 20px;
}

.modal__footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.modal__footer-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.camt-alert-dialog {
  width: min(420px, calc(100vw - 32px));
  margin-top: min(18vh, 120px);
}

.camt-alert-modal {
  z-index: 1100;
}

.camt-alert-body {
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.camt-alert-detail {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.45;
}

.review-note-box {
  display: grid;
  gap: 6px;
}

.review-note-box textarea {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 10px 12px;
  font: inherit;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
}

.detail-item__label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.detail-item__value {
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.detail-section {
  margin-top: 16px;
}

.detail-section__title {
  font-weight: 900;
  color: var(--brand);
  margin-bottom: 10px;
}

.detail-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
}

.detail-card__title {
  font-weight: 800;
  margin-bottom: 10px;
}

.table-wrap .empty {
  color: var(--muted);
  padding: 22px 0;
  text-align: center;
}

@media (max-width: 980px) {
  .app-header {
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "account"
      "nav"
      "status";
  }
  .app-account {
    justify-content: flex-start;
  }
  .app-status {
    text-align: left;
  }
  .cards {
    grid-template-columns: 1fr;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .control__input {
    min-width: 220px;
  }
  table {
    min-width: 620px;
  }
}

/* ===== Entry page additions ===== */
.app-nav .btn.is-active {
  background: linear-gradient(180deg, rgba(93, 214, 255, 0.45), rgba(93, 214, 255, 0.22));
  color: var(--text);
  border-color: rgba(93, 214, 255, 0.7);
}
.app-status--ok { color: var(--good); }
.app-status--warn { color: var(--warn); }
.app-status--err { color: var(--bad); }
.is-app-busy {
  cursor: progress;
}
.is-app-busy .table-wrap,
.is-app-busy .panel__body {
  pointer-events: none;
  opacity: 0.72;
}
@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.tab {
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  color: var(--muted);
  padding: 10px 16px;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
}
.tab:hover { color: var(--text); }
.tab.is-active {
  color: var(--text);
  background: var(--panel);
  border-color: var(--border);
  border-bottom-color: var(--panel);
  margin-bottom: -1px;
}
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.form .panel {
  overflow: visible;
}
.panel__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.panel__actions .control__input { min-width: 180px; padding: 8px 10px; }

.btn--primary {
  background: linear-gradient(180deg, rgba(53, 208, 127, 0.45), rgba(53, 208, 127, 0.22));
  border-color: rgba(53, 208, 127, 0.55);
}
.btn--danger {
  background: linear-gradient(180deg, rgba(255, 107, 107, 0.4), rgba(255, 107, 107, 0.18));
  border-color: rgba(255, 107, 107, 0.55);
}
.btn--sm { padding: 6px 10px; font-size: 12px; }

.table-input {
  width: 100%;
  min-width: 90px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.78);
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}

.table-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.control--span2 { grid-column: span 2; }
.control-row-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.control-row-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.control--inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}
.control__input {
  width: 100%;
  min-width: 0;
}
textarea.control__input { resize: vertical; font-family: inherit; }

@media (max-width: 760px) {
  .control-row-3,
  .control-row-4 {
    grid-template-columns: 1fr;
  }
  .add-row {
    grid-template-columns: 1fr;
  }
  .add-row--with-email {
    grid-template-columns: 1fr;
  }
  .add-row .btn {
    width: 100%;
  }
  .form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .form-actions .btn {
    width: 100%;
  }
  .edit-log-item {
    grid-template-columns: 1fr;
  }
  .edit-log-meta {
    text-align: left;
  }
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.form-actions .btn {
  min-width: 120px;
}
.form-actions .btn--primary {
  min-width: 170px;
}

.objective {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}
.custom-template-list {
  display: grid;
  gap: 8px;
}
.custom-template-item {
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 10px 12px;
}
.edit-log-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}
.edit-log-item {
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px 12px;
}
.edit-log-item--create {
  border-left-color: var(--good);
}
.edit-log-item--delete {
  border-left-color: var(--bad);
}
.edit-log-meta {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}
.objective__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.objective__num { font-weight: 700; color: var(--brand); font-size: 13px; }

.add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 10px;
}
.add-row--with-email {
  grid-template-columns: minmax(160px, 1fr) minmax(180px, 0.9fr) auto;
}
.add-row .control__input {
  min-width: 0;
}
.add-row .btn {
  min-width: 72px;
  padding-left: 14px;
  padding-right: 14px;
}

.chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 280px;
  overflow: auto;
}
.chips--compact {
  max-height: 92px;
}
.option-dropdown {
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(93, 214, 255, 0.28);
  border-radius: 12px;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.38);
  display: none;
  gap: 4px;
  margin-top: 4px;
  max-height: 240px;
  overflow: auto;
  padding: 8px;
  z-index: 30;
}
.option-dropdown.is-open {
  display: grid;
}
.option-dropdown[hidden] {
  display: none !important;
}
.option-dropdown__item {
  align-items: start;
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  display: grid;
  font: inherit;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 40px;
  padding: 9px 10px;
  text-align: left;
  width: 100%;
}
.option-dropdown__text {
  display: block;
  line-height: 1.35;
  min-width: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.option-dropdown__item:hover {
  background: rgba(93, 214, 255, 0.1);
}
.option-dropdown__remove {
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 999px;
  color: var(--bad);
  font-size: 12px;
  font-weight: 800;
  padding: 3px 8px;
  white-space: nowrap;
}
.option-dropdown__remove:hover {
  background: rgba(255, 107, 107, 0.15);
}
.option-dropdown__locked,
.option-dropdown__empty {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.option-dropdown__empty {
  padding: 8px 10px;
}
.chip {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 4px 4px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  max-width: 100%;
}
.chip__text {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 360px;
}
.chip__remove {
  background: transparent;
  border: none;
  color: var(--bad);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 8px;
  border-radius: 999px;
}
.chip__remove:hover { background: rgba(255,107,107,0.15); }
.chip--removable { cursor: pointer; }
.chip--removable:hover {
  background: rgba(255,107,107,0.1);
  border-color: rgba(255,107,107,0.45);
}
.chip--empty { opacity: 0.65; }

.empty {
  color: var(--muted);
  text-align: center;
  padding: 14px 0;
  font-size: 13px;
}

td.num, th.num { text-align: right; white-space: nowrap; }
.cell-strong { font-weight: 700; }

@media (max-width: 760px) {
  .form-grid { grid-template-columns: 1fr; }
  .control--span2 { grid-column: span 1; }
  .panel__header { flex-wrap: wrap; }
}

/* ===== Executive dashboard + chatbot ===== */
.exec-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) min(360px, 34vw);
  gap: 16px;
  align-items: start;
}

.exec-main {
  min-width: 0;
}

.cards--exec {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.exec-chat {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
}

.exec-chat__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 420px;
  max-height: calc(100vh - 180px);
}

.exec-chat__messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px;
  min-height: 200px;
}

.exec-chat__msg {
  display: flex;
}

.exec-chat__msg--user {
  justify-content: flex-end;
}

.exec-chat__msg--bot {
  justify-content: flex-start;
}

.exec-chat__bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.exec-chat__msg--user .exec-chat__bubble {
  background: linear-gradient(180deg, rgba(93, 214, 255, 0.35), rgba(93, 214, 255, 0.15));
  border: 1px solid rgba(93, 214, 255, 0.45);
}

.exec-chat__msg--bot .exec-chat__bubble {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
}

.exec-chat__suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.exec-chat__chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}

.exec-chat__chip:hover {
  color: var(--text);
  border-color: rgba(93, 214, 255, 0.45);
}

.exec-chat__form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.exec-chat__input {
  min-width: 0 !important;
}

@media (max-width: 1100px) {
  .exec-layout {
    grid-template-columns: 1fr;
  }
  .exec-chat {
    position: static;
    max-height: none;
  }
  .exec-chat__body {
    max-height: 520px;
  }
  .cards--exec {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .cards--exec {
    grid-template-columns: 1fr;
  }
}

/* KPI year-over-year compare (admin dashboard) */
.controls--dashboard {
  align-items: flex-end;
}

.panel--chart {
  margin-bottom: 16px;
}

.chart-wrap,
.compare-chart-wrap {
  position: relative;
  height: 220px;
  margin-bottom: 14px;
}

.compare-chart-wrap {
  height: 240px;
}

.compare-table-wrap {
  max-height: 320px;
  overflow: auto;
}

.compare-table th,
.compare-table td {
  white-space: nowrap;
}

@media (max-width: 760px) {
  .controls--dashboard .control__input {
    min-width: 0;
  }
}

.clone-year-options {
  display: grid;
  gap: 8px;
}

.clone-year-option {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.th-check,
.td-check {
  width: 36px;
  text-align: center;
  vertical-align: middle;
}

.th-check input,
.td-check input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

