/* Export Quote Assistant — Google (Material / Cloud Console) look and feel.
   Colour, type and elevation tokens are DocAI's frontend/gcp-style.css,
   so both KavayaM products look the same. No external fonts are loaded
   (the CSP allows only this site): Google Sans or Roboto when installed,
   otherwise the system sans-serif. */

:root {
  /* Google colours (from DocAI gcp-style.css) */
  --gcp-blue: #1a73e8;
  --gcp-blue-dark: #185abc;
  --gcp-blue-light: #e8f0fe;
  --gcp-red: #d93025;
  --gcp-red-light: #fce8e6;
  --gcp-green: #188038;
  --gcp-green-light: #e6f4ea;
  --gcp-yellow: #fbbc04;

  /* Neutrals */
  --bg-primary: #f8f9fa;
  --bg-secondary: #ffffff;
  --bg-hover: #f1f3f4;
  --border-color: #dadce0;
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --text-light: #80868b;

  /* Material elevation */
  --shadow-sm: 0 1px 2px 0 rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15);
  --shadow-md: 0 1px 3px 0 rgba(60, 64, 67, .3), 0 4px 8px 3px rgba(60, 64, 67, .15);

  --radius: 8px;
  --radius-control: 4px;
  --font: "Google Sans", Roboto, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --font-text: Roboto, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* `hidden` must win over the display rules below (buttons, banners). */
[hidden] { display: none !important; }

body {
  margin: 0;
  font: 14px/1.5 var(--font-text);
  color: var(--text-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand, .headline .big { font-family: var(--font); }
a { color: var(--gcp-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Top app bar ------------------------------------------------------- */

header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
  padding: 0 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
}
header .brand { font-size: 20px; font-weight: 400; color: var(--text-secondary); }
header .brand:hover { text-decoration: none; color: var(--text-primary); }
header nav { display: flex; align-self: stretch; gap: 4px; flex: 1; }
header nav a {
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: var(--text-secondary);
  font-family: var(--font);
  font-weight: 500;
  border-bottom: 3px solid transparent;
}
header nav a:hover { color: var(--text-primary); background: var(--bg-hover); text-decoration: none; }
header nav a.active { color: var(--gcp-blue); border-bottom-color: var(--gcp-blue); }
header .who { color: var(--text-secondary); font-size: 13px; }

/* ---- Layout and cards -------------------------------------------------- */

main { max-width: 1040px; margin: 0 auto; padding: 24px; }
main.narrow { max-width: 448px; padding-top: 48px; }

.card {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; }
.card h2 { margin: 0 0 16px; font-size: 18px; font-weight: 400; color: var(--text-primary); }
.card h3 {
  margin: 24px 0 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 16px; }
form.grid > div { display: flex; align-items: flex-end; }
main.narrow form { display: flex; flex-direction: column; gap: 16px; }

/* ---- Form fields (Material outlined) ---------------------------------- */

label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 500; color: var(--text-secondary); }
label.check { flex-direction: row; align-items: center; gap: 10px; font-size: 14px; font-weight: 400; color: var(--text-primary); }
label.check input { width: 18px; height: 18px; accent-color: var(--gcp-blue); }

input, select {
  font: 14px var(--font-text);
  color: var(--text-primary);
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-control);
  background: var(--bg-secondary);
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover { border-color: var(--text-primary); }
input:focus, select:focus {
  outline: none;
  border-color: var(--gcp-blue);
  box-shadow: inset 0 0 0 1px var(--gcp-blue);
}
input:disabled { background: var(--bg-primary); color: var(--text-light); border-color: var(--border-color); }
input.invalid, select.invalid { border-color: var(--gcp-red); box-shadow: inset 0 0 0 1px var(--gcp-red); }
input[type=checkbox], input[type=radio] { height: auto; accent-color: var(--gcp-blue); }

/* ---- Buttons (Material: outlined, filled, text) ------------------------ */

button, a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 24px;
  margin: 4px 0 16px;
  font: 500 14px var(--font);
  letter-spacing: .25px;
  color: var(--gcp-blue);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-control);
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
}
button:hover { background: var(--gcp-blue-light); }
button.primary, a.button.primary { color: #fff; background: var(--gcp-blue); border-color: var(--gcp-blue); }
button.primary:hover, a.button.primary:hover { background: var(--gcp-blue-dark); box-shadow: var(--shadow-sm); text-decoration: none; }
button.link { height: auto; padding: 4px 8px; margin: 0; border: none; background: none; }
button.link:hover { background: var(--bg-hover); }
button.danger, button.link.danger { color: var(--gcp-red); }
button.danger:not(.link):hover { background: var(--gcp-red-light); }
button:disabled { opacity: .38; cursor: default; box-shadow: none; }

/* ---- Messages (Material banners) --------------------------------------- */

.message { border-radius: var(--radius-control); padding: 12px 16px; margin-bottom: 16px; font-size: 14px; }
.message.error { background: var(--gcp-red-light); color: var(--gcp-red); }
.message.ok { background: var(--gcp-green-light); color: var(--gcp-green); }
.errors {
  position: sticky;
  bottom: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-control);
  background: #323232;
  color: #fff;
  box-shadow: var(--shadow-md);
}
.hint { color: var(--text-secondary); font-size: 13px; margin: 0 0 8px; }
.ok { color: var(--gcp-green); }
.warn { color: var(--gcp-red); }

/* ---- Tables (Cloud Console data tables) -------------------------------- */

table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
th { font-size: 12px; font-weight: 500; color: var(--text-secondary); background: var(--bg-secondary); }
tr:hover td { background: var(--bg-primary); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.actions { white-space: nowrap; }
tr.selected td { background: var(--gcp-blue-light); }
table.lines input { width: 150px; text-align: right; }
.basis { color: var(--text-secondary); font-size: 12px; }

/* ---- Calculator specifics ----------------------------------------------- */

.result-block { border: 1px solid var(--border-color); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }
label.option {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius-control);
  font-size: 14px;
  font-weight: 400;
  color: var(--text-primary);
  cursor: pointer;
}
label.option:hover { background: var(--bg-hover); }
label.option.primary-option { font-weight: 500; }

.headline { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 8px; }
.headline div {
  display: flex;
  flex-direction: column;
  flex: 1 1 200px;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}
.headline .big { font-size: 28px; font-weight: 400; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.headline .small { color: var(--text-secondary); font-size: 12px; }

.save-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.save-row label { min-width: 320px; }
.save-row button { margin: 0; }

/* ---- Calculator steps and summary ------------------------------------- */

main.wide { max-width: 1280px; }

.steps {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}
.steps .step {
  height: 48px;
  margin: 0;
  padding: 0 20px;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--text-secondary);
}
.steps .step:hover { background: var(--bg-hover); color: var(--text-primary); }
.steps .step.active { color: var(--gcp-blue); border-bottom-color: var(--gcp-blue); }
.steps .step .num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  border-radius: 50%;
  font-size: 12px;
  color: #fff;
  background: var(--text-light);
}
.steps .step.active .num { background: var(--gcp-blue); }
.steps .step.has-error { color: var(--gcp-red); }
.steps .step.has-error .num { background: var(--gcp-red); }
.steps .sample { margin-left: auto; }

.calc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; align-items: start; }
.step-nav { display: flex; justify-content: space-between; margin-top: 8px; }
.step-nav button { margin: 0; }

.summary { position: sticky; top: 88px; }
.summary dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 12px; margin: 0; font-size: 13px; }
.summary dt { color: var(--text-secondary); }
.summary dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.summary .empty { color: var(--text-light); }
.summary-price {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}
.summary-price .big { font: 400 24px var(--font); font-variant-numeric: tabular-nums; }
.summary-price .small { color: var(--text-secondary); font-size: 12px; }
.summary-price.stale .big { color: var(--text-light); text-decoration: line-through; }
.summary-price.stale::after { content: "Inputs changed: calculate again"; color: var(--gcp-red); font-size: 12px; }

@media (max-width: 860px) {
  .calc-layout { grid-template-columns: 1fr; }
  .summary { position: static; }
  .steps { flex-wrap: wrap; }
  .steps .step { flex: 1 1 45%; padding: 0 8px; }
  .steps .sample { margin: 8px 0; }
  main.wide { padding: 12px; }
  .card { padding: 16px; overflow-x: auto; }
  .headline div { flex-basis: 100%; }
  table.lines input { width: 110px; }
}

/* ---- Freight rates ------------------------------------------------------ */

tr.expired td { color: var(--text-light); }
.chip {
  display: inline-block;
  padding: 0 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  line-height: 20px;
}
.warn-chip { background: var(--gcp-red-light); color: var(--gcp-red); }
.ok-chip { background: var(--gcp-green-light); color: var(--gcp-green); }
.freight-notes { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-color); }
.freight-notes ul { margin: 0 0 8px; padding-left: 20px; font-size: 13px; }
.freight-notes li { margin: 2px 0; }
