﻿:root {
  --bg-0: #0b0b0c;
  --panel: rgba(28, 28, 31, 0.95);
  --panel-alt: #242428;
  --border: #4a3b25;
  --gold: #d4af37;
  --gold-strong: #f5d57a;
  --gold-light: #f5d57a;
  --muted: #9a8b70;
  --text: #e9e3d9;
  --text-dim: #b1a58f;
  --danger: #f06a6a;
  --success: #9bdc7b;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

.is-hidden {
  display: none;
}

body {
  margin: 0;
  font-family: "DM Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 20%, rgba(212, 175, 55, 0.08), transparent 30%),
    radial-gradient(circle at 80% 0%, rgba(245, 213, 122, 0.15), transparent 35%),
    var(--bg-0);
  min-height: 100vh;
  letter-spacing: 0.1px;
}

h1,
h2,
h3,
.brand-title {
  font-family: "Cinzel", serif;
  letter-spacing: 0.08em;
}

.app {
  width: min(1280px, 94vw);
  margin: 24px auto 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 50;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(20, 20, 22, 0.98);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  font-size: 13px;
  letter-spacing: 0.04em;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  border-color: rgba(155, 220, 123, 0.6);
  color: var(--success);
}

.toast.error {
  border-color: rgba(240, 106, 106, 0.6);
  color: var(--danger);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  background: linear-gradient(135deg, rgba(36, 36, 40, 0.9), rgba(24, 24, 28, 0.95));
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-title {
  font-size: 24px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold-light);
}

.brand-subtitle {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-dim);
}

.top-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.page-actions {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(24, 24, 28, 0.95), rgba(15, 15, 17, 0.95));
  box-shadow: var(--shadow);
}

.page-actions + .page-actions {
  margin-top: 10px;
}

.page-actions.nav-actions {
  margin-top: 14px;
}

.page-actions .top-actions {
  width: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  background: linear-gradient(90deg, #c8a03f, #f5d57a);
  color: #0b0b0c;
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
}

.btn:focus-visible {
  outline: 2px solid rgba(212, 175, 55, 0.7);
  outline-offset: 2px;
}

.btn.primary {
  background: linear-gradient(90deg, #d4af37, #f5d57a);
  border-color: var(--gold);
  color: #0b0b0c;
}

.btn.editing {
  background: linear-gradient(90deg, rgba(155, 220, 123, 0.8), rgba(121, 194, 138, 0.9));
  border-color: rgba(155, 220, 123, 0.8);
  color: #0f1b12;
}

.btn.danger {
  background: linear-gradient(90deg, #f06a6a, #f7a2a2);
  border-color: rgba(240, 106, 106, 0.85);
  color: #190909;
}

.btn.ghost {
  background: rgba(0, 0, 0, 0.25);
  border-color: var(--border);
  color: var(--text);
  font-weight: 600;
}

.file-btn input {
  display: none;
}

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

.card {
  background: linear-gradient(180deg, rgba(28, 28, 31, 0.95), rgba(18, 18, 20, 0.95));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  box-shadow: var(--shadow);
}

.card-title {
  margin: 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-dim);
}

.card-value {
  margin: 10px 0 4px;
  font-size: 28px;
  font-weight: 600;
  color: var(--gold-light);
}

.card-sub {
  margin: 0;
  font-size: 14px;
  color: var(--text-dim);
}

.main-grid {
  display: grid;
  grid-template-columns: 280px 1fr 360px;
  gap: 18px;
}

.panel {
  background: linear-gradient(180deg, rgba(28, 28, 31, 0.96), rgba(16, 16, 18, 0.96));
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 320px;
}

.panel-header {
  padding: 18px 20px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.panel-header h2 {
  margin: 0;
  font-size: 20px;
  color: var(--gold-light);
}

.panel-subtitle {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.panel-body {
  padding: 18px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100%;
}

.form-stack label,
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

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

.form-grid.two-cols {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

input,
select,
textarea {
  background: #131316;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--text);
  font-family: inherit;
}

textarea {
  resize: vertical;
  min-height: 90px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.25);
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.input-error {
  border-color: rgba(240, 106, 106, 0.8);
  box-shadow: 0 0 0 2px rgba(240, 106, 106, 0.25);
}

input::placeholder {
  color: var(--text-dim);
}

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

.divider {
  height: 1px;
  background: rgba(74, 59, 37, 0.4);
}

.form-hint {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
}

.owner-lock {
  max-width: 680px;
  margin: 0 auto;
}

.owner-lock-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.owner-lock-error {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 12px;
}

.owner-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.owner-info {
  display: grid;
  gap: 4px;
}

.user-admin {
  display: grid;
  gap: 16px;
}

.owner-name {
  margin: 6px 0 0;
  font-weight: 700;
  color: var(--gold-light);
}

.user-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.permission-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.permission-card h4 {
  margin: 0;
  font-size: 14px;
  color: var(--gold-light);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 13px;
}

.toggle input {
  accent-color: var(--gold);
}

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

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

.entity-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.entity-header {
  display: grid;
  gap: 6px;
}

.entity-title {
  font-weight: 700;
}

.entity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.meta-pill {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
}

.entity-contact {
  color: var(--text-dim);
  font-size: 12px;
}

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

.small-btn {
  padding: 6px 10px;
  font-size: 12px;
}

.empty {
  padding: 12px;
  color: var(--text-dim);
  border: 1px dashed var(--border);
  border-radius: 10px;
}

.quick-filters,
.active-filters {
  display: grid;
  gap: 10px;
}

.quick-filters h3,
.active-filters h3 {
  margin: 0;
  font-size: 15px;
  color: var(--gold-strong);
}

.quick-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-buttons .btn {
  padding: 6px 12px;
  font-size: 11px;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.35);
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold-light);
  padding: 6px 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.chip.empty {
  background: transparent;
  border-color: rgba(74, 59, 37, 0.5);
  color: var(--text-dim);
  cursor: default;
}

.category-section h3,
.entry-form h3 {
  margin: 0;
  font-size: 16px;
  color: var(--gold-strong);
}

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

.category-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.category-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
}

.category-pill:focus-visible {
  outline: 2px solid rgba(212, 175, 55, 0.7);
  outline-offset: 2px;
}

.category-pill.active {
  border-color: var(--gold);
  background: linear-gradient(90deg, rgba(212, 175, 55, 0.25), rgba(28, 28, 31, 0.9));
  color: var(--gold-light);
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.4);
}

.category-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-name {
  font-weight: 500;
}

.category-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.2);
}

.category-count {
  min-width: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--gold-light);
  font-size: 12px;
  text-align: center;
}

.category-pill.active .category-count {
  background: rgba(212, 175, 55, 0.2);
}

.add-category {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.table-wrap {
  overflow: auto;
  max-height: 360px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
}

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

.data-table th,
.data-table td {
  padding: 12px 12px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table th {
  position: sticky;
  top: 0;
  background: rgba(19, 19, 22, 0.95);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  color: var(--text-dim);
  z-index: 1;
}

.data-table th:nth-child(4),
.data-table th:nth-child(5),
.data-table th:nth-child(6),
.data-table td:nth-child(4),
.data-table td:nth-child(5),
.data-table td:nth-child(6) {
  text-align: right;
}

.data-table th:last-child,
.data-table td:last-child {
  text-align: center;
}

.data-table tbody td {
  background: rgba(0, 0, 0, 0.2);
}

.ads-table td:first-child {
  color: var(--gold-strong);
  font-weight: 600;
}

.data-table tbody td:nth-child(4),
.data-table tbody td:nth-child(5),
.data-table tbody td:nth-child(6) {
  font-weight: 600;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover td {
  background: rgba(212, 175, 55, 0.08);
}

.table-empty {
  padding: 18px;
  text-align: center;
  color: var(--text-dim);
}

.entry-desc {
  font-weight: 500;
  line-height: 1.4;
  color: var(--text);
}

.category-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.4);
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.amount-refund {
  color: var(--success);
}

.amount-placeholder {
  color: var(--text-dim);
}

.actions-cell {
  width: 88px;
  text-align: right;
  white-space: nowrap;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 55, 0.5);
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold-light);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.icon-btn svg {
  width: 14px;
  height: 14px;
}

.icon-btn + .icon-btn {
  margin-left: 6px;
}

.icon-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.3);
}

.icon-btn.danger {
  border-color: rgba(240, 106, 106, 0.7);
  color: var(--danger);
  background: rgba(240, 106, 106, 0.12);
}

.entry-form .form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}

.entry-form .btn {
  justify-self: start;
}

.chart-grid {
  display: grid;
  gap: 16px;
}

.chart-card {
  padding: 12px 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(18, 18, 22, 0.85);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chart-card h3 {
  margin: 0;
  font-size: 15px;
  color: var(--gold-light);
}

.chart-wrap {
  position: relative;
  height: 220px;
}

.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

.chart-placeholder,
.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 16px;
  color: var(--text-dim);
  font-size: 12px;
  background: rgba(18, 18, 22, 0.6);
  border-radius: 10px;
  pointer-events: none;
}

.footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
}

.csv-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--text-dim);
}

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

.ads-header {
  align-items: center;
}

.ads-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.ads-dataset-select {
  display: grid;
  gap: 6px;
  color: var(--text-dim);
  font-size: 12px;
}

.ads-dataset-select select {
  min-width: 180px;
}

.ads-level-select {
  display: grid;
  gap: 6px;
  color: var(--text-dim);
  font-size: 12px;
}

.ads-level-select select {
  min-width: 160px;
}

.settings-btn {
  width: 34px;
  height: 34px;
}

.ads-body {
  gap: 18px;
}

.ads-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.ads-left {
  display: grid;
  gap: 16px;
}

.ads-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.ads-card .card-value {
  font-size: 24px;
}

.ads-custom {
  display: grid;
  gap: 12px;
}

.ads-compare {
  display: grid;
  gap: 10px;
}

.ads-compare-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.ads-compare-ab {
  display: grid;
  gap: 12px;
}

.ads-compare-controls {
  display: grid;
  gap: 12px;
}

.ads-compare-stats {
  font-size: 12px;
}

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

.ads-alerts {
  display: grid;
  gap: 8px;
}

.ads-alert {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  font-size: 12px;
}

.ads-alert.warning {
  border-color: var(--gold);
  color: var(--gold-light);
}

.ads-alert.danger {
  border-color: var(--danger);
  color: var(--danger);
}

.stat-badge {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.stat-badge.ok {
  border-color: var(--success);
  color: var(--success);
}

.stat-badge.neutral {
  border-color: var(--gold);
  color: var(--gold-light);
}

.ads-compare-wrap {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
}

.ads-compare-table {
  font-size: 12px;
}

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

.ads-compare-table th:nth-child(n + 3),
.ads-compare-table td:nth-child(n + 3) {
  text-align: right;
}

.ads-compare-table td:first-child {
  color: var(--gold-light);
  font-weight: 600;
}

.ads-compare-table tbody tr {
  cursor: pointer;
}

.ads-compare-table tbody tr.is-active td {
  background: rgba(212, 175, 55, 0.12);
}

.ads-custom-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ads-visuals {
  display: grid;
  gap: 12px;
}

.ads-visuals-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.ads-visual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.ads-chart-card {
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(18, 18, 22, 0.8);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ads-chart-card h4 {
  margin: 0;
  font-size: 14px;
  color: var(--gold-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ads-chart-card .chart-wrap {
  height: 190px;
}

.metric-chip {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(212, 175, 55, 0.4);
  background: rgba(212, 175, 55, 0.12);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-light);
}

.metric-chip span {
  display: block;
  font-size: 14px;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text);
}

.ads-table-wrap {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  max-height: 420px;
}

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

.ads-table td:first-child {
  max-width: 260px;
  white-space: normal;
}

.ads-table td.ci-cell {
  white-space: normal;
  min-width: 200px;
}

.ads-table td:nth-child(n + 2) {
  text-align: right;
}

.ads-table th:nth-child(n + 2) {
  text-align: right;
}

.ads-right {
  display: grid;
  gap: 16px;
  align-content: start;
}

.ads-block {
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(18, 18, 22, 0.8);
  padding: 16px;
  display: grid;
  gap: 12px;
}

.ads-block h3 {
  margin: 0;
  font-size: 16px;
  color: var(--gold-light);
}

.ads-insights {
  display: grid;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.ads-insights p {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(74, 59, 37, 0.35);
}

.settings-panel {
  display: none;
}

.settings-panel.open {
  display: grid;
}

.settings-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.settings-section {
  display: grid;
  gap: 10px;
}

.settings-section h4 {
  margin: 0;
  font-size: 14px;
  color: var(--gold-light);
}

.formula-list {
  display: grid;
  gap: 8px;
}

.formula-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.formula-meta {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--text-dim);
}

.formula-meta strong {
  color: var(--text);
  font-size: 14px;
}

.formula-form {
  display: grid;
  gap: 8px;
}

.formula-form input,
.formula-form select {
  width: 100%;
}

.formula-form .btn {
  justify-self: start;
}

@media (max-width: 1200px) {
  .ads-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .ads-actions {
    width: 100%;
    justify-content: flex-start;
  }
}
.net-positive {
  color: var(--success);
}

.net-negative {
  color: var(--danger);
}

@media (max-width: 1200px) {
  .main-grid {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .owner-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .owner-lock-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .brand-title {
    font-size: 22px;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .chart-wrap {
    height: 200px;
  }
}

.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}

body.theme-light {
  --bg-0: #f4f0e6;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-alt: #f5f1e8;
  --border: #cbb791;
  --gold: #b28b2f;
  --gold-strong: #b28b2f;
  --gold-light: #a77d22;
  --muted: #8c7a5a;
  --text: #2b241b;
  --text-dim: #6d5c44;
  --shadow: 0 16px 40px rgba(40, 30, 20, 0.12);
  background:
    radial-gradient(circle at 20% 20%, rgba(178, 139, 47, 0.08), transparent 35%),
    radial-gradient(circle at 80% 0%, rgba(178, 139, 47, 0.1), transparent 40%),
    var(--bg-0);
}

body.theme-light .topbar {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(245, 241, 232, 0.96));
}

body.theme-light .page-actions {
  background: linear-gradient(135deg, rgba(250, 247, 240, 0.98), rgba(240, 235, 225, 0.98));
}

body.theme-light .panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(245, 241, 232, 0.98));
}

body.theme-light .card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 242, 234, 0.98));
}

body.theme-light .chart-card,
body.theme-light .ads-chart-card,
body.theme-light .ads-block {
  background: rgba(255, 255, 255, 0.92);
}

body.theme-light .table-wrap,
body.theme-light .ads-compare-wrap,
body.theme-light .ads-table-wrap {
  background: var(--panel-alt);
}

body.theme-light .data-table th {
  background: rgba(248, 244, 236, 0.98);
}

body.theme-light .data-table tbody td {
  background: rgba(255, 255, 255, 0.8);
}

body.theme-light .btn.ghost {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
}

body.theme-light .icon-btn {
  background: rgba(178, 139, 47, 0.12);
}

.launcher-shell {
  width: min(1200px, 94vw);
  margin: 32px auto;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 24px;
  align-items: start;
}

.launcher-hero {
  display: grid;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.launcher-top {
  display: flex;
  justify-content: flex-end;
}

.theme-toggle {
  padding: 8px 12px;
  font-size: 12px;
}

.logo-stack {
  display: grid;
  place-items: center;
  padding: 20px 0 10px;
}

.logo {
  width: min(70vw, 260px);
  height: auto;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, 0.25));
}

.logo-light {
  display: none;
}

body.theme-light .logo-light {
  display: block;
}

body.theme-light .logo-dark {
  display: none;
}

.launcher-title {
  margin: 0;
  font-size: 34px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  text-align: center;
  color: var(--gold-light);
}

.launcher-subtitle {
  margin: 0;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  color: var(--text-dim);
}

.launcher-tagline {
  margin: 0;
  text-align: center;
  font-size: 14px;
  color: var(--text);
}

.launcher-panels {
  display: grid;
  gap: 16px;
}

.launcher-panel .panel-header {
  align-items: center;
}

.login-error {
  color: var(--danger);
  min-height: 16px;
}

.nav-grid {
  display: grid;
  gap: 12px;
}

.nav-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nav-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
}

.nav-card.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.nav-card-title {
  font-weight: 700;
  font-size: 15px;
}

.nav-card-desc {
  font-size: 12px;
  color: var(--text-dim);
}

.nav-pill {
  align-self: start;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold-light);
  background: rgba(212, 175, 55, 0.1);
}

body.theme-light .nav-card {
  background: rgba(255, 255, 255, 0.7);
}

body.theme-light .nav-pill {
  background: rgba(178, 139, 47, 0.12);
}

.inventory-panel {
  margin-top: 16px;
}

.inventory-body {
  display: grid;
  gap: 16px;
}

.inventory-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1.2fr);
  gap: 16px;
  align-items: start;
}

.inventory-left,
.inventory-right {
  display: grid;
  gap: 16px;
}

.inventory-card {
  display: grid;
  gap: 12px;
}

.inventory-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.inventory-alerts {
  display: grid;
  gap: 8px;
}

.inventory-alert {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  font-size: 12px;
}

.inventory-alert.warning {
  border-color: var(--gold);
  color: var(--gold-light);
}

.inventory-alert.danger {
  border-color: var(--danger);
  color: var(--danger);
}

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

.inventory-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.inventory-item-header {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
}

.product-thumb {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  border: 1px solid var(--border);
  object-fit: cover;
  background: #131316;
}

.product-thumb.placeholder {
  display: grid;
  place-items: center;
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
  white-space: pre-line;
}

.inventory-item-title {
  font-weight: 700;
}

.inventory-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.inventory-item-notes {
  color: var(--text-dim);
  font-size: 12px;
}

.inventory-item-main {
  display: grid;
  gap: 6px;
}

.inventory-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.pack-use-qty {
  width: 90px;
}

.pack-builder {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

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

.pack-item-row select,
.pack-item-row input {
  width: 100%;
  min-width: 0;
}

@media (max-width: 1200px) {
  .inventory-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .pack-item-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .launcher-shell {
    grid-template-columns: 1fr;
  }

  .launcher-hero {
    order: 1;
  }

  .launcher-panels {
    order: 2;
  }
}

.task-panel {
  min-height: auto;
}

.task-body {
  gap: 18px;
}

.task-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.task-summary-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  display: grid;
  gap: 6px;
}

.task-summary-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.task-summary-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--gold-light);
}

.task-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
}

.task-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.task-column {
  display: grid;
  gap: 16px;
}

.task-card {
  display: grid;
  gap: 12px;
}

.task-card-header {
  display: grid;
  gap: 4px;
}

.task-card-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--gold-light);
}

.task-card-header .panel-subtitle {
  text-transform: none;
  letter-spacing: 0.08em;
}

.personal-items {
  display: grid;
  gap: 8px;
}

.personal-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 140px 110px auto;
  gap: 8px;
  align-items: center;
}

.personal-item-row input {
  width: 100%;
  min-width: 0;
}

.task-list-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.task-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.task-list-title {
  font-weight: 700;
  color: var(--gold-light);
}

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

.task-list-items {
  display: grid;
  gap: 8px;
}

.task-list-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.task-list-item.completed {
  opacity: 0.7;
}

.task-list-item.completed span {
  text-decoration: line-through;
  color: var(--text-dim);
}

.task-list-meta {
  color: var(--text-dim);
  font-size: 12px;
}

.task-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.task-item.completed {
  opacity: 0.8;
}

.task-item-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.task-item-title {
  font-weight: 700;
}

.task-status {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.task-status.active {
  color: var(--gold-light);
  border-color: var(--gold);
}

.task-status.blocked {
  color: var(--text-dim);
}

.task-status.completed {
  color: var(--success);
  border-color: var(--success);
}

.task-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.task-item-details {
  display: grid;
  gap: 8px;
  color: var(--text-dim);
  font-size: 13px;
}

.task-item-details p {
  margin: 0;
}

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

.task-checklist {
  display: grid;
  gap: 6px;
}

.task-checklist-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  font-size: 12px;
}

.task-checklist-item.completed {
  opacity: 0.7;
  text-decoration: line-through;
}

.task-checklist-item input {
  accent-color: var(--gold);
}

.task-attachments {
  display: grid;
  gap: 6px;
}

.task-attachments a {
  color: var(--gold-light);
  text-decoration: none;
  font-size: 12px;
}

.task-attachments a:hover {
  text-decoration: underline;
}

.task-inline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.task-assignees,
.task-dependencies {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
}

.task-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-dim);
}

.task-toggle input {
  accent-color: var(--gold);
}

.checklist-builder {
  display: grid;
  gap: 8px;
}

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

.checklist-row input,
.checklist-row select {
  width: 100%;
  min-width: 0;
}

.attachment-list {
  display: grid;
  gap: 8px;
}

.attachment-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  font-size: 12px;
}

.calendar-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  align-items: center;
}

.calendar-row.completed {
  opacity: 0.7;
}

.calendar-date {
  font-weight: 700;
  color: var(--gold-light);
}

.calendar-title {
  font-size: 13px;
}

.calendar-meta {
  grid-column: 1 / -1;
  color: var(--danger);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 80;
}

.chat-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.chat-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(360px, 92vw);
  background: linear-gradient(180deg, rgba(22, 22, 26, 0.98), rgba(12, 12, 14, 0.98));
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 90;
  display: flex;
  flex-direction: column;
}

.chat-drawer.open {
  transform: translateX(0);
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--gold-light);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: grid;
  gap: 10px;
}

.chat-message {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.2);
  display: grid;
  gap: 4px;
}

.chat-meta {
  font-size: 11px;
  color: var(--text-dim);
}

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

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(14, 14, 18, 0.95);
}

.task-notice-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 95;
}

.task-notice-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.task-notice-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  width: min(520px, 92vw);
  background: linear-gradient(180deg, rgba(28, 28, 31, 0.98), rgba(18, 18, 20, 0.98));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
  display: grid;
  gap: 12px;
}

.task-notice-modal.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.task-notice-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.task-notice-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--gold-light);
}

.task-notice-list {
  display: grid;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
}

.task-notice-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
}

.task-notice-title {
  font-weight: 700;
}

.task-notice-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

.ads-task-metrics {
  display: grid;
  gap: 12px;
}

.ads-task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.ads-task-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  display: grid;
  gap: 6px;
}

.ads-task-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}

.ads-task-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--gold-light);
}

.ads-task-subtitle {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--text-dim);
}

.ads-task-load {
  display: grid;
  gap: 8px;
}

.ads-task-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  font-size: 12px;
}

.ads-task-count {
  color: var(--gold-light);
  font-weight: 700;
}

@media (max-width: 900px) {
  .personal-item-row {
    grid-template-columns: 1fr;
  }

  .checklist-row {
    grid-template-columns: 1fr;
  }

  .task-list-item {
    grid-template-columns: auto 1fr;
  }

  .task-item-actions {
    justify-content: flex-start;
  }
}
