:root {
  --ink: #213b50;
  --muted: #71869a;
  --navy: #173b57;
  --blue: #2f80b7;
  --teal: #159c92;
  --mint: #e8f7f4;
  --pale-blue: #edf5fb;
  --pale-amber: #fff5df;
  --amber: #d18c28;
  --line: #d8e2ea;
  --paper: #ffffff;
  --bg: #eef3f7;
  --shadow: 0 14px 35px rgba(32, 70, 97, 0.08);
  font-family: "Segoe UI", "Yu Gothic", Meiryo, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.login-page { display: grid; place-items: center; padding: 24px; }
.login-card { width: min(460px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 22px; background: var(--paper); box-shadow: var(--shadow); }
.login-topline { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.brand-mark { color: var(--navy); font-size: 26px; font-weight: 800; letter-spacing: .08em; }
.login-card h1 { margin: 8px 0 12px; font-size: 24px; line-height: 1.4; }
.login-copy { color: var(--muted); line-height: 1.7; }
.demo-credentials { display: grid; gap: 5px; margin-top: 22px; padding: 14px; border-radius: 12px; background: var(--pale-blue); color: var(--muted); font-size: 13px; }
.demo-credentials strong { color: var(--navy); }

.app-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.side-nav { display: flex; flex-direction: column; gap: 28px; padding: 27px 17px; background: #f8fafc; border-right: 1px solid var(--line); }
.brand-block { padding: 6px 9px; }
.brand-block p { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.nav-list { display: grid; gap: 7px; }
.nav-item { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 12px 13px; border: 0; border-radius: 10px; background: transparent; color: var(--ink); text-align: left; }
.nav-item:hover, .nav-item.active { background: var(--pale-blue); color: var(--blue); }
.nav-item b { color: var(--muted); font-size: 12px; }
.nav-item.active b { color: var(--blue); }
.safety-note { display: grid; gap: 5px; margin-top: auto; padding: 13px; border: 1px solid #f0d9a0; border-radius: 10px; background: var(--pale-amber); color: #8d6c2c; font-size: 11px; line-height: 1.5; }

.main-shell { min-width: 0; }
.top-bar { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 27px 34px 21px; background: var(--paper); border-bottom: 1px solid var(--line); }
.top-bar h1 { margin: 3px 0 0; font-size: clamp(18px, 2.3vw, 27px); line-height: 1.3; }
.account-actions { display: flex; align-items: center; gap: 10px; }
.user-badge { padding: 8px 12px; border-radius: 999px; background: var(--mint); color: var(--teal); font-size: 13px; white-space: nowrap; }
.quiet-button { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--muted); }
.content-area { max-width: 1450px; margin: 0 auto; padding: 30px 34px 48px; }
.view-section { animation: fade-in .18s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 20px; }
.section-heading h2 { margin: 3px 0 0; font-size: 28px; }
.eyebrow { margin: 0; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.metric-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 23px; }
.metric-card { display: flex; align-items: baseline; gap: 7px; padding: 17px 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); box-shadow: 0 6px 16px rgba(32, 70, 97, 0.04); }
.metric-card span { color: var(--muted); font-size: 12px; }
.metric-card strong { margin-left: auto; color: var(--navy); font-size: 28px; }
.metric-card small { color: var(--muted); }
.metric-card.mint { background: var(--mint); border-color: #ccebe5; }

.primary-button { display: inline-flex; justify-content: center; align-items: center; min-height: 42px; padding: 10px 16px; border: 0; border-radius: 9px; background: var(--blue); color: white; font-weight: 700; box-shadow: 0 5px 12px rgba(47, 128, 183, .2); }
.primary-button:hover { filter: brightness(.96); }
.primary-button.compact { min-height: 36px; padding: 7px 13px; }
.secondary-button { display: inline-flex; justify-content: center; align-items: center; min-height: 39px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); color: var(--navy); font-weight: 700; }
.danger-button { border: 1px solid #e7b8b8; background: #fff4f4; color: #ae5151; }
.contact-card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 15px; }
.contact-card { display: grid; gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); text-align: left; box-shadow: 0 7px 17px rgba(32, 70, 97, .04); }
.contact-card.selected { border: 2px solid var(--blue); padding: 17px; background: var(--pale-blue); }
.contact-card-top { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.contact-card h3 { margin: 0; color: var(--navy); font-size: 18px; }
.contact-card p { margin: 0; line-height: 1.6; }
.card-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; color: var(--muted); font-size: 12px; }
.card-meta strong { display: block; margin-top: 3px; color: var(--ink); font-size: 13px; }
.status-pill { display: inline-flex; align-items: center; justify-content: center; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.status-pill.info { background: var(--pale-blue); color: var(--blue); }
.status-pill.open { background: var(--pale-amber); color: #9a7025; }
.status-pill.confirmed { background: var(--mint); color: var(--teal); }
.status-pill.in_progress { background: #edf0ff; color: #5d66b1; }
.status-pill.completed { background: #eaf5e7; color: #4b8c40; }

.split-panel, .workspace-grid { display: grid; grid-template-columns: minmax(280px, .9fr) minmax(300px, 1.1fr); gap: 17px; align-items: start; }
.workspace-grid { grid-template-columns: minmax(310px, .8fr) minmax(350px, 1.2fr); }
.workspace-left { display: grid; gap: 17px; }
.panel-card { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: 0 6px 17px rgba(32, 70, 97, .04); }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.panel-heading h3 { margin: 0; color: var(--navy); font-size: 17px; }
.muted-text { color: var(--muted); font-size: 12px; }
.stack-form { display: grid; gap: 13px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
input, textarea, select { width: 100%; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47, 128, 183, .12); }
textarea { resize: vertical; }
.form-grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.check-row { display: flex; grid-template-columns: none; align-items: center; gap: 8px; }
.check-row input { width: 16px; height: 16px; }
.form-message { min-height: 17px; margin: 0; color: var(--teal); font-size: 12px; }
.form-error { min-height: 18px; margin: 0; color: #ae5151; font-size: 12px; }
.simple-list { display: grid; gap: 9px; }
.horse-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #fbfdff; }
.horse-row strong { display: block; color: var(--navy); }
.horse-row small { color: var(--muted); }
.contact-list { display: grid; gap: 8px; }
.contact-list button { display: grid; gap: 5px; width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #fbfdff; color: var(--ink); text-align: left; }
.contact-list button:hover, .contact-list button.selected { border-color: var(--blue); background: var(--pale-blue); }
.contact-list strong { color: var(--navy); }
.contact-list span { color: var(--muted); font-size: 12px; }
.detail-panel { min-height: 500px; }
.detail-header { display: flex; justify-content: space-between; gap: 12px; align-items: start; margin-bottom: 18px; }
.detail-header h3 { margin: 0; color: var(--navy); font-size: 22px; }
.detail-block { display: grid; gap: 6px; margin-bottom: 13px; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: #fbfdff; }
.detail-label { color: var(--muted); font-size: 11px; font-weight: 700; }
.detail-value { line-height: 1.6; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 9px; margin: 17px 0; }
.manager-check { background: var(--pale-amber); border-color: #f0d9a0; }
.audit-list { display: grid; gap: 1px; }
.audit-row { display: grid; grid-template-columns: 150px 120px 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.audit-row:last-child { border-bottom: 0; }
.audit-row time, .audit-row small { color: var(--muted); }
.empty-state { display: grid; place-items: center; min-height: 300px; color: var(--muted); text-align: center; }
.app-footer { padding: 14px 34px 21px; color: var(--muted); font-size: 12px; text-align: center; }

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .side-nav { gap: 12px; padding: 15px 18px 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand-block { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 0; }
  .brand-block p { margin: 0; text-align: right; }
  /* Navigation is a compact grid on smaller screens: never a horizontal rail. */
  .nav-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; overflow: visible; }
  .nav-item { min-width: 0; min-height: 42px; padding: 8px 9px; gap: 5px; font-size: 13px; }
  .nav-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-item b { flex: 0 0 auto; }
  .safety-note { display: none; }
  .top-bar { padding: 20px 18px 16px; }
  .content-area { padding: 22px 18px 35px; }
  .split-panel, .workspace-grid { grid-template-columns: 1fr; }
  .detail-panel { min-height: 0; }
  .app-footer { padding: 13px 18px 19px; }
}
@media (max-width: 560px) {
  .top-bar { align-items: start; flex-direction: column; }
  .account-actions { width: 100%; justify-content: space-between; }
  .metric-row { grid-template-columns: 1fr 1fr; }
  .section-heading { align-items: start; flex-direction: column; }
  .form-grid.two { grid-template-columns: 1fr; }
  .audit-row { grid-template-columns: 1fr; gap: 3px; }
  .brand-block p { display: none; }
  .nav-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* UI pass: calm, action-first hierarchy */
:root {
  --ink: #29413d;
  --muted: #71817c;
  --navy: #23483f;
  --blue: #397d70;
  --teal: #3f8f7c;
  --mint: #e8f4ee;
  --pale-blue: #eff7f3;
  --pale-amber: #fff8e8;
  --amber: #a77d39;
  --line: #d9e6df;
  --paper: #ffffff;
  --bg: #f5f8f6;
  --shadow: 0 12px 32px rgba(37, 78, 61, .07);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Yu Gothic", Meiryo, sans-serif;
}

body { background: var(--bg); color: var(--ink); }
.side-nav { background: #fbfdfc; border-color: var(--line); }
.brand-mark, .top-bar h1, .section-heading h2, .panel-heading h3, .contact-card h3, .detail-header h3, .horse-row strong, .contact-list strong { color: var(--navy); }
.nav-item { min-height: 46px; border-radius: 12px; }
.nav-item:hover, .nav-item.active { background: var(--mint); color: var(--teal); }
.nav-item.active b { color: var(--teal); }
.top-bar { background: rgba(255,255,255,.94); border-color: var(--line); }
.content-area { padding-top: 34px; }
.section-heading h2 { letter-spacing: -.02em; }
.section-subtitle, .panel-caption { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.today-layout { display: grid; grid-template-columns: minmax(330px, .9fr) minmax(320px, 1.1fr); gap: 20px; align-items: start; }
.next-action-card { position: relative; display: grid; gap: 17px; min-height: 345px; padding: 25px; overflow: hidden; border: 1px solid #cfe3d7; border-radius: 20px; background: var(--paper); box-shadow: var(--shadow); }
.next-action-card::before { position: absolute; inset: 0 0 auto; height: 5px; background: #7ebca2; content: ""; }
.next-action-card.overdue { border-color: #e1c3bd; }
.next-action-card.overdue::before { background: #c87b70; }
.next-action-kicker { color: var(--teal); font-size: 12px; font-weight: 800; letter-spacing: .1em; }
.next-action-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.next-action-order { color: var(--muted); font-size: 11px; }
.next-action-horse, .detail-identity { display: flex; align-items: center; gap: 12px; }
.next-action-horse h3 { margin: 2px 0 0; color: var(--navy); font-size: 25px; }
.next-action-instruction { display: grid; gap: 6px; padding: 14px 16px; border-left: 4px solid #75ae98; border-radius: 0 12px 12px 0; background: #f8fbf9; }
.next-action-instruction strong { color: var(--ink); font-size: 18px; line-height: 1.55; }
.next-action-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.next-action-person, .next-action-due { display: flex; align-items: center; gap: 9px; min-width: 0; }
.next-action-person span, .next-action-due { display: grid; gap: 2px; }
.next-action-meta small { color: var(--muted); font-size: 11px; }
.next-action-meta strong { color: var(--ink); font-size: 14px; }
.next-action-primary { width: 100%; min-height: 58px; border-radius: 13px; background: var(--teal); font-size: 17px; box-shadow: 0 8px 18px rgba(63,143,124,.2); }
.next-action-primary span { margin-left: auto; font-size: 22px; }
.next-action-wait { margin: 0; padding: 13px; border-radius: 11px; background: #f4f7f5; color: var(--muted); text-align: center; }
.next-action-empty { display: grid; place-content: center; gap: 7px; min-height: 290px; text-align: center; }
.next-action-empty h3 { margin: 0; color: var(--navy); }
.next-action-empty p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.empty-check { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 5px; border-radius: 50%; background: var(--mint); color: var(--teal); font-size: 27px; font-weight: 800; }
.today-overview { padding: 21px 23px; border-radius: 20px; box-shadow: var(--shadow); }
.contact-card-list { display: grid; gap: 0; }
.contact-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px 13px; align-items: center; width: 100%; min-height: 84px; padding: 15px 3px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--ink); text-align: left; box-shadow: none; }
.contact-card:last-child { border-bottom: 0; }
.contact-card:hover, .contact-card.selected { padding-right: 9px; padding-left: 9px; border-radius: 11px; background: #f5faf7; }
.contact-avatar-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.contact-avatar-line > span { display: grid; gap: 3px; min-width: 0; }
.contact-avatar-line strong { overflow: hidden; color: var(--navy); font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.contact-avatar-line small { overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.contact-card-status { display: grid; justify-items: end; gap: 5px; }
.contact-due { color: var(--muted); font-size: 11px; white-space: nowrap; }
.contact-person { display: flex; grid-column: 1 / -1; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.status-pill { padding: 5px 9px; }
.status-pill.open { background: #eef5fb; color: #39718e; }
.status-pill.confirmed { background: var(--mint); color: var(--teal); }
.status-pill.in_progress { background: #f0f0fb; color: #6b6da7; }
.status-pill.completed { background: #edf6e9; color: #5b8b4f; }
.status-pill.overdue { background: #fbeceb; color: #a9514b; }
.avatar { display: inline-grid; place-items: center; flex: 0 0 auto; width: 43px; height: 43px; border-radius: 50%; background: #e9f4ed; color: #307460; font-size: 18px; font-weight: 800; }
.avatar-person { width: 31px; height: 31px; font-size: 13px; }
.avatar.tone-0 { background: #e9f2ed; color: #34755c; }
.avatar.tone-1 { background: #edf1f8; color: #4f678a; }
.avatar.tone-2 { background: #f8f0e4; color: #9a7344; }
.avatar.tone-3 { background: #eeeef8; color: #6f70a2; }
.avatar.tone-4 { background: #f2edf4; color: #805e7b; }
.safe-banner { display: flex; align-items: flex-start; gap: 9px; margin-top: 18px; padding: 13px 16px; border: 1px solid #dbe8e0; border-radius: 12px; background: #f2f8f4; color: #587267; font-size: 12px; line-height: 1.6; }
.safe-icon { display: grid; place-items: center; flex: 0 0 auto; width: 19px; height: 19px; border-radius: 50%; background: #dceee4; color: #397d64; font-weight: 800; }
.safe-banner strong { color: var(--navy); }
.language-toggle { min-width: 58px; min-height: 40px; padding: 8px 10px; border: 1px solid #b9d7c8; border-radius: 10px; background: #f2f8f4; color: var(--teal); font-size: 12px; font-weight: 800; white-space: nowrap; }
.language-toggle:hover { background: var(--mint); }
.translation-field { gap: 6px; }
.translation-field small { color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.5; }
.translate-input { display: flex; gap: 8px; align-items: stretch; }
.translate-input input { min-width: 0; flex: 1; }
.translate-button { align-self: flex-start; margin-top: 8px; font-size: .84rem; }
.translate-input .translate-button { margin-top: 0; white-space: nowrap; }
.translation-ai-note { display: block; margin-top: 6px; color: var(--muted); }
.recipient-picker { border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.recipient-picker legend { padding: 0 4px; font-size: 13px; font-weight: 700; }
.recipient-picker p { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.recipient-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.recipient-option { display: grid; grid-template-columns: auto 1fr; gap: 2px 6px; align-items: center; padding: 8px; background: var(--surface-subtle); border-radius: 8px; }
.recipient-option input { grid-row: span 2; }
.recipient-option small { color: var(--muted); grid-column: 2; }
.composer-panel { margin-bottom: 16px; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.user-row small { display: block; color: var(--muted); margin-top: 3px; }
.user-controls { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.user-controls select { min-height: 36px; }
.toggle-label { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; white-space: nowrap; }
@media (max-width: 480px) { .translate-input { flex-direction: column; } .translate-input .translate-button { align-self: stretch; } .recipient-options { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .user-row { align-items: flex-start; flex-direction: column; } .user-controls { justify-content: flex-start; width: 100%; } }
.primary-button { min-height: 46px; border-radius: 11px; background: var(--teal); box-shadow: 0 5px 12px rgba(63,143,124,.16); }
.secondary-button { min-height: 44px; border-radius: 10px; }
.panel-card, .detail-panel { border-radius: 18px; box-shadow: var(--shadow); }
.contact-list button { min-height: 68px; border-color: var(--line); border-radius: 11px; background: #fbfdfc; }
.contact-list button:hover, .contact-list button.selected { border-color: #9ac6b1; background: #f1f8f4; }
.contact-list strong { display: flex; align-items: center; gap: 7px; }
.contact-list .avatar { width: 30px; height: 30px; font-size: 13px; }
.contact-list .status-pill { font-size: 10px; }
.detail-header { align-items: center; }
.detail-identity h3 { margin-top: 2px; }
.instruction-block { border-color: #cfe3d7; border-left: 4px solid #75ae98; background: #f8fbf9; }
.detail-person { display: flex; align-items: center; gap: 8px; }
.manager-check { background: #fffaf0; border-color: #eadbb8; }
input:focus, textarea:focus, select:focus { border-color: #6eaf99; box-shadow: 0 0 0 3px rgba(63,143,124,.13); }

@media (max-width: 960px) {
  .today-layout { grid-template-columns: minmax(300px, .95fr) minmax(300px, 1.05fr); }
}
@media (max-width: 700px) {
  .today-layout { grid-template-columns: 1fr; }
  .next-action-card { min-height: 0; }
  .today-overview { padding: 18px; }
}
@media (max-width: 520px) {
  .app-shell, .side-nav, .main-shell, .top-bar, .content-area { min-width: 0; max-width: 100%; }
  .brand-block, .brand-mark, .top-bar > div:first-child, .account-actions { min-width: 0; max-width: 100%; }
  .brand-block { overflow: hidden; }
  .brand-mark { overflow-wrap: anywhere; font-size: 21px; line-height: 1.15; }
  .top-bar { padding: 18px 16px 15px; }
  .top-bar h1 { font-size: 20px; }
  .content-area { padding: 23px 15px 32px; }
  .section-heading { margin-bottom: 16px; }
  .section-heading h2 { font-size: 24px; }
  .dashboard-heading .primary-button { width: 100%; }
  .next-action-card { padding: 21px 18px; border-radius: 17px; }
  .next-action-horse h3 { font-size: 22px; }
  .next-action-instruction strong { font-size: 17px; }
  .next-action-meta { grid-template-columns: 1fr; gap: 9px; }
  .contact-card { grid-template-columns: minmax(0, 1fr) auto; padding: 14px 0; }
  .contact-card:hover, .contact-card.selected { padding-right: 7px; padding-left: 7px; }
  .contact-avatar-line small { white-space: normal; }
  .account-actions { gap: 7px; min-width: 0; }
  .user-badge { min-width: 0; overflow: hidden; max-width: 50%; text-overflow: ellipsis; }
}

/* Futuristic interaction layer: bright, tactile, and calm rather than alarmist. */
:root {
  --aurora: #7b5cff;
  --aqua: #24d6c6;
  --sky: #54a8ff;
  --deep: #102742;
  --surface-subtle: rgba(244, 251, 255, .78);
  --glass: rgba(255, 255, 255, .72);
  --glass-border: rgba(118, 169, 204, .28);
  --neon-shadow: 0 16px 38px rgba(67, 105, 157, .15), 0 2px 0 rgba(255,255,255,.9) inset;
}

body {
  overflow-x: hidden;
  background:
    radial-gradient(900px 620px at -10% -10%, rgba(84,168,255,.22), transparent 58%),
    radial-gradient(760px 560px at 110% 8%, rgba(123,92,255,.15), transparent 59%),
    linear-gradient(135deg, #eef8ff 0%, #f5f7ff 48%, #eefcf8 100%);
}
body::before, body::after {
  position: fixed; z-index: -1; width: 34vw; height: 34vw; min-width: 320px; min-height: 320px;
  border-radius: 50%; content: ""; pointer-events: none; filter: blur(2px);
}
body::before { top: 12%; right: -17%; background: radial-gradient(circle, rgba(36,214,198,.16), rgba(36,214,198,0) 67%); animation: aurora-float 14s ease-in-out infinite alternate; }
body::after { bottom: -14%; left: -15%; background: radial-gradient(circle, rgba(123,92,255,.12), rgba(123,92,255,0) 68%); animation: aurora-float 18s ease-in-out infinite alternate-reverse; }

.app-shell { position: relative; }
.side-nav {
  position: relative; overflow: hidden; isolation: isolate;
  background: linear-gradient(165deg, rgba(11,35,62,.97), rgba(16,54,78,.95));
  border-right: 1px solid rgba(130,211,234,.2); color: #e7f6ff;
}
.side-nav::before {
  position: absolute; z-index: -1; inset: 0; opacity: .38; content: "";
  background-image: linear-gradient(rgba(123,213,255,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(123,213,255,.12) 1px, transparent 1px);
  background-size: 26px 26px; mask-image: linear-gradient(to bottom, #000, transparent 72%);
}
.brand-mark { color: #fff; text-shadow: 0 2px 16px rgba(86,213,255,.38); letter-spacing: .11em; }
.brand-block p { color: #a9d1e3; }
.nav-item { position: relative; overflow: hidden; color: #d4ebf6; transition: transform .22s ease, background .22s ease, color .22s ease; }
.nav-item::after { position: absolute; top: 18%; bottom: 18%; left: 0; width: 3px; border-radius: 0 8px 8px 0; background: linear-gradient(var(--aqua), var(--sky)); content: ""; transform: scaleY(0); transition: transform .2s ease; }
.nav-item:hover { background: rgba(126,209,234,.12); color: #fff; transform: translateX(3px); }
.nav-item.active { background: linear-gradient(90deg, rgba(80,193,225,.19), rgba(129,111,255,.12)); color: #fff; box-shadow: 0 6px 19px rgba(0,0,0,.16); }
.nav-item.active::after { transform: scaleY(1); }
.nav-item b, .nav-item.active b { color: #9ed6e8; }
.safety-note { border-color: rgba(99,207,224,.24); background: rgba(255,255,255,.08); color: #b8dce9; backdrop-filter: blur(12px); }

.top-bar {
  position: sticky; top: 0; z-index: 10; overflow: hidden;
  background: rgba(246, 252, 255, .74); border-bottom-color: var(--glass-border); backdrop-filter: blur(22px) saturate(140%);
}
.top-bar::after { position: absolute; right: 5%; bottom: 0; width: 35%; height: 1px; background: linear-gradient(90deg, transparent, var(--aqua), var(--aurora), transparent); content: ""; opacity: .75; }
.top-bar h1, .section-heading h2 { color: var(--deep); letter-spacing: -.04em; }
.eyebrow { color: #5d72a3; }
.content-area { position: relative; }
.content-area::before { position: absolute; top: 0; right: 5%; width: 110px; height: 1px; background: linear-gradient(90deg, transparent, var(--sky)); content: ""; }

.panel-card, .detail-panel, .today-overview, .next-action-card, .login-card {
  border-color: var(--glass-border); background: var(--glass); box-shadow: var(--neon-shadow); backdrop-filter: blur(18px) saturate(130%);
}
.panel-card, .detail-panel { transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s ease, border-color .25s ease; }
.panel-card:hover, .detail-panel:hover { border-color: rgba(78,160,225,.42); box-shadow: 0 19px 42px rgba(67,105,157,.18), 0 2px 0 rgba(255,255,255,.85) inset; }

.primary-button {
  position: relative; isolation: isolate; overflow: hidden;
  background: linear-gradient(110deg, #2968ca 0%, #4a67ed 42%, #7b5cff 100%);
  box-shadow: 0 10px 22px rgba(76,91,216,.27), 0 1px 0 rgba(255,255,255,.42) inset;
  transition: transform .2s cubic-bezier(.2,.8,.2,1), box-shadow .2s ease, filter .2s ease;
}
.primary-button::before { position: absolute; z-index: -1; inset: 0; background: linear-gradient(100deg, transparent 22%, rgba(255,255,255,.34) 46%, transparent 68%); content: ""; transform: translateX(-130%); transition: transform .6s ease; }
.primary-button:hover { filter: brightness(1.07); transform: translateY(-2px); box-shadow: 0 14px 26px rgba(76,91,216,.36), 0 1px 0 rgba(255,255,255,.42) inset; }
.primary-button:hover::before { transform: translateX(130%); }
.primary-button:active, .secondary-button:active, .nav-item:active { transform: translateY(1px) scale(.985); }
.secondary-button, .quiet-button, .language-toggle {
  border-color: rgba(83,139,189,.25); background: rgba(255,255,255,.62); color: #284e72; box-shadow: 0 4px 12px rgba(68,110,151,.08); backdrop-filter: blur(12px); transition: transform .2s ease, background .2s ease, border-color .2s ease;
}
.secondary-button:hover, .quiet-button:hover, .language-toggle:hover { border-color: rgba(79,137,234,.55); background: rgba(255,255,255,.9); transform: translateY(-1px); }
.user-badge { border: 1px solid rgba(52,191,199,.28); background: rgba(222,255,249,.7); color: #167a77; box-shadow: 0 4px 15px rgba(39,177,170,.1); }

.next-action-card {
  isolation: isolate; overflow: hidden; border-color: rgba(86,154,230,.38);
  background: linear-gradient(142deg, rgba(255,255,255,.86), rgba(236,249,255,.73));
}
.next-action-card::before { height: 4px; background: linear-gradient(90deg, var(--aqua), var(--sky), var(--aurora)); }
.next-action-card::after {
  position: absolute; z-index: -1; top: -120px; right: -90px; width: 280px; height: 280px; border: 1px solid rgba(101,154,255,.25); border-radius: 50%; box-shadow: 0 0 0 24px rgba(101,154,255,.055), 0 0 0 48px rgba(101,154,255,.035); content: ""; animation: orbit-pulse 7s ease-in-out infinite;
}
.next-action-kicker { color: #4969cc; }
.next-action-instruction { position: relative; overflow: hidden; border-left-color: var(--aqua); background: linear-gradient(90deg, rgba(219,255,250,.75), rgba(248,251,255,.84)); }
.next-action-instruction::after { position: absolute; top: 0; right: 0; width: 25%; height: 1px; background: var(--sky); content: ""; }
.next-action-primary { background: linear-gradient(100deg, #147da2, #2876d6 54%, #6755e8); }
.next-action-primary:not(:disabled) { animation: action-breathe 3.4s ease-in-out infinite; }
.avatar { position: relative; overflow: hidden; border: 1px solid rgba(67,167,188,.25); background: linear-gradient(145deg, #effdff, #dcecff); color: #2875a7; box-shadow: 0 5px 13px rgba(58,131,189,.13); }
.avatar::before { position: absolute; inset: -45%; background: linear-gradient(100deg, transparent 38%, rgba(255,255,255,.9) 50%, transparent 62%); content: ""; transform: rotate(23deg) translateX(-90%); animation: avatar-sheen 6s ease-in-out infinite; }
.contact-card { position: relative; transition: background .22s ease, transform .22s ease; }
.contact-card:hover { transform: translateX(4px); }
.contact-card.selected { background: linear-gradient(90deg, rgba(223,249,255,.9), rgba(243,241,255,.72)); }
.status-pill { border: 1px solid rgba(93,144,197,.17); box-shadow: 0 2px 8px rgba(60,103,152,.06); }
.status-pill.open { background: rgba(224,244,255,.86); color: #2875a7; }
.status-pill.confirmed { background: rgba(221,255,247,.85); color: #158477; }
.status-pill.in_progress { background: rgba(237,233,255,.85); color: #6551bf; }
.status-pill.overdue { animation: overdue-glow 2.4s ease-in-out infinite; }

.contact-list button { position: relative; overflow: hidden; border-color: rgba(112,158,203,.2); background: rgba(255,255,255,.55); transition: border-color .2s ease, background .2s ease, transform .2s ease, box-shadow .2s ease; }
.contact-list button:hover, .contact-list button.selected { border-color: rgba(89,143,233,.56); background: linear-gradient(90deg, rgba(230,249,255,.92), rgba(246,244,255,.72)); box-shadow: 0 9px 20px rgba(65,105,170,.1); transform: translateX(3px); }
.detail-block { border-color: rgba(112,158,203,.21); background: rgba(255,255,255,.54); }
.instruction-block { border-left-color: var(--aqua); background: linear-gradient(90deg, rgba(226,255,250,.78), rgba(247,252,255,.68)); }
input, textarea, select { border-color: rgba(101,151,194,.28); background: rgba(255,255,255,.76); transition: box-shadow .2s ease, border-color .2s ease, background .2s ease; }
input:hover, textarea:hover, select:hover { border-color: rgba(79,137,234,.43); }
input:focus, textarea:focus, select:focus { border-color: var(--sky); background: rgba(255,255,255,.96); box-shadow: 0 0 0 3px rgba(84,168,255,.15), 0 7px 17px rgba(67,114,169,.08); }
.login-page { position: relative; overflow: hidden; }
.login-card { position: relative; overflow: hidden; border-color: rgba(111,167,219,.35); background: rgba(255,255,255,.74); }
.login-card::before { position: absolute; top: -120px; right: -95px; width: 260px; height: 260px; border: 1px solid rgba(82,165,255,.24); border-radius: 50%; box-shadow: 0 0 0 26px rgba(95,122,255,.05), 0 0 0 52px rgba(95,122,255,.035); content: ""; animation: orbit-pulse 8s ease-in-out infinite; }

@keyframes aurora-float { from { transform: translate3d(-2%, -1%, 0) scale(.96); } to { transform: translate3d(4%, 5%, 0) scale(1.08); } }
@keyframes orbit-pulse { 0%,100% { transform: scale(.94) rotate(0deg); opacity: .72; } 50% { transform: scale(1.07) rotate(12deg); opacity: 1; } }
@keyframes avatar-sheen { 0%,58% { transform: rotate(23deg) translateX(-110%); } 78%,100% { transform: rotate(23deg) translateX(120%); } }
@keyframes action-breathe { 0%,100% { box-shadow: 0 10px 22px rgba(76,91,216,.27), 0 1px 0 rgba(255,255,255,.42) inset; } 50% { box-shadow: 0 13px 28px rgba(57,103,222,.42), 0 0 0 5px rgba(96,120,255,.09), 0 1px 0 rgba(255,255,255,.42) inset; } }
@keyframes overdue-glow { 0%,100% { box-shadow: 0 0 0 0 rgba(210,81,76,.15); } 50% { box-shadow: 0 0 0 4px rgba(210,81,76,.11); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .001ms !important; }
}
@media (max-width: 960px) {
  .side-nav { background: linear-gradient(115deg, rgba(11,35,62,.98), rgba(24,69,95,.96)); }
}

/* Keep the daily path short: one action + a small preview, never a full long list. */
.show-all-contacts { display: flex; width: 100%; align-items: center; justify-content: space-between; margin-top: 9px; padding: 12px 2px 2px; border: 0; border-top: 1px solid var(--line); background: transparent; color: #4168c6; font-size: 13px; font-weight: 750; }
.show-all-contacts:hover { color: var(--aurora); }
.detail-header-actions { display: flex; align-items: center; gap: 8px; }
.mobile-back-button { display: none; }

@media (min-width: 961px) {
  html, body, .app-shell { height: 100%; overflow: hidden; }
  .main-shell { display: flex; height: 100vh; flex-direction: column; }
  .content-area { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; }
  #todayView .today-layout { max-height: min(570px, calc(100vh - 230px)); }
  #todayView .today-overview { min-height: 0; overflow: auto; overscroll-behavior: contain; }
  #contactsView .workspace-grid { max-height: calc(100vh - 230px); }
  #contactsView .workspace-left, #contactsView .detail-panel { min-height: 0; max-height: inherit; overflow: auto; overscroll-behavior: contain; }
  #horsesView .split-panel, #usersView .split-panel { max-height: calc(100vh - 240px); }
  #horsesView .simple-list, #usersView .simple-list { max-height: calc(100vh - 325px); overflow: auto; }
}

@media (max-width: 960px) {
  .content-area { padding-bottom: 22px; }
  .safe-banner { display: none; }
  .today-overview { padding-bottom: 14px; }
  .contact-card-list { max-height: 312px; overflow: auto; overscroll-behavior: contain; }
  .contact-card { min-height: 72px; }
  .next-action-card { gap: 13px; }
  .next-action-primary { min-height: 54px; }
  #contactsView .workspace-grid { display: block; }
  #contactsView .workspace-left { margin-bottom: 14px; }
  #contactsView .detail-panel { min-height: 0; }
  .mobile-back-button { display: inline-flex; align-items: center; min-height: 34px; padding: 6px 9px; border: 1px solid rgba(83,139,189,.25); border-radius: 9px; background: rgba(255,255,255,.72); color: #335f91; font-size: 12px; font-weight: 700; }
  body:not(.contact-detail-open) #contactsView .detail-panel { display: none; }
  body.contact-detail-open #contactsView .workspace-left { display: none; }
}
