:root {
  --ink: #171717;
  --charcoal: #2d2b28;
  --muted: #77716b;
  --line: #ded7ca;
  --cream: #f8f3e9;
  --paper: #fffdf8;
  --gold: #d4aa2f;
  --gold-dark: #9a7818;
  --danger: #a93a2d;
  --success: #23724b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.app-header {
  align-items: center;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  justify-content: space-between;
  min-height: 88px;
  padding: 18px 28px;
}

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

.brand img {
  background: var(--paper);
  border-radius: 4px;
  height: 52px;
  object-fit: contain;
  padding: 5px 8px;
  width: 150px;
}

.eyebrow {
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 1.35rem;
  margin-bottom: 0;
}

h2 {
  font-size: 1.7rem;
  margin-bottom: 0;
}

h3 {
  font-size: 1rem;
  margin-bottom: 12px;
}

.header-actions,
.button-row,
.section-title {
  align-items: center;
  display: flex;
  gap: 10px;
}

.sync-status {
  background: rgba(255, 253, 248, 0.1);
  border: 1px solid rgba(255, 253, 248, 0.22);
  border-radius: 999px;
  color: #f1e8d9;
  font-size: 0.86rem;
  padding: 8px 12px;
}

.sync-status.ok {
  border-color: rgba(212, 170, 47, 0.5);
  color: #f6da81;
}

.sync-status.error {
  border-color: rgba(255, 130, 110, 0.55);
  color: #ffb4a6;
}

.app-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 88px);
}

.side-nav {
  background: #211f1d;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 12px;
}

.nav-link {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #f2ebde;
  font-weight: 700;
  padding: 12px 14px;
  text-align: left;
}

.nav-link.active,
.nav-link:hover {
  background: var(--gold);
  color: var(--ink);
}

.workspace {
  padding: 26px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(23, 23, 23, 0.06);
  padding: 18px;
}

.form-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
}

label {
  color: var(--charcoal);
  display: grid;
  font-size: 0.86rem;
  font-weight: 800;
  gap: 7px;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid #d8d0c2;
  border-radius: 6px;
  color: var(--ink);
  min-height: 40px;
  padding: 9px 10px;
  width: 100%;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 170, 47, 0.22);
  outline: none;
}

.primary-button,
.secondary-button,
.ghost-button {
  border-radius: 6px;
  border: 1px solid transparent;
  font-weight: 900;
  min-height: 40px;
  padding: 9px 14px;
}

.primary-button {
  background: var(--gold);
  color: var(--ink);
}

.secondary-button {
  background: var(--charcoal);
  color: var(--paper);
}

.ghost-button {
  background: transparent;
  border-color: rgba(255, 253, 248, 0.28);
  color: var(--paper);
}

.full {
  width: 100%;
}

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

.table-wrap {
  overflow-x: auto;
}

.data-table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 11px 9px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.data-table td.actions {
  white-space: nowrap;
}

.mini-button {
  background: #eee6d8;
  border: 1px solid #d8d0c2;
  border-radius: 5px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  margin-right: 6px;
  padding: 6px 8px;
}

.mini-button.danger {
  background: #f4ddd9;
  border-color: #e3b5ac;
  color: var(--danger);
}

.quote-bottom {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr 330px;
  margin-top: 18px;
}

.notes-panel {
  display: grid;
}

.totals-panel {
  display: grid;
  gap: 12px;
}

.switch-line {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.switch-line input {
  height: 20px;
  min-height: auto;
  width: 20px;
}

.totals {
  display: grid;
  gap: 8px;
  margin: 4px 0;
}

.totals div,
.meta-list div {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.totals dt,
.meta-list dt {
  color: var(--muted);
  font-weight: 800;
}

.totals dd,
.meta-list dd {
  font-weight: 900;
  margin: 0;
  text-align: right;
}

.grand-total {
  border-top: 2px solid var(--ink);
  font-size: 1.18rem;
  padding-top: 10px;
}

.form-actions {
  align-items: end;
  display: flex;
}

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

.service-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.service-card .code {
  background: var(--ink);
  border-radius: 5px;
  color: var(--gold);
  display: inline-block;
  font-weight: 900;
  margin-bottom: 10px;
  padding: 4px 8px;
}

.service-card p {
  color: var(--muted);
  line-height: 1.45;
}

.price {
  font-weight: 900;
}

.search-input {
  max-width: 360px;
}

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

.backup-grid p {
  color: var(--muted);
  line-height: 1.5;
}

@media (max-width: 1100px) {
  .form-grid,
  .services-grid,
  .backup-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quote-bottom {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .app-header,
  .view-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

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

  .nav-link {
    white-space: nowrap;
  }

  .form-grid,
  .services-grid,
  .backup-grid {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 18px;
  }
}
