:root {
  --bg: #07111f;
  --bg-soft: #0e1b31;
  --panel: rgba(11, 24, 43, 0.88);
  --panel-strong: #0c1a2d;
  --border: rgba(148, 163, 184, 0.18);
  --text: #e7eefb;
  --muted: #96abc8;
  --brand: #4fd1ff;
  --brand-strong: #0ea5e9;
  --accent: #ffc36d;
  --success: #6ee7b7;
  --danger: #fb7185;
  --shadow: 0 28px 80px rgba(2, 8, 23, 0.45);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(79, 209, 255, 0.12), transparent 24%),
    radial-gradient(circle at top right, rgba(255, 195, 109, 0.12), transparent 20%),
    linear-gradient(180deg, #08111f 0%, #0a1424 50%, #08111f 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  width: min(1380px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(16px);
  background: rgba(7, 17, 31, 0.78);
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.topbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 16px 0;
}

.brand,
.topbar-actions,
.hero-actions,
.section-title-row,
.items-header,
.filter-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand), #d9f8ff);
  color: #07111f;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.brand-title,
.brand-subtitle,
.eyebrow,
.muted,
.compact,
.stat-card span,
.list-meta,
.preview-label {
  margin: 0;
}

.brand-title,
h1,
h2,
h3,
.stat-card strong,
.total-box strong,
.preview-total {
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.03em;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 14px;
}

.ghost-link {
  color: var(--muted);
  font-weight: 600;
}

.button {
  border: 0;
  border-radius: 999px;
  min-height: 46px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.button-primary {
  color: #07111f;
  background: linear-gradient(135deg, var(--brand), #d8f8ff);
}

.button-secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
}

.danger-button {
  color: white;
  background: rgba(251, 113, 133, 0.16);
  border: 1px solid rgba(251, 113, 133, 0.3);
}

.app-layout {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 22px;
  padding: 26px 0 34px;
}

.sidebar,
.workspace,
.workspace-grid,
.stats-grid,
.stack-form,
.line-items,
.list-stack {
  display: grid;
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
}

.hero-panel h1 {
  margin: 10px 0 10px;
  font-size: clamp(28px, 2.7vw, 44px);
  line-height: 1.02;
}

.eyebrow,
.pill {
  display: inline-flex;
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.eyebrow {
  background: rgba(110, 231, 183, 0.1);
  color: var(--success);
  border: 1px solid rgba(110, 231, 183, 0.24);
}

.pill {
  color: var(--accent);
  background: rgba(255, 195, 109, 0.1);
  border: 1px solid rgba(255, 195, 109, 0.22);
}

.muted {
  color: var(--muted);
  line-height: 1.65;
}

.compact {
  font-size: 14px;
}

.section-title-row {
  justify-content: space-between;
  align-items: start;
  margin-bottom: 12px;
}

.section-title-row h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.stack-form label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(79, 209, 255, 0.6);
  box-shadow: 0 0 0 4px rgba(79, 209, 255, 0.08);
}

textarea {
  resize: vertical;
}

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

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

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
  padding: 20px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
}

.workspace-grid {
  grid-template-columns: 1.1fr 0.9fr;
}

.items-header {
  justify-content: space-between;
}

.items-header h3 {
  margin: 0;
}

.line-item-row {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) 0.75fr 0.9fr 0.95fr 46px;
  gap: 10px;
  align-items: center;
}

.line-total,
.total-box {
  display: grid;
  align-items: center;
}

.line-total {
  min-height: 48px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.12);
  font-weight: 700;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: rgba(251, 113, 133, 0.14);
  color: white;
  cursor: pointer;
}

.totals-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 14px;
  align-items: end;
}

.total-box {
  min-height: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(79, 209, 255, 0.15), rgba(14, 165, 233, 0.08));
  border: 1px solid rgba(79, 209, 255, 0.22);
}

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

.total-box strong {
  font-size: 28px;
}

.filter-row {
  margin-bottom: 10px;
}

.filter-row input {
  flex: 1 1 auto;
}

.list-stack.empty-state,
.invoice-preview.empty-preview {
  border: 1px dashed rgba(148, 163, 184, 0.2);
  border-radius: var(--radius-md);
  min-height: 120px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.list-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.12);
  display: grid;
  gap: 10px;
}

.list-top,
.list-actions,
.preview-head,
.preview-business,
.preview-client,
.preview-summary,
.preview-footer,
.invoice-meta-grid {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.list-title {
  margin: 0;
  font-weight: 700;
}

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

.badge.Draft {
  background: rgba(148, 163, 184, 0.14);
}

.badge.Pending {
  background: rgba(255, 195, 109, 0.14);
  color: #ffd79a;
}

.badge.Paid {
  background: rgba(110, 231, 183, 0.14);
  color: #9ff2cf;
}

.badge.Overdue {
  background: rgba(251, 113, 133, 0.14);
  color: #ffb1bd;
}

.list-meta {
  color: var(--muted);
  font-size: 14px;
}

.list-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.mini-button {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.preview-panel {
  min-height: 520px;
}

.invoice-preview {
  background: #ffffff;
  color: #172033;
  border-radius: 18px;
  padding: 28px;
  min-height: 420px;
}

.preview-head {
  align-items: start;
  border-bottom: 1px solid #dbe4f0;
  padding-bottom: 18px;
}

.preview-head h3 {
  margin: 0;
  font-size: 30px;
}

.preview-label {
  color: #5b6575;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.preview-section-title {
  margin: 18px 0 8px;
  font-size: 13px;
  color: #5b6575;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 18px;
}

.preview-table th,
.preview-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #e7edf5;
  text-align: left;
}

.preview-table th {
  font-size: 13px;
  color: #5b6575;
  text-transform: uppercase;
}

.preview-summary {
  justify-content: flex-end;
  margin-top: 20px;
}

.preview-summary-card {
  width: min(100%, 320px);
  border: 1px solid #dbe4f0;
  border-radius: 16px;
  padding: 16px;
}

.preview-summary-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
}

.preview-total {
  font-size: 28px;
}

.preview-footer {
  margin-top: 22px;
  border-top: 1px solid #dbe4f0;
  padding-top: 16px;
  align-items: end;
}

.hidden-print {
  display: none;
}

@media (max-width: 1180px) {
  .app-layout,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .shell {
    width: min(1380px, calc(100% - 20px));
  }

  .topbar-row,
  .topbar-actions,
  .hero-actions,
  .section-title-row,
  .items-header,
  .filter-row,
  .list-top,
  .preview-head,
  .preview-business,
  .preview-client,
  .preview-footer,
  .invoice-meta-grid {
    flex-direction: column;
    align-items: stretch;
  }

  .inline-grid,
  .triple-grid,
  .totals-grid,
  .stats-grid,
  .line-item-row {
    grid-template-columns: 1fr;
  }

  .line-item-row .icon-button {
    width: 100%;
  }

  .invoice-preview {
    padding: 18px;
  }
}
