:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #1f4d3a;
  --primary-hover: #163a2c;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --warning: #b54708;
  --warning-bg: #fffaeb;
  --success: #067647;
  --success-bg: #ecfdf3;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 14px;
  --sidebar-width: 240px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--primary); }

button, .btn {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

button:disabled, .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #eef2f7;
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #10261d;
  color: #e8f1ec;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
}

.brand small {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: #a8c3b6;
  margin-top: 4px;
}

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

.nav button {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #d7e6de;
  padding: 12px 14px;
  border-radius: 10px;
}

.nav button.active,
.nav button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  font-size: 0.85rem;
  color: #a8c3b6;
}

.main {
  padding: 28px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.page-header h1 {
  margin: 0;
  font-size: 1.7rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}

.card strong {
  font-size: 1.8rem;
}

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

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

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

.filters select,
.filters input,
.field input,
.field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: #fafbfc;
}

tr:hover td {
  background: #fafbfc;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.badge-tentative { background: var(--warning-bg); color: var(--warning); }
.badge-confirmed { background: var(--success-bg); color: var(--success); }
.badge-cancelled { background: #f2f4f7; color: #475467; }
.badge-internal { background: #eef4ff; color: #3538cd; }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}

.login-card p {
  margin: 0 0 24px;
  color: var(--muted);
}

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

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.92rem;
  font-weight: 600;
}

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

.alert {
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.92rem;
}

.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-success { background: var(--success-bg); color: var(--success); }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  padding: 20px;
}

.detail-grid-compact {
  padding: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-item span {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.detail-item strong {
  display: block;
  word-break: break-word;
}

.detail-item a {
  color: var(--primary);
  text-decoration: none;
}

.detail-item a:hover {
  text-decoration: underline;
}

.detail-actions {
  padding: 20px 0 0;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

.page-header-detail {
  align-items: flex-start;
  margin-bottom: 20px;
}

.page-header-detail h1 {
  margin: 0;
  font-size: 1.6rem;
}

.detail-kicker {
  margin: 0 0 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

.detail-main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.detail-section + .detail-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.detail-section-full {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.detail-section-title {
  margin: 0 0 16px;
  font-size: 0.92rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.detail-note {
  background: #f8faf9;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.detail-muted {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.detail-price-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  position: sticky;
  top: 24px;
}

.price-total-box {
  background: linear-gradient(135deg, #10261d 0%, #1f4d3a 100%);
  color: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.price-total-label {
  display: block;
  font-size: 0.82rem;
  opacity: 0.85;
  margin-bottom: 6px;
}

.price-total-value {
  display: block;
  font-size: 2rem;
  line-height: 1.1;
  margin-bottom: 6px;
}

.price-total-meta {
  display: block;
  font-size: 0.82rem;
  opacity: 0.75;
}

.price-breakdown {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin-bottom: 16px;
}

.price-breakdown th,
.price-breakdown td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.price-breakdown th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: transparent;
}

.price-breakdown tr:hover td {
  background: #fafbfc;
}

.price-cell {
  text-align: right;
  white-space: nowrap;
}

.price-free {
  color: var(--success);
  font-weight: 700;
}

.season-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #eef2f7;
  color: #475467;
}

.season-season {
  background: #ecfdf3;
  color: #067647;
}

.season-holidays {
  background: #fef3f2;
  color: #b42318;
}

.price-summary {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.price-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: 0.92rem;
}

.price-summary-row strong {
  white-space: nowrap;
}

.price-discount {
  color: var(--success);
}

.price-discount strong {
  color: var(--success);
}

.empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .nav {
    flex-direction: row;
    overflow-x: auto;
  }

  .nav button {
    width: auto;
    white-space: nowrap;
  }

  .main {
    padding: 18px;
  }

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

  .detail-price-card {
    position: static;
  }

  .detail-grid-compact {
    grid-template-columns: 1fr;
  }

  table, thead, tbody, th, td, tr {
    display: block;
  }

  thead {
    display: none;
  }

  tr {
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
  }

  td {
    border: 0;
    padding: 8px 20px;
  }

  td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 4px;
  }
}

.income-panel {
  margin-bottom: 24px;
}

.income-panel .panel-header {
  flex-wrap: wrap;
}

.income-total {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 500;
}

.income-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 220px;
  padding: 24px 20px 12px;
  overflow-x: auto;
}

.income-bar-col {
  flex: 1 1 0;
  min-width: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.income-bar-wrap {
  width: 100%;
  height: 160px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.income-bar {
  width: 100%;
  max-width: 48px;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 6px 6px 2px 2px;
  position: relative;
  min-height: 4px;
  transition: opacity 0.15s ease;
}

.income-bar-wrap:hover .income-bar {
  opacity: 0.85;
}

.income-bar-empty {
  height: 2px;
  background: var(--border);
  min-height: 2px;
}

.income-bar-value {
  position: absolute;
  left: 50%;
  top: -22px;
  transform: translateX(-50%);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  pointer-events: none;
}

.income-bar-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.2;
}

.income-note {
  margin: 0;
  padding: 0 20px 16px;
  font-size: 0.82rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  .income-bar-value {
    display: none;
  }

  .income-bar-col {
    min-width: 44px;
  }
}
