@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Serif:wght@500;700&display=swap');

:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --bg-soft: #eef1f4;
  --surface: #ffffff;
  --ink: #1c1f23;
  --muted: #5e6670;
  --accent: #d07a4a;
  --accent-strong: #b85c2b;
  --accent-soft: #f7e3d6;
  --border: #d7dce2;
  --success: #287d63;
  --warning: #d69a2d;
  --danger: #b33a2b;
  --shadow: 0 10px 20px rgba(28, 31, 35, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'IBM Plex Sans', 'Trebuchet MS', sans-serif;
  color: var(--ink);
  background: var(--bg);
}

h1, h2, h3 {
  font-family: 'IBM Plex Sans', 'Trebuchet MS', sans-serif;
  margin: 0;
}

p {
  margin: 0;
  color: var(--muted);
}

button {
  font-family: inherit;
}

.page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  padding: 28px 20px;
  background: #fbfaf8;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: conic-gradient(from 140deg, var(--accent), #f0b083, #e8c0a1, var(--accent));
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.12);
}

.brand-title {
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--muted);
}

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

.nav-item {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-item:hover {
  background: var(--accent-soft);
}

.nav-item.active {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 6px 14px rgba(28, 31, 35, 0.08);
}

.nav-item:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 8px;
  font-size: 0.8rem;
}

.hint {
  color: var(--muted);
}

.content {
  padding: 28px 40px 40px;
}

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

.topbar-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.user-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 0.8rem;
  color: var(--ink);
  border: 1px solid var(--border);
}

.hidden {
  display: none !important;
}

.ghost {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
}

.file-upload {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.file-upload input {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

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

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

.stat {
  font-size: 1.8rem;
  font-weight: 700;
  margin-top: 8px;
}

.section {
  margin-top: 24px;
  display: grid;
  gap: 16px;
}

.panel {
  background: var(--surface);
  border-radius: 10px;
  padding: 16px;
  border: 1px solid var(--border);
  box-shadow: none;
  text-align: left;
}

.panel h2 {
  margin-bottom: 12px;
}

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

.form-grid-4 {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

input, select, textarea {
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 0.95rem;
  background: #fff;
}

input, select {
  height: 40px;
  line-height: 1.2;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 17px,
    calc(100% - 13px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}

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

.primary {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.primary:hover {
  background: var(--accent-strong);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-left: 0;
  margin-right: auto;
}

.table-wrap {
  overflow-x: auto;
  text-align: left;
}

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

.table th {
  color: var(--muted);
  font-weight: 600;
}

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

.row-actions.nowrap {
  flex-wrap: nowrap;
}

.checkbox-compact {
  width: 12px;
  height: 12px;
}

.row-actions.space-between {
  justify-content: space-between;
  align-items: center;
}

.row-actions.align-right {
  justify-content: flex-end;
  align-items: center;
}

.payment-summary {
  margin: 4px 0 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.payment-summary-left,
.payment-summary-right {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.payment-summary-right {
  align-items: flex-end;
}

.preorder-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
}

.preorder-toggle input {
  margin: 0;
}

.badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge.success {
  background: rgba(40, 125, 99, 0.15);
  color: var(--success);
}

.badge.warning {
  background: rgba(214, 154, 45, 0.15);
  color: var(--warning);
}

.badge.danger {
  background: rgba(179, 58, 43, 0.15);
  color: var(--danger);
}

.inline-note {
  font-size: 0.85rem;
  color: var(--muted);
}

.sheet-table th,
.sheet-table td {
  border: 1px solid var(--border);
}

.sheet-table th {
  background: #f7f8fa;
  color: var(--ink);
  font-weight: 600;
}

.group-row td {
  background: #f1f4f7;
  font-weight: 600;
  color: var(--ink);
}

.matrix-subhead th {
  background: #fbfbfd;
  font-weight: 500;
  color: var(--muted);
}

.matrix-input {
  width: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.85rem;
}

.matrix-input:focus {
  outline: 2px solid rgba(208, 122, 74, 0.3);
  background: #fff;
}

.sheet-details {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: #fcfcfd;
}

.sheet-details summary {
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 8px;
}

.fade-in {
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .sidebar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }

  .nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .content {
    padding: 24px;
  }
}

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

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

  .payment-summary {
    flex-direction: column;
    align-items: stretch;
  }

  .payment-summary-right {
    align-items: flex-start;
  }
}
