:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --line: #dfe5ef;
  --text: #17233d;
  --muted: #66738b;
  --blue: #2f80ed;
  --green: #0c9f6e;
  --red: #dc2626;
  --amber: #c88745;
  --orange: #f36b21;
  --gold: #e9bd89;
  --dark: #203354;
  --shadow: 0 2px 8px rgba(31, 50, 81, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
  overflow-x: hidden;
}

button,
input,
select {
  min-width: 0;
  max-width: 100%;
  font: inherit;
}

.sidebar {
  background: var(--dark);
  color: #fff;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.logo {
  width: 64px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  padding: 6px;
}

.brand small {
  display: block;
  color: #b7c5df;
  margin-top: 2px;
}

nav {
  display: grid;
  gap: 8px;
}

nav button {
  border: 0;
  border-radius: 4px;
  color: #d4ddef;
  background: transparent;
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

nav button.active,
nav button:hover {
  color: #fff;
  background: #2c436c;
  box-shadow: inset 3px 0 0 var(--orange);
}

main {
  min-width: 0;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  min-height: 72px;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

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

h1 {
  margin-bottom: 4px;
  font-size: 26px;
}

h2 {
  font-size: 18px;
}

.topbar p,
.muted {
  color: var(--muted);
}

.status {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px 12px;
  background: #f0f7ff;
  color: #2363ad;
  white-space: nowrap;
}

.topbar-actions,
.user-menu {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-menu {
  border-left: 1px solid var(--line);
  padding-left: 14px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff1e8;
  color: #b84309;
  font-size: 13px;
  font-weight: 700;
}

.user-copy {
  display: grid;
  min-width: 120px;
}

.user-copy strong,
.user-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-copy strong {
  font-size: 13px;
}

.user-copy small {
  color: var(--muted);
  font-size: 11px;
}

#logoutButton {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 4px;
  padding: 8px 10px;
  cursor: pointer;
}

.login-page {
  display: block;
  min-height: 100vh;
  background: #f4f7fb;
}

.login-shell {
  width: min(960px, calc(100% - 32px));
  min-height: 560px;
  margin: 7vh auto;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 14px 40px rgba(31, 50, 81, 0.12);
}

.login-panel {
  display: flex;
  flex-direction: column;
  padding: 34px 42px 28px;
}

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

.login-brand img {
  width: 74px;
  height: 42px;
  object-fit: contain;
}

.login-brand div,
.login-brand span {
  display: grid;
}

.login-brand strong {
  font-size: 18px;
}

.login-brand span,
.login-panel footer {
  color: var(--muted);
  font-size: 12px;
}

.login-content {
  margin: auto 0;
  max-width: 440px;
}

.login-eyebrow,
.context-kicker {
  color: var(--orange);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.login-content h1 {
  font-size: 32px;
  line-height: 1.18;
  margin-bottom: 14px;
}

.login-content > p:not(.login-eyebrow) {
  color: var(--muted);
  line-height: 1.6;
}

.zoho-login-button {
  min-height: 48px;
  margin-top: 18px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #1769d2;
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  font-weight: 600;
}

.zoho-mark {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: #fff;
  color: #1769d2;
  font-weight: 800;
}

.login-error {
  margin-top: 16px;
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #a61b1b;
  padding: 12px;
  border-radius: 4px;
}

.login-context {
  background: #203354;
  color: #fff;
  padding: 44px 38px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.login-context h2 {
  max-width: 320px;
  margin-top: 10px;
  font-size: 27px;
  line-height: 1.3;
}

.login-context ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.login-context li {
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  padding-top: 13px;
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
}

.login-context li span {
  color: #cbd6e8;
  font-size: 13px;
}

.view {
  display: none;
  padding: 20px 24px;
}

.view.active {
  display: block;
}

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

input,
select {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
}

.toolbar input {
  min-width: 280px;
}

.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.deal-editor-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: #fff;
}

.deal-editor-head,
.deal-editor {
  display: grid;
  grid-template-columns: minmax(220px, 1.7fr) minmax(150px, 1fr) 140px 140px minmax(180px, 1.2fr) 170px 150px;
  gap: 10px;
  align-items: center;
  min-width: 1180px;
}

.deal-editor-head {
  padding: 10px 12px;
  background: #f3ece5;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.deal-editor {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.deal-editor label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.deal-editor label > span {
  display: none;
  color: var(--muted);
  font-size: 11px;
}

.deal-editor input,
.deal-editor select {
  width: 100%;
  min-width: 0;
  height: 36px;
  border-radius: 6px;
  font-size: 13px;
}

.deal-editor small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-deal {
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: var(--orange);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.save-deal:disabled {
  opacity: 0.65;
}

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

.explain-card,
.simple-flow {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.explain-card {
  position: relative;
  overflow: hidden;
}

.explain-card h2 {
  margin-bottom: 8px;
  font-size: 22px;
}

.explain-card p {
  color: var(--muted);
  line-height: 1.5;
}

.explain-card ul {
  margin: 16px 0 0;
  padding-left: 20px;
  color: #4d3f36;
}

.step {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  margin-bottom: 16px;
  color: #fff;
  background: var(--orange);
  font-weight: 800;
}

.zoho-card {
  border-top: 5px solid #2c7be5;
}

.core-card {
  border-top: 5px solid var(--orange);
}

.inventory-card {
  border-top: 5px solid #18a058;
}

.simple-flow h2 {
  margin-bottom: 14px;
}

.flow-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.flow-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid #f2c097;
  border-radius: 8px;
  padding: 8px 12px;
  background: #fff8f1;
  color: #6d3511;
  font-weight: 700;
}

button {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 14px;
  color: var(--text);
  background: #fff;
  cursor: pointer;
}

button:hover {
  border-color: var(--blue);
}

.kanban {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 310px;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.source-notice {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 18px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #d9e8fb;
  border-left: 4px solid var(--blue);
  background: #f4f9ff;
  color: var(--muted);
  font-size: 13px;
}

.source-notice strong {
  color: var(--text);
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.button-link:hover {
  background: #2368bd;
}

.column {
  height: calc(100vh - 330px);
  min-height: 420px;
  overflow-y: auto;
  background: #eef2f8;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 10px;
}

.column h2 {
  position: sticky;
  z-index: 2;
  top: -10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px 0 8px;
  background: #eef2f8;
}

.count {
  color: #245f9e;
  background: #dcecff;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 13px;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}

.project-card {
  cursor: grab;
  transition: border-color 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.project-card:active { cursor: grabbing; }
.project-card:hover { border-color: #9db9dd; box-shadow: 0 5px 16px rgba(32, 51, 84, 0.12); }
.project-card.dragging { opacity: 0.45; }
.column.drop-target { border-color: var(--orange); box-shadow: inset 0 0 0 2px rgba(239, 104, 35, 0.2); }
.card-operational-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; color: #52627a; font-size: 12px; }
.card-operational-row span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.next-task { margin: 8px 0; overflow: hidden; color: var(--muted); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }

.project-preview[hidden] { display: none; }
.project-preview { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 18px; }
.preview-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(21, 31, 48, 0.54); }
.preview-panel { position: relative; width: min(1500px, 97vw); height: min(850px, 94vh); overflow: hidden; border: 1px solid var(--line); background: #fff; box-shadow: 0 24px 70px rgba(20, 33, 54, 0.28); }
.preview-header { display: grid; grid-template-columns: 1fr 42px; min-height: 58px; border-bottom: 1px solid var(--line); background: #fff; }
.preview-header > button { height: 100%; border: 0; font-size: 28px; }
.preview-stages { display: flex; min-width: 0; overflow-x: auto; padding: 10px 12px; }
.preview-stages span { min-width: 140px; padding: 10px 16px; border-bottom: 3px solid #cfd6df; background: #f1f3f6; text-align: center; font-size: 12px; }
.preview-stages span.active { border-color: var(--orange); background: #fff0e7; color: #a44719; font-weight: 700; }
.preview-content { display: grid; grid-template-columns: minmax(0, 1fr) 330px; height: calc(100% - 58px); overflow: hidden; }
.preview-main { overflow-y: auto; padding: 22px; }
.preview-title-row { display: flex; align-items: center; gap: 12px; }
.preview-title-row h2 { flex: 1; margin: 0; font-size: 23px; }
.preview-section { margin-top: 24px; }
.preview-section h3 { margin-bottom: 10px; font-size: 16px; }
.related-docs > div, .preview-tasks > div { display: grid; grid-template-columns: 110px minmax(180px, 1fr) 150px 130px auto; gap: 12px; align-items: center; min-height: 48px; border-bottom: 1px solid var(--line); }
.doc-code { width: max-content; border-radius: 4px; padding: 5px 9px; background: #e7f1ff; color: #1769d2; font-weight: 700; }
.preview-tasks > div { grid-template-columns: minmax(200px, 1fr) minmax(220px, 1fr) auto; }
.preview-tasks small { color: var(--muted); }
.preview-sidebar { overflow-y: auto; border-left: 1px solid var(--line); background: #f8fafc; padding: 22px; }
.preview-sidebar dl { display: grid; gap: 5px; margin: 20px 0; }
.preview-sidebar dt { margin-top: 12px; color: var(--muted); font-size: 12px; }
.preview-sidebar dd { margin: 0; font-weight: 600; }
.preview-create-receipt { width: 100%; }
.preview-truth-note { margin-top: 18px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.modal-open { overflow: hidden; }

.receipt-layout { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(320px, 0.8fr); gap: 18px; }
.receipt-editor { border: 1px solid var(--line); background: #fff; padding: 20px; }
.receipt-fields { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
.receipt-item-editor { display: grid; grid-template-columns: minmax(220px, 1fr) 100px 150px 120px auto; gap: 8px; margin: 18px 0 8px; }
.receipt-support { margin-top: 12px; }
.receipt-support a { color: var(--blue); }
.approval-banner { display: flex; justify-content: space-between; gap: 12px; margin: 12px 0; border-left: 4px solid #e3a008; padding: 9px 12px; background: #fff8db; color: #775b00; font-size: 13px; }
.approval-banner.aprobada { border-color: #159447; background: #eaf8ef; color: #176b37; }
.approval-banner.rechazada { border-color: #d9363e; background: #fff0f1; color: #9f2028; }

@media (max-width: 900px) {
  .preview-content { grid-template-columns: 1fr; overflow-y: auto; }
  .preview-main, .preview-sidebar { overflow: visible; }
  .preview-sidebar { border-top: 1px solid var(--line); border-left: 0; }
  .related-docs > div, .preview-tasks > div { grid-template-columns: 1fr; gap: 4px; padding: 10px 0; }
  .receipt-layout { grid-template-columns: 1fr; }
  .receipt-fields { grid-template-columns: 1fr 1fr; }
  .receipt-item-editor { grid-template-columns: 1fr 1fr; }
}

.card-header,
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 5px 8px;
  background: #fff0e7;
  color: #b84c12;
  font-weight: 700;
  font-size: 13px;
}

.risk {
  color: var(--red);
}

.card h3 {
  font-size: 16px;
  margin: 12px 0 6px;
}

.card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 13px;
}

.assignment-grid {
  display: grid;
  gap: 8px;
  margin: 12px 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.assignment-field {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.assignment-field select {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
}

.assignment-field select:focus {
  border-color: var(--orange);
  outline: 2px solid #ffe3ca;
}

.assignment-field select:disabled {
  opacity: 0.65;
}

.commercial-split {
  align-items: start;
}

.commercial-item {
  display: grid;
  gap: 8px;
}

.commercial-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.ready-nx {
  color: #176b3a;
  font-size: 12px;
  font-weight: 700;
}

.document-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.document-strip span {
  border: 1px solid #f2c097;
  border-radius: 6px;
  padding: 5px 7px;
  background: #fff8f1;
  color: #6d3511;
  font-size: 12px;
  font-weight: 700;
}

.card dt {
  font-weight: 700;
  color: #475467;
}

.card-details {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.card-details summary {
  cursor: pointer;
  color: #8a4b18;
  font-weight: 700;
}

.stage-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #f3e5d8;
  font-size: 13px;
}

.stage-row em {
  color: var(--muted);
  font-style: normal;
}

.avatars {
  display: flex;
}

.avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-left: -5px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #f36b21;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

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

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.panel,
.stack .item,
.table {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px;
  box-shadow: var(--shadow);
}

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

.item h3 {
  margin: 0 0 8px;
}

.line-item,
.inventory-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.compact-table {
  display: grid;
  gap: 0;
}

.compact-table .inventory-row:first-child {
  border-top: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 12px;
  background: #fff;
}

.metric strong {
  display: block;
  font-size: 22px;
  margin-top: 4px;
}

.topbar-actions,
.live-indicator,
.module-header,
.material-picker {
  display: flex;
  align-items: center;
}

.topbar-actions {
  gap: 12px;
}

.live-indicator {
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.live-indicator i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.module-header {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.module-header h2,
.module-header p {
  margin-bottom: 4px;
}

.module-header p {
  color: var(--muted);
  font-size: 13px;
}

.primary-action {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid #2368bd;
  border-radius: 4px;
  padding: 0 14px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.primary-action:hover {
  background: #2368bd;
}

.license-note {
  margin-bottom: 16px;
  border-left: 3px solid var(--orange);
  padding: 10px 12px;
  background: #fff8f2;
  color: var(--muted);
  font-size: 13px;
}

.task-progress {
  height: 5px;
  margin: 12px 0 8px;
  overflow: hidden;
  border-radius: 3px;
  background: #e8edf5;
}

.task-progress span {
  display: block;
  height: 100%;
  background: var(--green);
}

.card-footer .zoho-record-link {
  margin-top: 0;
}

.metric-alert {
  border-color: #f3b7b7;
  background: #fff7f7;
  color: #a62d2d;
}

.precost-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.7fr);
  gap: 22px;
}

.precost-workspace,
.precost-history {
  min-width: 0;
}

.precost-main-fields {
  margin-bottom: 14px;
}

.material-picker {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 120px 130px auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  padding: 12px;
  background: #f8fafc;
}

.material-picker label,
.cost-fields label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  min-width: 0;
}

.material-picker select,
.material-picker input,
.cost-fields input {
  width: 100%;
  min-width: 0;
}

.stock-hint {
  min-height: 34px;
  padding: 8px 2px;
  color: #287052;
  font-size: 12px;
}

.precost-lines {
  margin-bottom: 14px;
  border: 1px solid var(--line);
}

.precost-line {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 120px 130px 34px;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  border-top: 1px solid var(--line);
  padding: 8px 10px;
  font-size: 13px;
}

.precost-line:first-child {
  border-top: 0;
}

.precost-line-head {
  min-height: 36px;
  background: #f1f4f9;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.precost-line small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.remove-precost-line {
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--red);
}

.cost-fields {
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  margin-bottom: 14px;
}

.metric-price {
  border-color: #acd0ff;
  background: #f2f8ff;
  color: #185da8;
}

.compact-empty {
  border: 0;
  padding: 20px;
}

.precost-record-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  font-size: 13px;
}

.precost-record-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.test-warning {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin-bottom: 12px;
  border: 1px solid #f1cfb9;
  border-left: 4px solid var(--orange);
  padding: 12px 14px;
  background: #fff9f4;
  color: var(--muted);
  font-size: 13px;
}

.test-warning strong {
  color: var(--text);
}

.test-status {
  margin-bottom: 16px;
  border: 1px solid #d9e8fb;
  padding: 10px 12px;
  background: #f4f9ff;
  color: #245f9e;
  font-size: 13px;
}

.test-workflow-list {
  display: grid;
  gap: 14px;
}

.test-workflow {
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
}

.test-workflow-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.test-workflow-head > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.test-workflow-head h3 {
  margin: 0;
  font-size: 15px;
}

.test-sync-state {
  color: var(--green);
  font-size: 12px;
}

.test-error {
  margin: 12px;
  border: 1px solid #efb3b3;
  padding: 10px;
  background: #fff4f4;
  color: #a62d2d;
}

.test-steps {
  padding: 6px 16px 12px;
}

.test-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 54px;
  border-bottom: 1px solid var(--line);
}

.test-step:last-child {
  border-bottom: 0;
}

.test-step-number {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e8f2ff;
  color: #2368bd;
  font-size: 12px;
  font-weight: 700;
}

.test-step small {
  display: block;
  margin-top: 3px;
  color: var(--green);
}

.test-step .zoho-record-link {
  margin-top: 0;
}

.flow {
  display: grid;
  gap: 10px;
  padding-left: 24px;
}

pre {
  max-height: 360px;
  overflow: auto;
  background: #101828;
  color: #e7eefc;
  border-radius: 8px;
  padding: 12px;
}

.calendar-view {
  background: #fff;
}

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

.calendar-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.calendar-filters button {
  height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--orange);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.calendar-filters button:disabled {
  opacity: 0.65;
}

.calendar-sync-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.calendar-legend {
  display: flex;
  gap: 18px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.calendar-legend i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.legend-task { background: #f36b21; }
.legend-meeting { background: #2563eb; }
.legend-call { background: #0c9f6e; }
.legend-deal { background: #b42318; }

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 18px;
  align-items: start;
}

#operationalCalendar {
  min-width: 0;
}

.event-details {
  min-height: 220px;
  border-left: 1px solid var(--line);
  padding: 8px 0 8px 18px;
}

.event-details dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  font-size: 13px;
}

.event-details dt {
  color: var(--muted);
}

.event-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.event-detail-type {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.event-source-id {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.zoho-record-link {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  border: 1px solid #d95a15;
  border-radius: 6px;
  padding: 8px 10px;
  color: #a6400b;
  background: #fff8f1;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.zoho-record-link:hover {
  border-color: #a6400b;
  background: #ffeadb;
}

.record-actions,
.inventory-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.record-actions {
  flex-wrap: wrap;
}

.record-actions .zoho-record-link,
.inventory-actions .zoho-record-link {
  margin-top: 0;
}

.inventory-actions {
  justify-content: flex-end;
}

.fc .fc-button-primary {
  border-color: #c84f0b;
  background: var(--orange);
}

.fc .fc-button-primary:hover,
.fc .fc-button-primary:not(:disabled).fc-button-active {
  border-color: #9d3c08;
  background: #c84f0b;
}

.fc .fc-toolbar-title {
  font-size: 18px;
}

.fc .fc-event {
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
}

@media (max-width: 760px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .login-shell {
    margin: 18px auto;
    grid-template-columns: 1fr;
  }

  .login-context {
    min-height: 340px;
  }

  .split,
  .grid {
    grid-template-columns: 1fr;
  }

  .kanban {
    grid-template-columns: minmax(260px, 1fr);
  }

  .column {
    height: auto;
    min-height: 0;
    overflow-y: visible;
  }

  .explain-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-metrics {
    grid-template-columns: 1fr 1fr;
  }

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

  .event-details {
    border-top: 1px solid var(--line);
    border-left: 0;
    padding: 16px 0 0;
  }

  .calendar-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .material-picker,
  .cost-fields {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 761px) and (max-width: 1100px) {
  .dashboard-metrics,
  .cost-fields {
    grid-template-columns: 1fr 1fr;
  }

  .material-picker {
    grid-template-columns: 1fr 1fr;
  }

  .precost-workspace .module-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .precost-workspace .module-header .primary-action {
    align-self: stretch;
  }
}

@media (max-width: 620px) {
  .topbar,
  .module-header,
  .topbar-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .user-menu {
    width: 100%;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 12px 0 0;
  }

  #logoutButton {
    margin-left: auto;
  }

  .login-shell {
    width: 100%;
    margin: 0;
    border: 0;
  }

  .login-panel,
  .login-context {
    padding: 28px 22px;
  }

  .login-content {
    margin: 70px 0;
  }

  .login-content h1 {
    font-size: 28px;
  }

  .view,
  .topbar {
    padding-right: 16px;
    padding-left: 16px;
  }

  .dashboard-metrics,
  .form-grid,
  .material-picker,
  .cost-fields {
    grid-template-columns: 1fr;
  }

  .precost-line,
  .precost-line-head {
    grid-template-columns: minmax(0, 1fr) 90px 30px;
  }

  .precost-line > span:nth-child(3),
  .precost-line-head > span:nth-child(3) {
    display: none;
  }

  .inventory-actions {
    align-items: flex-end;
    flex-direction: column;
  }

  .test-warning {
    grid-template-columns: 1fr;
  }

  .test-workflow-head,
  .test-workflow-head > div {
    align-items: flex-start;
    flex-direction: column;
  }

  .test-step {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .test-step .zoho-record-link {
    grid-column: 2;
  }
}
