:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #f0f5f3;
  --text: #1c2522;
  --muted: #66736e;
  --line: #d7ddd8;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --warn: #9a3412;
  --shadow: 0 14px 40px rgba(28, 37, 34, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 48px) 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand-heading {
  display: grid;
  gap: 8px;
}

.prink-logo {
  display: block;
  width: clamp(118px, 20vw, 172px);
  height: auto;
}

.app-header h1,
.panel-heading h2 {
  margin: 0;
  letter-spacing: 0;
}

.app-header h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.tab {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.tab.is-active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(28, 37, 34, 0.08);
}

main {
  padding: 28px clamp(18px, 4vw, 48px) 48px;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.calculator-panel {
  max-width: 860px;
  margin: 0 auto;
}

.calculator-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(240px, 320px);
  gap: 18px;
  align-items: stretch;
}

.calculator-fields {
  min-width: 0;
}

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

.settings-panel {
  align-self: start;
}

.table-panel {
  min-width: 0;
}

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

.panel-heading {
  margin-bottom: 22px;
}

.panel-heading.inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading h2 {
  font-size: 22px;
  line-height: 1.15;
}

.field,
.check-row {
  display: grid;
  gap: 8px;
}

.field {
  grid-template-rows: 18px 44px;
  align-content: start;
}

.field span,
.check-row span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 18px;
}

.field input,
.field select,
td input,
td select {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--text);
  background: #fff;
  line-height: 1.2;
}

.field + .field,
.field-grid,
.option-row,
.charge-panel {
  margin-top: 18px;
}

.charge-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.charge-panel legend {
  padding: 0 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

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

.field-grid .field {
  margin-top: 0;
}

.option-row {
  display: grid;
  gap: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.check-row {
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.field.is-disabled,
.option-row.is-disabled .field {
  opacity: 0.48;
}

.total-box {
  display: grid;
  gap: 8px;
  padding: 26px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, #0f766e, #224b63);
}

.compact-total {
  align-content: center;
  min-height: 100%;
}

.total-box span {
  font-size: 14px;
  font-weight: 700;
  opacity: 0.86;
}

.total-box strong {
  font-size: clamp(40px, 6vw, 64px);
  line-height: 1;
}

.total-breakdown {
  display: grid;
  gap: 7px;
  margin: 18px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.28);
}

.total-breakdown div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.total-breakdown div.is-zero {
  opacity: 0.46;
}

.total-breakdown dt,
.total-breakdown dd {
  margin: 0;
  font-size: 14px;
  line-height: 1.25;
}

.total-breakdown dt {
  opacity: 0.86;
}

.total-breakdown dd {
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.hidden-calculation {
  display: none;
}

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

.primary-button,
.secondary-button,
.danger-button {
  min-height: 40px;
  border-radius: 6px;
  padding: 9px 12px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--accent);
  color: #fff;
  background: var(--accent);
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--surface);
}

.danger-button {
  border: 1px solid rgba(154, 52, 18, 0.35);
  color: var(--warn);
  background: #fff7ed;
}

.small {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 13px;
}

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

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

th,
td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

td.calculated {
  color: var(--accent-dark);
  font-weight: 800;
  white-space: nowrap;
}

#toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 320px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--text);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

#toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .calculator-grid,
  .prices-layout {
    grid-template-columns: 1fr;
  }

  .compact-total {
    min-height: 160px;
  }
}

@media (max-width: 680px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs {
    width: 100%;
  }

  .tab {
    flex: 1;
  }

  .field-grid,
  .panel-heading.inline {
    grid-template-columns: 1fr;
  }

  .panel-heading.inline {
    display: grid;
  }

  .panel {
    padding: 18px;
  }
}

/* Agenda Prink integration */

:root {
  --bg: transparent;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --text: #17191d;
  --muted: #656b75;
  --line: #dde1e6;
  --accent: #e3062e;
  --accent-dark: #b90024;
  --shadow: 0 1px 2px rgba(23, 25, 29, 0.04), 0 10px 28px rgba(23, 25, 29, 0.06);
}

html,
body {
  background: transparent;
  min-height: 0;
  overflow-x: hidden;
}

.app-header {
  background: transparent;
  border-bottom: 0;
  gap: 12px;
  justify-content: flex-start;
  padding: 0 1px 14px;
  position: static;
}

.brand-heading {
  display: none;
}

.tool-header-actions {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  width: 100%;
}

.sync-status {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  font-weight: 750;
  gap: 6px;
}

.sync-status::before {
  background: #9aa0a9;
  border-radius: 50%;
  content: "";
  height: 7px;
  width: 7px;
}

.sync-status[data-state="synced"]::before {
  background: #18864b;
  box-shadow: 0 0 0 3px rgba(24, 134, 75, 0.12);
}

.sync-status[data-state="loading"]::before {
  background: #d28a13;
}

main {
  padding: 0 1px 30px;
}

.tabs {
  background: #eef0f3;
  border-color: var(--line);
}

.tab.is-active {
  background: #17191d;
  color: #fff;
}

.panel {
  border-radius: 7px;
}

.primary-button {
  background: #e3062e;
  border-color: #e3062e;
}

.primary-button:hover {
  background: #b90024;
}

.total-box {
  background: #17191d;
}

@media (max-width: 720px) {
  .app-header {
    padding-bottom: 12px;
  }

  .tool-header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .tab {
    min-height: 42px;
  }
}
