:root {
  --bg-top: #061322;
  --bg-bottom: #102037;
  --panel: rgba(8, 24, 40, 0.84);
  --panel-soft: rgba(10, 29, 48, 0.72);
  --line: rgba(136, 180, 223, 0.24);
  --line-strong: rgba(174, 209, 245, 0.38);
  --text: #e8f3ff;
  --muted: #9cb7d2;
  --accent: #35e7c6;
  --accent-2: #6fd7ff;
  --accent-dark: #01232f;
  --warn: #ffd4da;
  --warn-bg: rgba(126, 10, 29, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(980px 560px at 8% 0%, rgba(32, 103, 168, 0.42), transparent),
    radial-gradient(860px 500px at 96% 8%, rgba(55, 152, 140, 0.36), transparent),
    linear-gradient(145deg, var(--bg-top), var(--bg-bottom));
}

.shell {
  width: min(1220px, 94vw);
  margin: 26px auto 38px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  backdrop-filter: blur(8px);
  box-shadow: 0 22px 56px rgba(0, 0, 0, 0.33);
}

.workspace-nav {
  margin-bottom: 14px;
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.workspace-link {
  border: 1px solid rgba(145, 190, 235, 0.32);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
  background: rgba(7, 20, 34, 0.55);
  transition: border-color 0.2s ease, transform 0.15s ease, background 0.2s ease;
}

.workspace-link:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.workspace-link.active {
  border-color: rgba(53, 231, 198, 0.65);
  background: linear-gradient(120deg, rgba(53, 231, 198, 0.2), rgba(111, 215, 255, 0.18));
}

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

.module-card {
  padding: 20px;
  min-height: 148px;
}

.module-card h2 {
  margin: 0 0 8px;
}

.workspace-context {
  margin-bottom: 14px;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
}

.workspace-context-item {
  border: 1px solid rgba(136, 180, 223, 0.2);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(10, 29, 48, 0.56);
}

.workspace-context-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
}

.workspace-context-value {
  display: block;
  margin-top: 4px;
  font-size: 0.95rem;
}

.workspace-context-actions {
  display: flex;
  justify-content: flex-end;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.tag {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.9rem, 2.7vw, 2.7rem);
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 720px;
}

.top-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.top-meta-auth {
  align-items: center;
}

.logout-form {
  margin: 0;
}

.meta-pill {
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel-soft);
  color: #d6e9ff;
  font-size: 0.82rem;
}

.errors {
  margin-bottom: 16px;
  border: 1px solid rgba(255, 132, 149, 0.45);
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--warn-bg);
}

.errors p {
  margin: 6px 0;
  color: var(--warn);
}

.profile-bar {
  margin-bottom: 14px;
  padding: 18px;
}

.quick-start {
  margin-bottom: 14px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(13, 34, 56, 0.9), rgba(7, 20, 34, 0.84));
}

.quick-start-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.quick-start-head h2 {
  margin: 0;
}

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

.quick-step {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 11px;
  background: rgba(8, 24, 40, 0.72);
}

.quick-step strong {
  display: block;
  font-size: 0.9rem;
}

.quick-step p {
  margin: 6px 0 10px;
  font-size: 0.82rem;
  color: var(--muted);
  min-height: 32px;
}

.quick-step.ok {
  border-color: rgba(100, 219, 180, 0.65);
  box-shadow: inset 0 0 0 1px rgba(100, 219, 180, 0.18);
}

.quick-step.bad {
  border-color: rgba(255, 137, 154, 0.5);
}

.assistant-mini {
  margin-bottom: 14px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(10, 30, 49, 0.92), rgba(8, 23, 38, 0.86));
}

.assistant-mini-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.assistant-mini-head h2 {
  margin: 0;
}

.assistant-mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.assistant-mini-grid .full {
  grid-column: 1 / -1;
}

.assistant-mini-cols {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.assistant-mini-cols h3 {
  margin: 0 0 6px;
  font-size: 0.92rem;
  color: #d9eeff;
}

.assistant-details {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.assistant-details summary {
  cursor: pointer;
  font-weight: 700;
  color: #dbedff;
}

.assistant-list {
  display: grid;
  gap: 7px;
}

.assistant-item {
  border: 1px solid rgba(136, 180, 223, 0.22);
  border-radius: 10px;
  padding: 8px 9px;
  background: rgba(7, 20, 34, 0.46);
  font-size: 0.82rem;
  line-height: 1.35;
}

.assistant-subitem {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(136, 180, 223, 0.18);
}

@media (max-width: 980px) {
  .assistant-mini-grid {
    grid-template-columns: 1fr;
  }

  .assistant-mini-cols {
    grid-template-columns: 1fr;
  }
}

/* Dashboard-inspired (Dashboard.pdf) light corporate theme */
:root {
  --bg-top: #f5f7fc;
  --bg-bottom: #eef2fb;
  --panel: #ffffff;
  --panel-soft: #ffffff;
  --line: #e5ebfb;
  --line-strong: #d6dff7;
  --text: #1b2337;
  --muted: #7783a3;
  --accent: #ff9f1a;
  --accent-2: #5b6fff;
  --accent-dark: #0d1246;
  --warn: #a93245;
  --warn-bg: #fff3f5;
}

body {
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

.shell {
  width: min(1260px, 95vw);
  margin: 18px auto 24px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  backdrop-filter: none;
  box-shadow: 0 8px 24px rgba(21, 44, 105, 0.06);
}

.topbar {
  margin-bottom: 14px;
}

.tag {
  color: var(--accent);
}

h1 {
  color: #131b2d;
}

.subtitle,
.hint,
.workspace-context-label {
  color: var(--muted);
}

.workspace-nav {
  background: #0f1450;
  border-radius: 14px;
  border: none;
  padding: 10px;
}

.workspace-link {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: #dfe6ff;
}

.workspace-link.active {
  border-color: rgba(255, 184, 64, 0.7);
  background: linear-gradient(120deg, rgba(255, 159, 26, 0.28), rgba(255, 175, 83, 0.18));
  color: #fff;
}

.workspace-context {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.workspace-context-item {
  background: #f8faff;
  border: 1px solid #e7edff;
}

.meta-pill {
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #3d4a6b;
}

.guide {
  background: #fff;
}

.guide-content li {
  color: #394764;
}

input,
select,
textarea {
  background: #fff;
  color: #1b2337;
  border: 1px solid #d7e0f7;
  border-radius: 12px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #9db1ff;
  box-shadow: 0 0 0 3px rgba(91, 111, 255, 0.14);
}

button,
.start-btn,
.ghost-btn {
  border-radius: 12px;
}

.start-btn {
  background: linear-gradient(135deg, #4f63ff, #6a79ff);
  color: #fff;
  border: none;
}

.ghost-btn {
  border: 1px solid #d6def7;
  background: #fff;
  color: #243155;
}

.ghost-btn:hover {
  border-color: #b6c5f5;
  background: #f7f9ff;
}

.assistant-mini {
  background: #fff;
}

.assistant-mini .assistant-item {
  background: #f8faff;
  border-color: #e5ebfb;
  color: #223154;
}

.assistant-details summary,
.assistant-mini-cols h3 {
  color: #1f2a48;
}

/* Prototype adaptation (Settings/Reports/Sales Plan/Unit Economics) */
body {
  background: #f4f6fb !important;
  color: #17233b !important;
}

.shell {
  width: min(1600px, 98vw) !important;
  margin: 0 auto !important;
  padding: 18px 0 24px;
  position: relative;
}

.shell > *:not(.workspace-sidebar) {
  margin-left: 276px;
}

.workspace-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 240px;
  background: #0e1250;
  border-radius: 0 16px 16px 0;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.ws-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 800;
  font-size: 28px;
  margin: 10px 8px 24px;
}

.ws-brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ffb32b, #ff951f);
}

.ws-nav {
  display: grid;
  gap: 6px;
}

.ws-link {
  appearance: none;
  width: 100%;
  border: none;
  text-align: left;
  text-decoration: none;
  color: #c9d4f5;
  background: transparent;
  border-radius: 10px;
  padding: 10px 10px;
  display: flex;
  align-items: center;
  gap: 0;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  line-height: 1.1;
  cursor: pointer;
}

.ws-link:hover {
  background: rgba(255, 255, 255, 0.08);
}

.ws-link.active {
  color: #ffac2f;
  background: rgba(255, 172, 47, 0.09);
}

.ws-ico {
  font-size: 12px;
  opacity: 0.9;
}

.ws-bottom {
  margin-top: auto;
  display: grid;
  gap: 6px;
}

.ws-subtle {
  color: #8f9dc7;
}

.ws-logout {
  color: #ffac2f;
}

.workspace-context {
  display: none !important;
}

.topbar {
  margin: 0 0 16px !important;
  padding-top: 6px;
}

.top-meta {
  gap: 10px;
}

.meta-pill {
  background: #fff !important;
  color: #4e5f84 !important;
  border: 1px solid #dfe7fb !important;
}

.card {
  background: #fff !important;
  border: 1px solid #e6ecfb !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 18px rgba(21, 49, 115, 0.05) !important;
}

.quick-start {
  background: #fff !important;
}

.quick-steps {
  gap: 8px;
}

.quick-step {
  background: #505a6f !important;
  border: 1px solid #677189 !important;
  color: #eef3ff !important;
}

.quick-step p {
  color: #dce5ff !important;
}

label span {
  color: #66789e !important;
}

input,
select,
textarea {
  border: 1px solid #d8e2fa !important;
  border-radius: 8px !important;
  background: #fff !important;
  color: #1c2a46 !important;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #95a9f7 !important;
  box-shadow: 0 0 0 3px rgba(99, 116, 233, 0.12);
}

.tasks-table th {
  background: #1b324d !important;
  color: #dbe9ff !important;
}

.tasks-table td {
  color: #2f4267 !important;
}

.start-btn {
  background: linear-gradient(90deg, #ff9f1a, #5e6fff) !important;
}

.ghost-btn {
  background: #59657d !important;
  color: #eff4ff !important;
  border: none !important;
}

.ghost-btn:hover {
  background: #4b5670 !important;
}

.assistant-mini {
  display: block !important;
}

@media (max-width: 1100px) {
  .workspace-sidebar {
    position: static;
    width: auto;
    border-radius: 12px;
    margin: 0 12px 12px;
  }

  .shell > *:not(.workspace-sidebar) {
    margin-left: 0;
  }

  .ws-bottom {
    margin-top: 10px;
  }
}

.guide {
  margin-bottom: 14px;
  padding: 14px 18px;
  background: var(--panel-soft);
}

.guide details {
  width: 100%;
}

.guide summary {
  cursor: pointer;
  list-style: none;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.02rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.guide summary::-webkit-details-marker {
  display: none;
}

.guide summary::after {
  content: "Открыть";
  font-family: "Manrope", sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.guide details[open] summary::after {
  content: "Скрыть";
}

.guide-content {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.guide-content h3 {
  margin: 0 0 8px;
  font-size: 0.98rem;
}

.guide-content p {
  margin: 8px 0;
}

.guide-content ol,
.guide-content ul {
  margin: 6px 0 12px 18px;
  padding: 0;
}

.guide-content li {
  margin: 4px 0;
  color: #d7e7f8;
}

.profile-grid {
  display: grid;
  grid-template-columns: 0.8fr 1.1fr 1.2fr auto;
  gap: 12px;
  align-items: end;
}

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

.profile-field span,
label span {
  display: block;
  margin: 0 0 7px;
  font-size: 0.85rem;
  color: var(--muted);
}

.profile-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.full {
  grid-column: 1 / -1;
}

.panel,
.actions {
  padding: 20px;
}

h2 {
  margin: 0 0 14px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.12rem;
}

.fields {
  display: grid;
  gap: 12px;
}

.fields.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: block;
}

input,
select {
  width: 100%;
  border-radius: 11px;
  border: 1px solid rgba(145, 190, 235, 0.34);
  padding: 11px 12px;
  color: var(--text);
  background: rgba(7, 20, 34, 0.72);
  outline: none;
  font-size: 0.94rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(53, 231, 198, 0.18);
  background: rgba(9, 26, 43, 0.86);
}

input[type="file"] {
  padding: 8px;
}

.inline-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.ghost-btn {
  border: 1px solid rgba(145, 190, 235, 0.5);
  border-radius: 12px;
  padding: 10px 14px;
  background: rgba(7, 20, 34, 0.7);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  transition: border-color 0.2s ease, transform 0.15s ease, background 0.2s ease;
}

.ghost-btn:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.ghost-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.danger-btn {
  border-color: rgba(255, 111, 126, 0.55);
}

.start-btn {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 15px 18px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  color: var(--accent-dark);
  cursor: pointer;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 14px 26px rgba(53, 231, 198, 0.32);
}

.cancel-btn {
  width: 100%;
  margin-top: 10px;
}

.start-btn:hover {
  transform: translateY(-1px);
}

.start-btn:disabled {
  opacity: 0.75;
  cursor: wait;
}

.hint,
.status-text {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.jobs {
  margin-top: 14px;
  padding: 20px;
}

.jobs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.jobs-head-actions {
  display: flex;
  gap: 8px;
}

.jobs-head h2 {
  margin: 0;
}

.jobs-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.jobs-table-wrap.collapsed {
  display: none;
}

.jobs-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

.jobs-table th,
.jobs-table td {
  border-bottom: 1px solid rgba(136, 180, 223, 0.16);
  padding: 10px 12px;
  text-align: left;
  font-size: 0.88rem;
  color: #dbe9f8;
}

.jobs-table th {
  color: var(--muted);
  font-weight: 700;
  background: rgba(8, 24, 40, 0.9);
}

.jobs-table tr:last-child td {
  border-bottom: 0;
}

.cabinets {
  margin-bottom: 14px;
  padding: 20px;
}

.cabinets-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.cabinets-head h2 {
  margin: 0;
}

.cabinets-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.cabinets-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.cabinets-table th,
.cabinets-table td {
  border-bottom: 1px solid rgba(136, 180, 223, 0.16);
  padding: 10px 12px;
  text-align: left;
  font-size: 0.88rem;
  color: #dbe9f8;
}

.cabinets-table th {
  color: var(--muted);
  font-weight: 700;
  background: rgba(8, 24, 40, 0.9);
}

.cabinets-table tr:last-child td {
  border-bottom: 0;
}

.qa {
  margin-top: 14px;
  padding: 20px;
}

.qa-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.qa-head h2 {
  margin: 0;
}

.qa-subhead {
  margin: 12px 0 6px;
  font-size: 0.95rem;
  color: var(--muted);
  font-weight: 700;
}


.qa-form {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 0.6fr auto;
  gap: 10px;
  align-items: end;
}

.qa-kpi-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px;
}

.qa-kpi-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(10, 31, 52, 0.86), rgba(7, 20, 34, 0.78));
}

.qa-kpi-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.qa-kpi-value {
  margin: 8px 0 0;
  color: #dbe9f8;
  font-size: 1.1rem;
  font-weight: 700;
}

.qa-kpi-value.ok {
  color: #bdebdc;
}

.qa-kpi-value.bad {
  color: #ffd2d8;
}

.qa-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 8px;
}

.qa-table-wrap.compact {
  max-height: 290px;
  overflow: auto;
}

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

.qa-table th,
.qa-table td {
  border-bottom: 1px solid rgba(136, 180, 223, 0.16);
  padding: 10px 12px;
  text-align: left;
  font-size: 0.88rem;
  color: #dbe9f8;
}

.qa-table-wrap.compact .qa-table th,
.qa-table-wrap.compact .qa-table td {
  padding: 7px 10px;
  font-size: 0.83rem;
}

.qa-table th {
  color: var(--muted);
  font-weight: 700;
  background: rgba(8, 24, 40, 0.9);
}

.qa-table tr:last-child td {
  border-bottom: 0;
}

.qa-delta-bad {
  color: #ffd2d8;
}

.qa-delta-ok {
  color: #bdebdc;
}

.users {
  margin-top: 14px;
  padding: 20px;
}

.users-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.users-head h2 {
  margin: 0;
}

.users-form {
  display: grid;
  grid-template-columns: 1.5fr 1fr 0.8fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.users-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.users-table th,
.users-table td {
  border-bottom: 1px solid rgba(136, 180, 223, 0.16);
  padding: 10px 12px;
  text-align: left;
  font-size: 0.88rem;
  color: #dbe9f8;
}

.users-table th {
  color: var(--muted);
  font-weight: 700;
  background: rgba(8, 24, 40, 0.9);
}

.users-table tr:last-child td {
  border-bottom: 0;
}

.tasks-card {
  margin-bottom: 14px;
  padding: 20px;
}

.tasks-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.tasks-head h2 {
  margin: 0;
}

.tasks-head-actions {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.tasks-form {
  display: grid;
  grid-template-columns: 2fr 1fr 0.8fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.tasks-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.tasks-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.tasks-table th,
.tasks-table td {
  border-bottom: 1px solid rgba(136, 180, 223, 0.16);
  padding: 10px 12px;
  text-align: left;
  font-size: 0.88rem;
  color: #dbe9f8;
}

.tasks-table th {
  color: var(--muted);
  font-weight: 700;
  background: rgba(8, 24, 40, 0.9);
}

.tasks-table tr:last-child td {
  border-bottom: 0;
}

.task-inline-input,
.task-inline-select {
  min-width: 130px;
  padding: 8px 9px;
  font-size: 0.85rem;
  border-radius: 9px;
}

.json-preview {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: rgba(6, 18, 30, 0.7);
  color: #dbe9f8;
  max-height: 420px;
  overflow: auto;
  font-size: 0.84rem;
  line-height: 1.45;
}

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

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

.matrix-input {
  width: 110px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 0.82rem;
}

.matrix-calc {
  background: rgba(18, 40, 63, 0.6);
}

.matrix-input-row {
  font-weight: 700;
}

.matrix-calc-row {
  font-weight: 700;
  color: #b7d1ea;
}

.matrix-section-row td {
  background: rgba(16, 49, 78, 0.75);
  color: #dff1ff;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-card {
  width: min(520px, 94vw);
  padding: 26px;
}

.auth-form {
  display: grid;
  gap: 12px;
}

a {
  color: var(--accent-2);
}

@media (max-width: 980px) {
  .quick-steps {
    grid-template-columns: 1fr 1fr;
  }

  .workspace-context {
    grid-template-columns: 1fr;
  }

  .workspace-context-actions {
    justify-content: flex-start;
  }

  .module-grid {
    grid-template-columns: 1fr;
  }

  .dash-chart-grid {
    grid-template-columns: 1fr;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .profile-grid {
    grid-template-columns: 1fr;
  }

  .fields.two {
    grid-template-columns: 1fr;
  }

  .users-form {
    grid-template-columns: 1fr;
  }

  .tasks-form {
    grid-template-columns: 1fr;
  }

  .tasks-head {
    flex-direction: column;
    align-items: stretch;
  }

  .tasks-head-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .qa-form {
    grid-template-columns: 1fr;
  }

  .qa-kpi-grid {
    grid-template-columns: 1fr 1fr;
  }


  .topbar {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .quick-steps {
    grid-template-columns: 1fr;
  }

  .qa-kpi-grid {
    grid-template-columns: 1fr;
  }
}

/* Pixel-pass final overrides (based on provided PDF prototypes) */
:root {
  --pp-bg: #f3f5fb;
  --pp-surface: #ffffff;
  --pp-text: #1d2b47;
  --pp-muted: #7383a8;
  --pp-line: #e2e8f8;
  --pp-nav: #0f1252;
  --pp-nav-muted: #95a2cc;
  --pp-nav-active: #ffab2f;
  --pp-field: #556378;
  --pp-th: #1a324d;
}

body {
  font-family: "Manrope", "Segoe UI", sans-serif !important;
  font-size: 14px !important;
  line-height: 1.35 !important;
  background: var(--pp-bg) !important;
  color: var(--pp-text) !important;
}

.shell {
  width: min(1600px, 98vw) !important;
  margin: 0 auto !important;
  padding: 16px 0 28px !important;
}

.shell > *:not(.workspace-sidebar) {
  margin-left: 276px !important;
}

.workspace-sidebar {
  width: 240px !important;
  background: var(--pp-nav) !important;
  border-radius: 0 16px 16px 0 !important;
  padding: 22px 14px !important;
}

.ws-brand {
  margin: 12px 8px 28px !important;
  font-size: 33px !important;
  line-height: 1 !important;
  font-weight: 800 !important;
  letter-spacing: 0.01em !important;
}

.ws-brand-mark {
  width: 40px !important;
  height: 40px !important;
  border-radius: 13px !important;
}

.ws-nav {
  gap: 7px !important;
}

.ws-link {
  min-height: 42px !important;
  border-radius: 10px !important;
  padding: 10px 11px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  color: var(--pp-nav-muted) !important;
  white-space: nowrap !important;
  line-height: 1.1 !important;
}

.ws-link.active {
  color: var(--pp-nav-active) !important;
  background: rgba(255, 171, 47, 0.12) !important;
}

.ws-subtle {
  color: #95a2cc !important;
}

.ws-logout {
  color: var(--pp-nav-active) !important;
}

.ws-ico {
  font-size: 10px !important;
}

.workspace-context {
  display: none !important;
}

.topbar {
  margin: 2px 0 12px !important;
  align-items: center !important;
}

.topbar .tag {
  display: none !important;
}

.topbar h1 {
  margin: 0 !important;
  color: #1a243b !important;
  font-size: 42px !important;
  line-height: 1.06 !important;
  font-weight: 700 !important;
}

.topbar .subtitle {
  display: none !important;
}

.top-meta {
  gap: 8px !important;
}

.meta-pill {
  padding: 8px 12px !important;
  font-size: 12px !important;
  border: 1px solid var(--pp-line) !important;
  background: #fff !important;
  color: #4e5f84 !important;
}

.card {
  background: var(--pp-surface) !important;
  border: 1px solid var(--pp-line) !important;
  border-radius: 10px !important;
  box-shadow: none !important;
}

.quick-start,
.profile-bar,
.cabinets,
.guide,
.users,
.jobs,
.qa,
.tasks-card {
  padding: 10px 12px !important;
  margin-bottom: 8px !important;
}

.quick-start-head,
.tasks-head,
.users-head,
.cabinets-head,
.jobs-head,
.qa-head {
  margin-bottom: 7px !important;
}

.quick-start h2,
.tasks-head h2,
.users-head h2,
.cabinets-head h2,
.jobs-head h2,
.qa-head h2 {
  font-size: 14px !important;
  line-height: 1.2 !important;
  font-weight: 700 !important;
  color: #24344f !important;
}

.quick-steps {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

.quick-step {
  border-radius: 8px !important;
  border: 1px solid #637088 !important;
  background: var(--pp-field) !important;
  padding: 8px 9px !important;
}

.quick-step strong {
  font-size: 12px !important;
  color: #f4f7ff !important;
}

.quick-step p {
  margin: 5px 0 8px !important;
  font-size: 11px !important;
  line-height: 1.25 !important;
  color: #d8e1f7 !important;
  min-height: 32px !important;
}

label span,
.profile-field span {
  font-size: 11px !important;
  line-height: 1.2 !important;
  color: #7383a8 !important;
  margin-bottom: 4px !important;
}

input,
select,
textarea {
  height: 33px !important;
  padding: 6px 9px !important;
  border-radius: 8px !important;
  border: 1px solid #d9e2fa !important;
  background: #fff !important;
  color: #202d48 !important;
  font-size: 12px !important;
}

textarea {
  min-height: 78px !important;
  height: auto !important;
}

.tasks-form,
.profile-grid,
.users-form {
  gap: 8px !important;
}

button,
.ghost-btn,
.start-btn {
  min-height: 33px !important;
  padding: 6px 11px !important;
  border-radius: 9px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
}

.ghost-btn {
  background: #5b677f !important;
  color: #edf3ff !important;
  border: none !important;
}

.start-btn {
  border: none !important;
  background: linear-gradient(90deg, #ff9f1a, #5d6eff) !important;
  color: #fff !important;
}

.tasks-table-wrap,
.users-table-wrap,
.qa-table-wrap,
.jobs-table-wrap,
.cabinets-table-wrap {
  border-radius: 8px !important;
  border: 1px solid var(--pp-line) !important;
}

.tasks-table th,
.users-table th,
.qa-table th,
.jobs-table th,
.cabinets-table th {
  background: var(--pp-th) !important;
  color: #dce8fb !important;
  font-size: 11px !important;
  padding: 7px 9px !important;
}

.tasks-table td,
.users-table td,
.qa-table td,
.jobs-table td,
.cabinets-table td {
  color: #314667 !important;
  font-size: 12px !important;
  padding: 7px 9px !important;
  border-bottom: 1px solid #e9eefc !important;
}

.tasks-table tbody tr:hover,
.users-table tbody tr:hover,
.jobs-table tbody tr:hover,
.cabinets-table tbody tr:hover {
  background: #f7faff;
}

.hint,
p.hint {
  color: #8a98b8 !important;
  font-size: 11px !important;
}

#report-actions {
  padding-top: 8px !important;
}

/* Sales plan internal blocks (override inline template styles) */
.v3-week-card {
  background: #5a667d !important;
  border: 1px solid #6a7691 !important;
  border-radius: 9px !important;
  padding: 8px !important;
}

.v3-week-title {
  color: #e4ecff !important;
  font-size: 12px !important;
}

.v3-week-table th,
.v3-week-table td {
  font-size: 11px !important;
  padding: 5px 7px !important;
}

/* Unit-economics modal/table */
.ue-modal-card {
  border-radius: 10px !important;
}

/* Keep assistant visually neutral on reports page (can be shown later by feature flag) */
.assistant-mini {
  display: block !important;
}

@media (max-width: 1180px) {
  .workspace-sidebar {
    position: static !important;
    width: auto !important;
    margin: 0 10px 10px !important;
    border-radius: 12px !important;
  }
  .shell > *:not(.workspace-sidebar) {
    margin-left: 0 !important;
  }
  .topbar h1 {
    font-size: 32px !important;
  }
}

/* Minimal glass theme refresh (2026-03) */
@font-face {
  font-family: "Benzin-Bold";
  src:
    local("Benzin Bold"),
    local("Benzin-Bold"),
    url("/static/fonts/Benzin-Bold.woff2") format("woff2"),
    url("/static/fonts/Benzin-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --glass-bg: #e8edf4;
  --glass-surface: rgba(255, 255, 255, 0.56);
  --glass-surface-strong: rgba(255, 255, 255, 0.72);
  --glass-line: rgba(255, 255, 255, 0.64);
  --glass-shadow: 0 18px 50px rgba(26, 45, 75, 0.12);
  --glass-text: #1f2d45;
  --glass-muted: #667793;
  --glass-brand: #202b6d;
  --glass-accent: #334a8a;
  --glass-active: rgba(43, 63, 110, 0.14);
}

body {
  background:
    radial-gradient(960px 440px at -10% -10%, rgba(255, 255, 255, 0.55), transparent 60%),
    radial-gradient(800px 420px at 105% 6%, rgba(210, 220, 238, 0.45), transparent 55%),
    linear-gradient(180deg, #eef2f8 0%, var(--glass-bg) 100%) !important;
  color: var(--glass-text) !important;
  font-family: "Manrope", "Segoe UI", sans-serif !important;
}

.shell {
  width: min(1560px, 97vw) !important;
  padding: 18px 0 30px !important;
}

.shell > *:not(.workspace-sidebar) {
  margin-left: 286px !important;
}

.workspace-sidebar {
  width: 250px !important;
  top: 18px !important;
  left: 18px !important;
  bottom: 18px !important;
  border-radius: 18px !important;
  border: 1px solid var(--glass-line) !important;
  background: var(--glass-surface) !important;
  backdrop-filter: blur(20px) saturate(130%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(130%) !important;
  box-shadow: var(--glass-shadow) !important;
}

.ws-brand {
  margin: 10px 6px 24px !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

.ws-brand span {
  font-family: "Benzin-Bold", "Manrope", sans-serif !important;
  font-size: 16px !important;
  line-height: 1.06 !important;
  letter-spacing: 0.03em !important;
  color: var(--glass-brand) !important;
}

.ws-brand-logo {
  display: block !important;
  width: 100% !important;
  max-width: 250px !important;
  height: auto !important;
}

.ws-brand-mark {
  width: 32px !important;
  height: 32px !important;
  border-radius: 11px !important;
  background: linear-gradient(150deg, #304a8f, #23356f) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 8px 16px rgba(35, 53, 111, 0.28) !important;
}

.ws-link {
  min-height: 40px !important;
  border-radius: 10px !important;
  color: #2b3a56 !important;
  font-weight: 600 !important;
  background: transparent !important;
}

.ws-link.active {
  background: var(--glass-active) !important;
  color: var(--glass-brand) !important;
  box-shadow: inset 0 0 0 1px rgba(49, 72, 129, 0.22) !important;
}

.ws-subtle,
.ws-logout {
  color: var(--glass-accent) !important;
}

.topbar h1 {
  color: #1b2c49 !important;
  font-family: "Benzin-Bold", "Manrope", sans-serif !important;
  font-size: clamp(34px, 3.2vw, 52px) !important;
  letter-spacing: 0.01em !important;
}

.meta-pill,
.card,
.quick-step,
.workspace-link {
  border: 1px solid var(--glass-line) !important;
  background: var(--glass-surface) !important;
  backdrop-filter: blur(16px) saturate(120%) !important;
  -webkit-backdrop-filter: blur(16px) saturate(120%) !important;
  box-shadow: var(--glass-shadow) !important;
}

.card {
  border-radius: 14px !important;
}

.quick-step {
  border-radius: 12px !important;
  color: var(--glass-text) !important;
}

.quick-step strong {
  color: #203258 !important;
}

.quick-step p,
.hint,
p.hint {
  color: var(--glass-muted) !important;
}

.ghost-btn,
.start-btn,
button {
  border-radius: 10px !important;
}

.ghost-btn {
  background: rgba(48, 69, 118, 0.16) !important;
  color: #263a66 !important;
  border: 1px solid rgba(48, 69, 118, 0.24) !important;
}

.start-btn {
  background: linear-gradient(135deg, #2f437f 0%, #5167a5 100%) !important;
  color: #f4f8ff !important;
  border: 1px solid rgba(255, 255, 255, 0.42) !important;
}

.tasks-table th,
.users-table th,
.qa-table th,
.jobs-table th,
.cabinets-table th {
  background: linear-gradient(135deg, #2b3f73, #31497f) !important;
  color: #eaf0ff !important;
}

.tasks-table td,
.users-table td,
.qa-table td,
.jobs-table td,
.cabinets-table td {
  color: #2a3c5d !important;
}

@media (max-width: 1180px) {
  .workspace-sidebar {
    margin: 0 10px 12px !important;
    border-radius: 14px !important;
    top: 0 !important;
    left: 0 !important;
    bottom: auto !important;
  }
  .shell > *:not(.workspace-sidebar) {
    margin-left: 0 !important;
  }
}

/* Button hover readability */
.ghost-btn:hover,
.ghost-btn:focus-visible {
  background: rgba(88, 112, 166, 0.24) !important;
  border-color: rgba(52, 76, 128, 0.52) !important;
  color: #1c2f56 !important;
}

.start-btn:hover,
.start-btn:focus-visible {
  background: linear-gradient(135deg, #2c3f77 0%, #4b62a0 100%) !important;
  color: #f7fbff !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
}

.ghost-btn:disabled:hover,
.start-btn:disabled:hover {
  color: inherit !important;
}

/* QA KPI cards brand color + readable text */
.qa-kpi-card {
  background: linear-gradient(135deg, #2b3f73 0%, #31497f 100%) !important;
  border: 1px solid rgba(218, 228, 255, 0.24) !important;
}

.qa-kpi-label {
  color: #cfd9ff !important;
}

.qa-kpi-value {
  color: #f4f7ff !important;
}

.qa-kpi-value.ok {
  color: #c7ffe3 !important;
}

.qa-kpi-value.bad {
  color: #ffd7df !important;
}

.pnl-controls {
  display: grid;
  grid-template-columns: minmax(140px, 180px) minmax(240px, 1fr) minmax(260px, 360px);
  gap: 12px;
  align-items: end;
  margin: 14px 0;
}

.pnl-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.82rem;
}

.pnl-controls input {
  width: 100%;
  border: 1px solid rgba(104, 133, 181, 0.32);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
}

.pnl-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(104, 133, 181, 0.32);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.86);
  color: #263b5f;
  font-weight: 700;
}

.pnl-inline-check input {
  width: auto;
  margin: 0;
  accent-color: #284d89;
}

#pnl-article-label,
#pnl-category-label {
  grid-column: 1 / -1;
}

.pnl-article-note {
  margin: -4px 0 14px;
  padding: 10px 12px;
  border: 1px solid rgba(217, 119, 6, 0.22);
  border-radius: 12px;
  background: rgba(255, 247, 237, 0.72);
  color: #76511d;
}

.pnl-controls select,
.pnl-chart-head select,
.pnl-event-form select,
.pnl-event-form input,
.pnl-event-form textarea {
  width: 100%;
  border: 1px solid #c7d4e8;
  border-radius: 10px;
  background: #fff;
  color: #203454;
  padding: 9px 11px;
  font: inherit;
}

.pnl-article-combobox {
  position: relative;
}

.pnl-article-combobox input {
  min-width: min(620px, 72vw);
}

.pnl-article-results {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  width: min(720px, 82vw);
  max-height: 330px;
  overflow: auto;
  padding: 6px;
  border: 1px solid #bdcce2;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(28, 54, 94, .2);
}

.pnl-article-option {
  display: grid;
  width: 100%;
  gap: 3px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #203657;
  text-align: left;
  cursor: pointer;
}

.pnl-article-option:hover,
.pnl-article-option:focus-visible {
  outline: none;
  background: #e8f0fb;
}

.pnl-article-option strong,
.pnl-article-option small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pnl-article-option small,
.pnl-article-empty {
  color: #7487a5;
}

.pnl-article-empty {
  padding: 12px;
}

.pnl-category-card {
  margin-top: 18px;
}

.kpi-categories-page .kpi-category-topbar {
  align-items: center;
  margin-bottom: 14px;
  padding: 4px 2px 8px;
}

.kpi-categories-page .kpi-category-topbar h1 {
  margin: 0 0 6px !important;
  font-family: "Manrope", "Segoe UI", sans-serif !important;
  font-size: clamp(28px, 2.2vw, 38px) !important;
  line-height: 1.12 !important;
  letter-spacing: -0.02em !important;
  color: #1d2c49 !important;
}

.kpi-categories-page .kpi-category-topbar .tag {
  margin-bottom: 6px;
  color: #7c8dac;
  font-size: 12px;
  letter-spacing: .12em;
}

.kpi-categories-page .kpi-category-topbar .subtitle {
  max-width: 780px;
  margin: 0;
  color: #7182a2;
  font-size: 14px;
}

.kpi-categories-page .top-meta {
  align-self: flex-start;
  margin-top: 6px;
}

.kpi-categories-page .pnl-category-card {
  margin-top: 12px;
  padding: 16px !important;
  border-radius: 16px !important;
  background: rgba(248, 251, 255, .78) !important;
}

.kpi-categories-page .tasks-head {
  align-items: flex-start;
  margin-bottom: 12px;
}

.kpi-categories-page .tasks-head h2 {
  color: #1f3150;
  font-size: 18px;
}

.kpi-categories-page .tasks-head .hint {
  margin-top: 6px;
  font-size: 13px;
}

.pnl-category-form {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(160px, 220px) auto;
  gap: 12px;
  align-items: end;
  margin: 16px 0;
}

.pnl-category-form label,
.pnl-category-search-wrap label {
  display: grid;
  gap: 6px;
  color: #7384a2;
  font-size: 13px;
  font-weight: 700;
}

.pnl-category-form input,
.pnl-category-search-wrap input {
  width: 100%;
  border: 1px solid #c7d4e8;
  border-radius: 12px;
  background: rgba(255, 255, 255, .92);
  color: #203454;
  padding: 11px 13px;
  font: inherit;
}

.pnl-category-search-wrap {
  position: relative;
  margin-bottom: 16px;
}

.pnl-category-results {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  width: min(760px, 92vw);
  max-height: 360px;
  overflow: auto;
  padding: 6px;
  border: 1px solid #bdcce2;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 20px 46px rgba(28, 54, 94, .22);
}

.pnl-category-selected-block {
  padding: 14px;
  border: 1px solid rgba(104, 133, 181, .22);
  border-radius: 16px;
  background: rgba(238, 244, 252, .58);
}

.kpi-categories-page .pnl-category-selected-block {
  min-height: 128px;
  background: rgba(239, 245, 253, .72);
}

.kpi-categories-page .inline-actions {
  margin-top: 12px;
}

.compact-head {
  margin-bottom: 10px;
}

.pnl-category-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 46px;
}

.pnl-category-product-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(100%, 540px);
  padding: 8px 10px;
  border: 1px solid rgba(104, 133, 181, .25);
  border-radius: 999px;
  background: #fff;
  color: #28415f;
  font-size: 13px;
  font-weight: 700;
}

.pnl-category-product-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pnl-category-product-chip button {
  border: 0;
  background: transparent;
  color: #8a3141;
  cursor: pointer;
  font-weight: 900;
}

.pnl-category-list {
  display: grid;
  gap: 10px;
}

.pnl-category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(104, 133, 181, .24);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(240,246,254,.88));
}

.pnl-category-item strong {
  display: block;
  margin-bottom: 5px;
  color: #203657;
}

.pnl-category-preview {
  margin: 0;
  color: #6b7d9a;
  font-size: 13px;
}

.pnl-insight-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(300px, .7fr);
  gap: 14px;
  margin: 14px 0;
}

.pnl-chart-card,
.pnl-events-card {
  border: 1px solid #cfdaeb;
  border-radius: 18px;
  background: linear-gradient(145deg, #ffffff 0%, #f3f7fd 100%);
  box-shadow: 0 12px 30px rgba(36, 61, 101, .08);
  padding: 16px;
}

.pnl-chart-head,
.pnl-events-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.pnl-chart-head h3,
.pnl-events-head h3 {
  margin: 2px 0 0;
  color: #213657;
}

.pnl-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: -2px 0 12px;
}

.pnl-chart-legend[hidden] {
  display: none;
}

.pnl-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: min(100%, 360px);
  padding: 5px 9px;
  border: 1px solid rgba(104, 133, 181, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #314a70;
  font-size: 12px;
  font-weight: 700;
}

.pnl-chart-legend-swatch {
  width: 24px;
  height: 4px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.pnl-chart-legend-swatch.dashed {
  height: 0;
  background: transparent !important;
  border-top: 4px dashed currentColor;
}

.pnl-chart-head label span,
.pnl-event-form label span {
  display: block;
  color: #7083a2;
  font-size: 12px;
  margin-bottom: 5px;
}

.pnl-chart-wrap {
  position: relative;
  min-height: 330px;
  overflow: hidden;
  border-radius: 14px;
  background:
    linear-gradient(rgba(255,255,255,.84), rgba(255,255,255,.84)),
    repeating-linear-gradient(90deg, transparent 0 54px, #dce5f2 55px);
}

#pnl-chart {
  display: block;
  width: 100%;
  height: 330px;
}

.pnl-chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #7b8da8;
}

.pnl-chart-empty[hidden] {
  display: none;
}

.pnl-chart-tooltip {
  position: absolute;
  z-index: 5;
  min-width: 230px;
  max-width: 270px;
  padding: 10px 12px;
  border: 1px solid rgba(51, 78, 122, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 34px rgba(31, 54, 91, 0.18);
  color: #203657;
  pointer-events: none;
}

.pnl-chart-tooltip[hidden] {
  display: none;
}

.pnl-chart-tooltip-title {
  margin-bottom: 7px;
  color: #1f3760;
  font-weight: 800;
  line-height: 1.25;
}

.pnl-chart-tooltip-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-top: 4px;
  color: #6e819f;
  font-size: 12px;
}

.pnl-chart-tooltip-row strong {
  color: #203657;
  text-align: right;
}

.pnl-event-form {
  display: grid;
  gap: 10px;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: #eaf1fb;
}

.pnl-event-form-row {
  display: grid;
  grid-template-columns: 1fr 70px;
  gap: 10px;
}

.pnl-events-list {
  display: grid;
  gap: 8px;
  max-height: 330px;
  overflow: auto;
}

.pnl-event-form[hidden] {
  display: none;
}

.pnl-head-actions,
.pnl-selected-articles,
.pnl-event-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.pnl-selected-articles {
  margin-top: 8px;
}

.pnl-article-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 360px;
  border: 1px solid #bfd0e8;
  border-radius: 999px;
  background: #edf3fb;
  color: #294568;
  padding: 6px 9px 6px 11px;
  font-size: 12px;
}

.pnl-article-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pnl-article-chip button {
  border: 0;
  background: transparent;
  color: #8b4054;
  cursor: pointer;
}

.pnl-metric-picker {
  position: relative;
  width: min(420px, 48vw);
}

.pnl-picker-label {
  display: block;
  color: #7083a2;
  font-size: 12px;
  margin-bottom: 5px;
}

.pnl-metric-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 38px;
  border: 1px solid #c7d4e8;
  border-radius: 10px;
  background: #fff;
  color: #294568;
  padding: 7px 9px 7px 12px;
  cursor: pointer;
  text-align: left;
}

.pnl-metric-trigger-count {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #294f89;
  color: #fff;
  font-size: 12px;
}

.pnl-metric-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.pnl-metric-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 210px;
  border-radius: 999px;
  background: #edf3fb;
  color: #365377;
  padding: 4px 8px;
  font-size: 11px;
}

.pnl-metric-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pnl-metric-chip button {
  border: 0;
  background: transparent;
  color: #8b4054;
  cursor: pointer;
}

.pnl-metric-popover {
  position: absolute;
  z-index: 35;
  top: calc(100% + 7px);
  right: 0;
  width: min(430px, 80vw);
  padding: 9px;
  border: 1px solid #bdcce2;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(26, 53, 94, .22);
}

.pnl-metric-popover[hidden] {
  display: none;
}

.pnl-metric-popover input {
  width: 100%;
  border: 1px solid #c7d4e8;
  border-radius: 9px;
  padding: 8px 10px;
}

.pnl-metric-options {
  display: grid;
  gap: 2px;
  max-height: 270px;
  margin: 7px 0;
  overflow: auto;
}

.pnl-metric-option {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  align-items: center;
  border-radius: 8px;
  padding: 7px 8px;
  color: #304968;
  cursor: pointer;
}

.pnl-metric-option:hover {
  background: #edf3fb;
}

.pnl-metric-popover small {
  color: #7a8ba5;
}

.pnl-event-item {
  position: relative;
  padding: 12px 13px;
  border-left: 4px solid var(--event-color, #d97706);
  border-radius: 9px;
  background: #fff;
  color: #314767;
}

.pnl-event-item::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 17px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--event-color, #d97706);
  box-shadow: 0 0 0 4px #eef4fc;
}

.pnl-event-item strong,
.pnl-event-item small {
  display: block;
}

.pnl-event-item small {
  color: #7b8da8;
  margin: 3px 0;
}

.pnl-event-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.pnl-event-meta .category {
  border-radius: 999px;
  background: #edf3fb;
  padding: 2px 7px;
}

.pnl-event-action {
  border: 0;
  background: transparent;
  color: #526d94;
  cursor: pointer;
  padding: 4px 0;
  font-size: 12px;
}

.pnl-event-action.danger {
  color: #9a4960;
}

.dashboard-controls {
  grid-template-columns: 180px 1fr 1.4fr;
}

.dashboard-period-note {
  margin: 8px 0 0;
}

.dashboard-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.dashboard-chart-card {
  min-height: 360px;
  border: 1px solid #cfdaeb;
  border-radius: 18px;
  background: linear-gradient(145deg, #ffffff 0%, #f3f7fd 100%);
  box-shadow: 0 12px 30px rgba(36, 61, 101, .08);
  padding: 16px;
}

.dashboard-chart-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.dashboard-chart-head h3 {
  margin: 2px 0 0;
  color: #213657;
}

.dashboard-chart-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid #cfdaeb;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.dashboard-mode-btn {
  min-width: 38px;
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #31537a;
  font-weight: 900;
  cursor: pointer;
}

.dashboard-mode-btn.active {
  background: #2f4d86;
  color: #fff;
  box-shadow: 0 6px 16px rgba(35, 67, 120, .22);
}

.dashboard-card-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  margin: 0 0 10px;
}

.dashboard-card-controls label {
  display: grid;
  gap: 5px;
  color: #7184a0;
  font-size: 12px;
  font-weight: 800;
}

.dashboard-card-controls select {
  width: 100%;
  min-height: 36px;
  border: 1px solid #cbd8ec;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  color: #213657;
  padding: 7px 10px;
  font: inherit;
  font-weight: 700;
}

.dashboard-card-refresh {
  min-height: 36px;
  padding-inline: 14px;
}

.dashboard-file-actions {
  margin: 2px 0 10px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.dashboard-file-actions .ghost-btn {
  min-height: 32px;
}

.dashboard-source {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #edf3fb;
  color: #31537a;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.dashboard-source.pending {
  background: #fff3db;
  color: #9b5f0b;
}

.dashboard-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-height: 28px;
  margin-bottom: 8px;
}

.dashboard-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 5px 9px;
  border: 1px solid rgba(104, 133, 181, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #314a70;
  font-size: 12px;
  font-weight: 700;
}

.dashboard-legend-item i {
  width: 13px;
  height: 13px;
  border-radius: 4px;
}

.dashboard-chart-wrap {
  position: relative;
  min-height: 260px;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 14px;
  background:
    linear-gradient(rgba(255,255,255,.84), rgba(255,255,255,.84)),
    repeating-linear-gradient(90deg, transparent 0 54px, #dce5f2 55px);
  scrollbar-color: #c7d5ea transparent;
  scrollbar-width: thin;
}

.dashboard-chart-wrap svg {
  display: block;
  width: auto;
  min-width: 100%;
  max-width: none;
  height: 260px;
}

.dashboard-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  color: #7b8da8;
  text-align: center;
}

.dashboard-empty[hidden] {
  display: none;
}

.dashboard-chart-note {
  margin: 8px 0 0;
  color: #7184a0;
  font-size: 12px;
}

.dashboard-analysis {
  margin-top: 10px;
  border: 1px solid rgba(104, 133, 181, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
  color: #314a70;
  overflow: hidden;
}

.dashboard-analysis summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 10px 13px;
  cursor: pointer;
  list-style: none;
  font-weight: 900;
  color: #254163;
}

.dashboard-analysis summary::-webkit-details-marker {
  display: none;
}

.dashboard-analysis-arrow {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #edf3fb;
  color: #31537a;
  transition: transform 0.18s ease, background 0.18s ease;
}

.dashboard-analysis[open] .dashboard-analysis-arrow {
  transform: rotate(180deg);
  background: #dfeaf8;
}

.dashboard-analysis-body {
  border-top: 1px solid rgba(104, 133, 181, 0.18);
  padding: 12px 13px 14px;
  font-size: 13px;
  line-height: 1.55;
}

.dashboard-analysis-row {
  margin: 0;
}

.dashboard-analysis-row + .dashboard-analysis-row {
  margin-top: 8px;
}

.dashboard-analysis-row strong {
  color: #213657;
  font-weight: 900;
}

.dashboard-analysis-summary,
.dashboard-analysis-note {
  margin: 0;
}

.dashboard-analysis-list {
  margin: 8px 0;
  padding-left: 18px;
}

.dashboard-analysis-list li + li {
  margin-top: 5px;
}

.dashboard-analysis.is-empty .dashboard-analysis-body {
  color: #7184a0;
}

.dashboard-placeholder {
  min-height: 180px;
}

@media (max-width: 1180px) {
  .dashboard-chart-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-controls {
    grid-template-columns: 1fr;
  }

  .dashboard-card-controls {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .pnl-insight-grid { grid-template-columns: 1fr; }
  .pnl-chart-head { flex-direction: column; }
  .pnl-metric-picker { width: 100%; }
}

.pnl-table-wrap {
  max-height: 680px;
  overflow: auto;
  border: 1px solid rgba(104, 133, 181, 0.22);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.58);
}

.pnl-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
}

.pnl-table th,
.pnl-table td {
  border-bottom: 1px solid rgba(104, 133, 181, 0.16);
  border-right: 1px solid rgba(104, 133, 181, 0.12);
  padding: 11px 12px;
  text-align: right;
  white-space: nowrap;
  color: #263b5f;
  font-size: 0.88rem;
}

.pnl-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #eef3fb;
  color: #21365b;
  font-weight: 800;
}

.pnl-table th small {
  display: block;
  margin-top: 3px;
  color: #6f819f;
  font-size: 0.72rem;
  font-weight: 700;
}

.pnl-table th:first-child,
.pnl-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  text-align: left;
  background: #f7faff;
  min-width: 280px;
}

.pnl-table th:first-child {
  z-index: 3;
  background: #e7eef9;
}

.pnl-metric-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pnl-expand-btn {
  width: 24px;
  height: 24px;
  border: 1px solid rgba(68, 91, 137, 0.24);
  border-radius: 8px;
  background: #dce6f5;
  color: #203762;
  cursor: pointer;
  font-weight: 800;
}

.pnl-child-row td {
  color: #526680;
  background: rgba(244, 248, 253, 0.92);
}

.pnl-child-row td:first-child {
  background: #f1f6fd;
}

.pnl-child-spacer {
  width: 24px;
  display: inline-block;
}

.pnl-empty-week {
  background: #f4f7fc !important;
  color: #9aa8bd !important;
}

.pnl-empty-cell {
  color: #aab5c6 !important;
  background: rgba(248, 250, 253, 0.74);
}

.pnl-delta-ok {
  color: #21894b !important;
  font-weight: 800;
}

.pnl-delta-bad {
  color: #d24b59 !important;
  font-weight: 800;
}

@media (max-width: 980px) {
  .pnl-controls {
    grid-template-columns: 1fr;
  }

  .pnl-category-form {
    grid-template-columns: 1fr;
  }

  .pnl-category-item {
    align-items: stretch;
    flex-direction: column;
  }
}
