﻿@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600&family=DM+Sans:wght@400;500;600&display=swap');

:root {
  --ink: #151515;
  --slate: #2d2a26;
  --muted: #6b6460;
  --paper: #f7f3ee;
  --surface: #ffffff;
  --accent: #c06a3f;
  --accent-dark: #8a4a2a;
  --border: #e2dbd3;
  --shadow: 0 16px 40px rgba(20, 16, 10, 0.12);
  --radius: 16px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--slate);
  background: linear-gradient(140deg, #f6efe7 0%, #efe6dc 40%, #e6dbcf 100%);
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: 'Space Grotesk', sans-serif;
  color: var(--ink);
}

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

.container {
  width: min(1160px, 92vw);
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(247, 243, 238, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

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

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--ink);
  color: #fdf8f3;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
}

.brand-name {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.9rem;
}

.brand-tag {
  color: var(--muted);
  font-size: 0.85rem;
}

.topnav {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-weight: 600;
}

.topnav a {
  padding: 6px 0;
  position: relative;
}

.topnav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.2s ease;
}

.topnav a:hover::after {
  width: 100%;
}

.nav-group {
  position: relative;
}

.nav-trigger {
  background: transparent;
  border: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  padding: 6px 0;
  position: relative;
}

.nav-trigger::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.2s ease;
}

.nav-group:hover .nav-trigger::after,
.nav-group:focus-within .nav-trigger::after {
  width: 100%;
}

.nav-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 10px;
  display: none;
  z-index: 20;
}

.nav-menu::before {
  content: '';
  position: absolute;
  left: 0;
  top: -12px;
  width: 100%;
  height: 12px;
}

.nav-menu a {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
}

.nav-menu a:hover {
  background: #f4ede6;
}

.nav-group:hover .nav-menu,
.nav-group:focus-within .nav-menu {
  display: block;
}

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

.user-label {
  font-weight: 600;
  color: var(--muted);
}

.page {
  padding: 32px 0 60px;
}

.section {
  padding: 24px 0;
}

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

.dashboard-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.period-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--muted);
}

.period-filter select {
  min-width: 180px;
}

.period-label {
  font-size: 0.9rem;
  color: var(--muted);
}

.lead {
  color: var(--muted);
  margin-top: 8px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 10px 22px;
  font-weight: 600;
  background: var(--ink);
  color: #fff;
  border: none;
  cursor: pointer;
}

.button.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--slate);
}

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

.text-link {
  color: var(--accent-dark);
  font-weight: 600;
}

.text-link.danger {
  color: #9a2b2b;
  background: none;
  border: none;
  cursor: pointer;
}

.card,
.table-card,
.metric-card,
.auth-card,
.invoice-paper {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.metric-link {
  display: block;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

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

.metric-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.metric-value {
  font-size: 2rem;
  font-weight: 600;
  margin-top: 6px;
}

.metric-sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 6px;
}

.metric-chip {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #efe2d5;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.split {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

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

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

.list li {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}

.table-card table,
.invoice-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

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

.table-card th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

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

.inline-form {
  display: inline;
}

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

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

.form-grid label,
.form-stack label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  color: var(--muted);
}

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

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

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

.detail-list {
  list-style: none;
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.form-alert {
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 600;
  margin-bottom: 16px;
}

.form-alert.error {
  background: #f4dddd;
  color: #8a2b2b;
  border: 1px solid rgba(138, 43, 43, 0.2);
}

.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: linear-gradient(160deg, #efe5da, #e4d7c9);
}

.auth-card {
  width: min(420px, 92vw);
  padding: 32px;
}

.auth-card h1 {
  margin: 18px 0;
}

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

.invoice-paper {
  background: var(--paper);
  padding: 28px;
  border: 1px solid var(--border);
}

.invoice-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}

.invoice-meta p {
  margin-bottom: 6px;
}

.invoice-billto {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0;
}

.invoice-billto .label {
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.invoice-table th,
.invoice-table td {
  font-size: 0.9rem;
}

.line-details {
  list-style: disc;
  padding-left: 18px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

.invoice-summary {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 20px;
}

.summary-box {
  min-width: 220px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}

.summary-box p {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.summary-box .total {
  font-size: 1.1rem;
  font-weight: 600;
}

.portal-body {
  background: linear-gradient(140deg, #f8f1ea 0%, #efe4d8 45%, #e9dccf 100%);
}

.portal-shell {
  width: min(1100px, 92vw);
  margin: 0 auto;
  padding: 24px 0 60px;
}

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

.portal-hero {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 20px;
}

.portal-meta {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.95rem;
}

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

.portal-section {
  margin-top: 28px;
}

.portal-help {
  background: #f7efe7;
}

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

.file-card {
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.file-thumb {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.file-placeholder {
  display: grid;
  place-items: center;
  height: 160px;
  border-radius: 12px;
  background: #f0e7dd;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.08em;
}

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

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

.wizard-steps {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.wizard-step-pill {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f4ede6;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
}

.wizard-step-pill.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.wizard-actions {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 12px;
}

.wizard-actions .button-row {
  margin-left: auto;
}

.wizard-radio {
  display: grid;
  gap: 8px;
}

.wizard-radio input[type="radio"] {
  margin-right: 8px;
}

.wizard-card {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #faf6f1;
}

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

  .portal-header,
  .portal-hero {
    flex-direction: column;
    align-items: flex-start;
  }

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

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .button,
  .text-link,
  .card:not(.invoice-paper),
  .invoice-layout > .card {
    display: none !important;
  }

  .invoice-paper {
    box-shadow: none;
    border: none;
  }
}
