:root {
  color-scheme: light;
  --charcoal: #373737;
  --charcoal-dark: #252525;
  --charcoal-soft: #5f5d65;
  --paper: #ffffff;
  --page: #f7f6f8;
  --wash: #f4f1f7;
  --blush: #d9b7b0;
  --ink: #373737;
  --muted: #68666d;
  --line: #dedee2;
  --danger: #8f343a;
  --danger-bg: #fff1f1;
  --shadow: 0 7px 22px rgba(37, 37, 37, 0.07);
  --radius: 14px;
  --content: 1040px;
  font-family: Arial, Helvetica, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--page); scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 5%, rgba(232, 221, 240, 0.45), transparent 25rem),
    radial-gradient(circle at 5% 30%, rgba(255, 239, 236, 0.38), transparent 22rem),
    var(--page);
}
button, input, textarea { font-family: Arial, Helvetica, sans-serif; }
button { cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }

.brand-header {
  color: var(--charcoal-dark);
  background: var(--paper);
  border-bottom: 1px solid #e3e3e6;
}
.brand-inner {
  width: min(var(--content), calc(100% - 40px));
  min-height: 70px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand-logo { display: block; width: 140px; height: auto; }
.brand-inner h1 {
  margin: 0;
  color: var(--charcoal-dark);
  font-size: 1.55rem;
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.data-error {
  padding: 11px 20px;
  color: #742b31;
  background: #fff1f1;
  border-bottom: 1px solid #e3b7ba;
  text-align: center;
  font-size: 10pt;
  font-weight: 750;
}

.app-shell {
  width: min(var(--content), calc(100% - 40px));
  min-height: 72vh;
  margin: 0 auto;
  padding: 14px 0 42px;
}
.planner-toolbar { margin-bottom: 10px; }
.main-actions { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 8px; }

.button, .link-button, .customer-card {
  border: 0;
  color: inherit;
  background: none;
}
.button {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 11pt;
  font-weight: 750;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button-primary { color: white; background: #1f1f1f; }
.button-primary:hover { background: var(--charcoal-dark); }
.button-secondary { color: white; background: #4a4a4a; border-color: #4a4a4a; }
.button-secondary:hover { background: #303030; border-color: #303030; }
.button-quiet { color: var(--charcoal); background: white; border-color: #cfcfd4; }
.button-quiet:hover { background: #f5f5f6; }
.button-danger { color: var(--danger); background: var(--danger-bg); border-color: #eed3d5; }
.button-danger:hover { background: #fde5e6; }
.button-small { min-height: 36px; padding: 7px 12px; font-size: 10pt; }
.link-button { padding: 0; text-decoration: underline; }
button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(55, 55, 55, 0.28);
  outline-offset: 2px;
}

.customer-finder {
  margin-bottom: 10px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.finder-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}
.finder-heading h3 { margin: 0; color: var(--charcoal-dark); font-size: 1.4rem; }
.customer-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 25px;
  height: 25px;
  margin-left: 5px;
  padding: 0 7px;
  color: white;
  background: var(--charcoal);
  border-radius: 999px;
  font-size: 10pt;
  vertical-align: 2px;
}
.search-field { width: min(360px, 100%); }
.search-field span, .field label {
  display: block;
  margin: 0 0 5px;
  color: #3d3c40;
  font-size: 10pt;
  font-weight: 750;
  letter-spacing: 0.01em;
  line-height: 1.25;
}
.search-field input, .field input, .field textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  color: #222222;
  background: white;
  border: 1px solid #c4c4c9;
  border-radius: 7px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11pt;
  line-height: 1.3;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.search-field input:hover, .field input:hover, .field textarea:hover { border-color: #8d8c93; }
.search-field input:focus, .field input:focus, .field textarea:focus {
  border-color: var(--charcoal-soft);
  box-shadow: 0 0 0 3px rgba(55, 55, 55, 0.09);
}
.field textarea { display: block; min-height: 88px; resize: vertical; overflow-y: hidden; }
.customer-list { min-width: 0; display: flex; flex-wrap: wrap; align-items: stretch; gap: 7px; }
.customer-card {
  flex: 0 1 190px;
  width: 190px;
  min-width: 0;
  min-height: 50px;
  padding: 8px 10px;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.customer-card:hover { border-color: #8f8e95; }
.customer-card.is-active { color: white; background: var(--charcoal); border-color: var(--charcoal); }
.customer-card strong, .customer-card span { display: block; overflow: hidden; text-overflow: ellipsis; }
.customer-card strong { margin-bottom: 2px; font-size: 11pt; white-space: nowrap; }
.customer-card span { opacity: 0.78; font-size: 9pt; line-height: 1.2; white-space: nowrap; }
.list-empty { width: 100%; padding: 14px 8px; color: var(--muted); text-align: center; font-size: 10pt; }

.meeting-editor {
  min-height: 320px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.empty-editor { padding: 48px 22px; text-align: center; }
.empty-editor h3 { margin: 0 0 7px; }
.empty-editor p { margin: 0 0 16px; color: var(--muted); }
.editor-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 10px 14px 10px 17px;
  color: white;
  background: var(--charcoal);
  border-left: 6px solid var(--blush);
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
}
.editor-header h3 { margin: 0; font-size: 1.35rem; }
.editor-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.editor-actions .button-quiet { color: var(--charcoal); }
.back-to-customers { display: none; }
.form-section { border-top: 1px solid #ececef; }
.form-section:first-of-type { border-top: 0; }
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 43px;
  padding: 8px 14px;
  color: var(--charcoal);
  background: var(--wash);
  border-left: 6px solid var(--blush);
}
.section-heading h4 {
  margin: 0;
  color: var(--charcoal-dark);
  font-size: 11pt;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}
.section-heading span { color: #67656b; font-size: 10pt; font-weight: 850; letter-spacing: 0.06em; }
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; padding: 14px; }
.field { grid-column: span 6; min-width: 0; }
.field-spacer { height: 10px; }
.field-full { grid-column: 1 / -1; }
.field-quarter { grid-column: span 3; }
.field-date { grid-column: span 3; }
.field-time { grid-column: span 2; }
.field-location { grid-column: span 4; }
.field-priority { grid-column: span 3; }
.field textarea.tall { min-height: 118px; }
.form-bottom-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px 14px;
  border-top: 1px solid #ececef;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  max-width: min(390px, calc(100% - 36px));
  padding: 12px 15px;
  color: white;
  background: var(--charcoal-dark);
  border-left: 5px solid var(--blush);
  border-radius: 10px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
  font-size: 10pt;
  font-weight: 700;
}
.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  width: min(var(--content), calc(100% - 40px));
  margin: 0 auto;
  padding: 16px 0 22px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 10pt;
}

@media (max-width: 920px) {
  .field-quarter { grid-column: span 6; }
}

@media (max-width: 640px) {
  .brand-inner { width: calc(100% - 24px); min-height: 58px; gap: 12px; }
  .brand-logo { width: 104px; }
  .brand-inner h1 { font-size: 1.1rem; }
  .app-shell { width: calc(100% - 20px); padding: 10px 0 34px; }
  .planner-toolbar { margin-bottom: 8px; }
  .main-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; gap: 7px; }
  .main-actions .button { width: 100%; min-height: 44px; padding-inline: 8px; }
  .main-actions .button-primary { grid-column: 1 / -1; }
  .customer-finder { padding: 11px; }
  .finder-heading { align-items: stretch; flex-direction: column; gap: 9px; }
  .finder-heading h3 { font-size: 1.3rem; }
  .search-field { width: 100%; }
  .search-field input, .field input, .field textarea { font-size: 16px; }
  .customer-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer-card { width: 100%; min-height: 50px; padding: 8px 9px; }
  .editor-header { position: sticky; align-items: flex-start; flex-direction: column; padding: 10px 12px; }
  .editor-header h3 { font-size: 1.2rem; }
  .editor-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .editor-actions .button { width: 100%; min-height: 42px; padding-inline: 6px; }
  .back-to-customers { display: inline-flex; align-items: center; justify-content: center; }
  .section-heading { min-height: 40px; padding: 8px 11px; }
  .section-heading h4 { font-size: 11pt; }
  .section-heading span { font-size: 9pt; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 11px; }
  .field, .field-full { grid-column: 1 / -1; }
  .field-quarter, .field-date, .field-time, .field-location, .field-priority { grid-column: span 1; }
  .field textarea { min-height: 88px; }
  .field textarea.tall { min-height: 118px; }
  .form-bottom-actions { display: grid; grid-template-columns: 1fr 1fr; padding: 11px; }
  .form-bottom-actions .button { width: 100%; min-height: 44px; padding-inline: 7px; }
  .site-footer { width: calc(100% - 24px); gap: 8px; padding-block: 14px 20px; font-size: 9pt; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
