:root {
  color-scheme: light;
  --ink: #1e1b4b; --muted: #6b6a8f; --line: #ece8f8; --paper: #ffffff; --bg: #fff6ec;
  --violet: #7c3aed; --pink: #ec4899; --orange: #fb923c; --yellow: #fbbf24;
  --mint: #14b8a6; --blue: #3b82f6; --coral: #ff5a5f;
  --shadow: 0 8px 24px -10px rgba(124, 58, 237, .35);
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg); overflow-x: hidden;
  font: 16px/1.45 "Trebuchet MS", "Segoe UI", system-ui, -apple-system, sans-serif;
}
main { position: relative; z-index: 1; max-width: 820px; margin: 0 auto; padding: 16px 16px 48px; }
h1 { margin: 0; font-size: 2rem; letter-spacing: -.5px; }
h2 { margin-top: 0; }
h3 { margin: 0 0 8px; font-size: 1rem; }
.muted { color: var(--muted); margin: 2px 0; }
.error { color: var(--coral); margin: 4px 0 0; min-height: 1.2em; font-weight: 600; }

/* floating colour blobs behind everything */
.blob { position: fixed; z-index: 0; border-radius: 50%; filter: blur(60px); opacity: .55; pointer-events: none; }
.blob-a { width: 340px; height: 340px; background: #c4b5fd; top: -80px; left: -80px; animation: drift 18s ease-in-out infinite; }
.blob-b { width: 300px; height: 300px; background: #fdba74; top: 38%; right: -90px; animation: drift 22s ease-in-out infinite reverse; }
.blob-c { width: 280px; height: 280px; background: #99f6e4; bottom: -80px; left: 20%; animation: drift 26s ease-in-out infinite; }
@keyframes drift { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(40px, 30px) scale(1.12); } }

#confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 50; pointer-events: none; }

/* hero */
.hero {
  color: #fff; border-radius: 28px; padding: 20px; margin-bottom: 16px;
  background: linear-gradient(120deg, #7c3aed, #ec4899, #fb923c, #7c3aed); background-size: 300% 300%;
  animation: shift 14s ease infinite, rise .6s cubic-bezier(.2, .9, .3, 1.2) both;
  box-shadow: 0 18px 40px -16px rgba(236, 72, 153, .6);
}
@keyframes shift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.greeting { margin: 0 0 2px; font-size: 1rem; font-weight: 700; opacity: .95; }
.greeting .wave { display: inline-block; transform-origin: 70% 70%; animation: wave 2.4s ease-in-out infinite; }
@keyframes wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(16deg); } 20%, 40% { transform: rotate(-10deg); } 50% { transform: rotate(8deg); } }
.date { margin: 2px 0 0; opacity: .9; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; }
.tile {
  background: rgba(255, 255, 255, .94); border-radius: 18px; padding: 10px 6px; text-align: center; color: var(--ink);
  transition: transform .2s, box-shadow .2s; animation: rise .6s cubic-bezier(.2, .9, .3, 1.2) both;
}
.tile:nth-child(2) { animation-delay: .06s; } .tile:nth-child(3) { animation-delay: .12s; } .tile:nth-child(4) { animation-delay: .18s; }
.tile:hover { transform: translateY(-4px) rotate(-1deg); box-shadow: 0 10px 20px -10px rgba(0, 0, 0, .35); }
.tile b { display: block; font-size: 1.9rem; line-height: 1.1; }
.tile span { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.t-open b { color: var(--blue); } .t-today b { color: #f97316; } .t-over b { color: var(--coral); } .t-done b { color: var(--mint); }

.momentum { margin-top: 14px; }
.bar { height: 12px; border-radius: 99px; background: rgba(255, 255, 255, .3); overflow: hidden; }
#barFill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #fde047, #5eead4); transition: width 1s cubic-bezier(.2, .9, .3, 1); box-shadow: 0 0 12px rgba(253, 224, 71, .9); }
#momentumText { margin: 6px 0 0; font-size: .85rem; font-weight: 700; }

/* form controls */
.card { background: var(--paper); border-radius: 22px; padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow); animation: rise .6s .1s cubic-bezier(.2, .9, .3, 1.2) both; }
.row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.end { justify-content: flex-end; margin-top: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.row label { margin-bottom: 0; }
input, select, textarea, button { font: inherit; color: var(--ink); background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 8px 10px; transition: border-color .2s, box-shadow .2s, transform .15s, background .2s; }
input:not([type=checkbox]), textarea { width: 100%; }
#addTitle { flex: 1; min-width: 0; font-size: 1.05rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 4px rgba(124, 58, 237, .18); }
textarea { resize: vertical; }
button { cursor: pointer; font-weight: 700; }
button:hover { transform: translateY(-2px); border-color: var(--violet); }
button:active { transform: scale(.96); }
button.go { color: #fff; border: 0; background: linear-gradient(120deg, #7c3aed, #ec4899); box-shadow: 0 8px 18px -8px rgba(236, 72, 153, .8); }
button.go:hover { animation: wiggle .4s; }
@keyframes wiggle { 0%, 100% { transform: translateY(-2px) rotate(0); } 25% { transform: translateY(-2px) rotate(-3deg); } 75% { transform: translateY(-2px) rotate(3deg); } }
button.glass { color: #fff; background: rgba(255, 255, 255, .22); border: 2px solid rgba(255, 255, 255, .55); backdrop-filter: blur(6px); }
button.glass:hover { background: rgba(255, 255, 255, .35); border-color: #fff; }
button.small { padding: 4px 10px; font-size: .78rem; border-radius: 10px; }
button:disabled { opacity: .5; cursor: default; }

/* tabs */
#tabs { display: flex; gap: 8px; margin: 18px 0 8px; flex-wrap: wrap; }
#tabs button { border-radius: 99px; padding: 6px 16px; background: rgba(255, 255, 255, .85); }
#tabs button.active { color: #fff; border-color: transparent; background: linear-gradient(120deg, #3b82f6, #7c3aed); box-shadow: 0 8px 16px -8px rgba(59, 130, 246, .9); transform: translateY(-1px); }

/* groups and tasks */
.group-title { display: inline-block; margin: 18px 0 8px; padding: 3px 12px; border-radius: 99px; font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: #fff; }
.g-overdue { background: var(--coral); } .g-today { background: #f97316; } .g-week { background: var(--blue); } .g-later { background: var(--mint); } .g-none { background: var(--violet); }

.task {
  position: relative; display: flex; gap: 12px; align-items: flex-start; background: var(--paper); border-radius: 18px; padding: 12px 12px 12px 16px; margin-bottom: 8px;
  border-left: 7px solid var(--blue); box-shadow: 0 6px 16px -10px rgba(30, 27, 75, .35);
  transition: transform .2s, box-shadow .2s, opacity .4s;
}
.task:hover { transform: translateY(-2px) scale(1.005); box-shadow: 0 14px 24px -12px rgba(124, 58, 237, .45); }
.task.p-high { border-left-color: var(--coral); }
.task.p-low { border-left-color: var(--mint); }
.task.enter { animation: rise .5s cubic-bezier(.2, .9, .3, 1.2) backwards; animation-delay: calc(var(--i, 0) * 50ms); }
.task.completing { animation: complete .55s ease forwards; }
.task.leaving { animation: leave .35s ease forwards; }
@keyframes complete { 0% { background: #fff; } 30% { background: #ccfbf1; transform: scale(1.02); } 100% { background: #ccfbf1; opacity: 0; transform: translateX(40px); } }
@keyframes leave { to { opacity: 0; transform: translateX(-40px) scale(.96); } }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }

.task input[type=checkbox] {
  appearance: none; -webkit-appearance: none; flex: none; width: 28px; height: 28px; margin: 1px 0 0; padding: 0; border-radius: 50%;
  border: 3px solid var(--violet); background: #fff; cursor: pointer; position: relative;
}
.task input[type=checkbox]:hover { transform: scale(1.12); box-shadow: 0 0 0 5px rgba(124, 58, 237, .15); }
.task input[type=checkbox]:checked { background: linear-gradient(135deg, #2dd4bf, #14b8a6); border-color: var(--mint); animation: pop .4s cubic-bezier(.2, 1.6, .4, 1); }
.task input[type=checkbox]:checked::after { content: ""; position: absolute; left: 7px; top: 2px; width: 7px; height: 13px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg); }
@keyframes pop { 0% { transform: scale(.7); } 60% { transform: scale(1.3); } 100% { transform: scale(1); } }
.task .body { flex: 1; min-width: 0; }
.task .title { font-weight: 800; overflow-wrap: anywhere; }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.task .notes { color: var(--muted); font-size: .9rem; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.task .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.task .actions { display: flex; flex-direction: column; gap: 4px; }

.chip { border-radius: 99px; padding: 2px 10px; font-size: .74rem; font-weight: 800; background: #eef2ff; color: #4f46e5; }
.chip.overdue { background: var(--coral); color: #fff; animation: throb 1.6s ease-in-out infinite; }
.chip.high { background: #fef3c7; color: #b45309; }
.chip.mine { background: #ede9fe; color: #6d28d9; }
.chip.agent { background: #ccfbf1; color: #0f766e; }
.chip.by { background: #fce7f3; color: #be185d; }
@keyframes throb { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }

.event { background: var(--paper); border-radius: 14px; padding: 10px 14px; margin-bottom: 6px; font-weight: 600; font-size: .92rem; box-shadow: 0 4px 12px -10px rgba(30, 27, 75, .5); animation: rise .4s backwards; animation-delay: calc(var(--i, 0) * 30ms); }
.event .muted { font-weight: 400; font-size: .8rem; }

.empty { text-align: center; padding: 28px 0; color: var(--muted); font-weight: 700; }
.empty .big { display: block; font-size: 3rem; animation: float 3s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-10px) rotate(4deg); } }

/* dialogs */
dialog { border: 0; border-radius: 24px; background: var(--paper); color: var(--ink); width: min(92vw, 520px); padding: 20px; box-shadow: 0 30px 60px -20px rgba(30, 27, 75, .6); }
dialog[open] { animation: dialogIn .3s cubic-bezier(.2, 1.2, .4, 1); }
dialog::backdrop { background: rgba(30, 27, 75, .5); backdrop-filter: blur(4px); }
@keyframes dialogIn { from { opacity: 0; transform: translateY(20px) scale(.94); } to { opacity: 1; transform: none; } }
pre { background: #f5f3ff; padding: 10px; border-radius: 12px; overflow: auto; max-height: 50vh; font-size: .8rem; white-space: pre-wrap; word-break: break-all; }
hr { border: 0; border-top: 2px dashed var(--line); margin: 16px 0; }

/* login */
#login { max-width: 400px; padding-top: 10vh; }
.login-card { background: var(--paper); border-radius: 28px; padding: 28px 22px; text-align: center; box-shadow: 0 24px 50px -20px rgba(124, 58, 237, .6); animation: rise .6s cubic-bezier(.2, .9, .3, 1.2) both; }
.login-card form { text-align: left; }
.login-card .go { width: 100%; margin-top: 4px; padding: 10px; }
.login-emoji { font-size: 3.2rem; animation: float 3s ease-in-out infinite; }
.login-note { color: var(--muted); font-weight: 600; }

@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .tile { padding: 8px 2px; border-radius: 14px; }
  .tile b { font-size: 1.5rem; }
  .tile span { font-size: .6rem; letter-spacing: .02em; }
  h1 { font-size: 1.7rem; }
  .row.wrap label { flex: 1 1 28%; min-width: 0; }
  .row.wrap select, .row.wrap input { padding: 6px 8px; }
  #tabs { flex-wrap: nowrap; gap: 6px; }
  #tabs button { padding: 6px 11px; font-size: .88rem; }
  /* Task card: checkbox + text on top, full-width action buttons underneath, so the
     title and notes keep the whole card width instead of being squeezed by the buttons. */
  .task { display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 10px; padding: 12px 12px 12px 14px; }
  .task:not(:has(> input[type=checkbox])) { grid-template-columns: minmax(0, 1fr); }
  .task > .body, .task > .actions { grid-column: -2 / -1; }
  .task .actions { flex-direction: row; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
  .task .actions button { flex: 1 1 0; min-width: 84px; min-height: 40px; padding: 8px 12px; font-size: .9rem; }
  .task .actions button.work { flex-basis: 100%; }
  .task .meta { gap: 6px; }
  .run-panel { padding: 10px; }
  .run-panel .row { flex-wrap: wrap; }
  .run-panel .row button { flex: 1 1 auto; min-height: 40px; }
  .run-cmd { font-size: .78rem; }
}
/* Touch screens have no real hover; stop cards jumping after a tap. */
@media (hover: none) {
  .task:hover, .tile:hover { transform: none; box-shadow: 0 6px 16px -10px rgba(30, 27, 75, .35); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- agent: hero chips, banners ---- */
.chips-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.pill { background: rgba(255, 255, 255, .25); border: 1.5px solid rgba(255, 255, 255, .55); color: #fff; border-radius: 99px; padding: 2px 12px; font-size: .8rem; font-weight: 800; backdrop-filter: blur(4px); }
.pill.warn { background: #fde047; border-color: #fde047; color: #713f12; }
.pill.hot { background: var(--coral); border-color: #fff; color: #fff; animation: throb 1.6s ease-in-out infinite; }
.pill.needs { background: #fff; color: #be185d; border-color: #fff; animation: throb 1.8s ease-in-out infinite; }
.banner { margin-top: 12px; background: rgba(255, 255, 255, .92); color: var(--ink); border-radius: 14px; padding: 8px 12px; font-weight: 700; font-size: .88rem; }

/* ---- agent: panel inside a task card ---- */
.run-panel { margin-top: 10px; border-radius: 14px; padding: 10px 12px; background: #f5f3ff; border: 2px solid #e4defa; animation: rise .35s cubic-bezier(.2, .9, .3, 1.2) backwards; }
.run-panel.needs { background: #fdf2f8; border-color: #f9c6e0; }
.run-panel.ok { background: #ecfdf5; border-color: #b7ecd6; }
.run-panel.bad { background: #fff1f1; border-color: #ffc9c9; }
.run-head { display: flex; align-items: center; gap: 8px; font-weight: 800; flex-wrap: wrap; }
.run-body { margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .92rem; }
.run-panel textarea { margin-top: 8px; }
.run-panel .row { margin: 8px 0 0; }
.run-cmd { display: block; margin-top: 6px; padding: 8px 10px; border-radius: 10px; background: #1e1b4b; color: #fff; font: .82rem/1.4 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.dots span { display: inline-block; animation: dot 1.2s infinite; font-weight: 900; }
.dots span:nth-child(2) { animation-delay: .2s; } .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dot { 0%, 60%, 100% { opacity: .2; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.spin { display: inline-block; animation: spin 1.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
button.work { color: #fff; border: 0; background: linear-gradient(120deg, #14b8a6, #3b82f6); box-shadow: 0 6px 14px -8px rgba(20, 184, 166, .9); }
button.approve { color: #fff; border: 0; background: linear-gradient(120deg, #14b8a6, #22c55e); }
button.deny { color: #fff; border: 0; background: linear-gradient(120deg, #ff5a5f, #ec4899); }

/* ---- agent: run details dialog ---- */
.run-summary { white-space: pre-wrap; overflow-wrap: anywhere; background: #f5f3ff; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.run-changes, .run-log { font-size: .85rem; max-height: 22vh; overflow: auto; margin-bottom: 8px; }
.run-changes div, .run-log div { padding: 3px 0; border-bottom: 1px dashed var(--line); overflow-wrap: anywhere; }
.run-log .t { color: var(--muted); margin-right: 6px; }
#tgStatus { font-weight: 700; }

label.check { flex-direction: row; align-items: center; gap: 8px; font-size: .9rem; color: var(--ink); }
label.check input { width: 18px; height: 18px; }
#briefMsg { margin: 6px 0 0; font-weight: 700; }

/* week strip */
#weekBar { margin: 4px 0 6px; }
.view-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.view-tabs::-webkit-scrollbar { display: none; }
.view-tab { flex: none; border-radius: 99px; padding: 5px 13px; font-size: .86rem; font-weight: 800; background: rgba(255, 255, 255, .85); color: var(--muted); }
.view-tab.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.view-tab .n { margin-left: 6px; border-radius: 99px; padding: 0 7px; background: #eef2ff; color: #4f46e5; font-size: .76rem; }
.view-tab.hot .n { background: var(--coral); color: #fff; }
.view-tab.on .n { background: rgba(255, 255, 255, .25); color: #fff; }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day-btn { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 0 6px; border-radius: 14px; background: var(--paper); border: 2px solid transparent; box-shadow: 0 4px 10px -8px rgba(30, 27, 75, .5); color: var(--muted); min-height: 66px; }
.day-btn small { font-size: .7rem; font-weight: 700; }
.day-btn b { font-size: 1.25rem; line-height: 1.15; color: var(--ink); }
.day-btn.is-today b { color: var(--violet); }
.day-btn .cnt { min-width: 20px; height: 20px; line-height: 20px; border-radius: 99px; font-size: .72rem; font-weight: 800; }
.day-btn .cnt.has { background: var(--orange); color: #fff; }
.day-btn.sel { border-color: var(--violet); background: #f5f0ff; }
.day-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.day-sub { color: var(--muted); font-size: .84rem; font-weight: 700; }

/* expandable cards */
.task .head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; cursor: pointer; }
.task .head:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; border-radius: 6px; }
.task .chev { flex: none; color: var(--muted); transition: transform .2s; line-height: 1.5; }
.task.open .chev { transform: rotate(180deg); }
.task { cursor: pointer; }
.task .notes.preview { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; white-space: normal; }
.task.open .notes.preview { display: none; }
.task .details { display: none; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); cursor: default; }
.task.open .details { display: block; }
.task.fresh .details { animation: rise .25s ease backwards; }
.task .notes.full { margin: 0 0 8px; color: var(--ink); font-size: .95rem; }
.detail-grid { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: .84rem; color: var(--muted); font-weight: 700; }
.detail-grid span { margin-right: 6px; font-weight: 600; }
.details .actions { flex-direction: row; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
@media (max-width: 560px) {
  .view-tab { padding: 7px 13px; }
  .week-strip { gap: 4px; }
  .day-btn { border-radius: 12px; min-height: 64px; }
  .task .head { min-height: 28px; }
  .details .actions button { flex: 1 1 0; min-width: 84px; min-height: 42px; }
  .task .details .actions button.work { flex-basis: 100%; }
}

/* attachments */
.attach-row { align-items: center; gap: 10px; }
.filebtn { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 12px; border: 1px dashed var(--muted); cursor: pointer; font-size: .9rem; }
.filebtn:hover { border-style: solid; }
.small-hint { font-size: .8rem; }
.add-card.dropping { outline: 2px dashed #7c3aed; outline-offset: -6px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.thumbs:empty { display: none; }
.thumb { position: relative; width: 96px; }
.thumb-open { display: block; width: 100%; padding: 0; border: 1px solid rgba(124, 58, 237, .25); border-radius: 10px; overflow: hidden; background: rgba(255, 255, 255, .6); cursor: pointer; text-align: left; font: inherit; color: inherit; }
.thumb-open img { display: block; width: 100%; height: 72px; object-fit: cover; }
.thumb-open .doc { display: flex; height: 72px; align-items: center; justify-content: center; font-size: 1.8rem; }
.thumb-name { display: block; padding: 2px 6px 4px; font-size: .68rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb-x { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 0; background: #111; color: #fff; line-height: 22px; cursor: pointer; font-size: 14px; }
dialog.viewer { max-width: min(96vw, 900px); }
dialog.viewer img { display: block; max-width: 100%; max-height: 75vh; margin: 0 auto 10px; border-radius: 8px; }

/* ---- live demo ---- */
[hidden] { display: none !important; }
.demo-bar { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; max-width: 820px; margin: 10px auto 0; padding: 10px 14px; border-radius: 16px; background: var(--ink); color: #fff; font-size: .88rem; box-shadow: var(--shadow); }
.demo-bar b { color: var(--yellow); }
.demo-actions { display: flex; gap: 10px; align-items: center; }
.demo-link { color: #fff; font-weight: 700; text-underline-offset: 3px; }
body.demo .attach-row, body.demo #addPreview { display: none; }

/* ---- phone fix: iPhone Safari gives date fields a fixed intrinsic width, so they spilled over their neighbour ---- */
label > input, label > select { width: 100%; min-width: 0; max-width: 100%; }
input[type="date"], input[type="time"] {
  -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%;
  min-height: 2rem; /* an empty date field collapses to zero height on iOS without this */
}
input[type="date"]::-webkit-date-and-time-value, input[type="time"]::-webkit-date-and-time-value { text-align: left; min-height: 1.2em; }
input[type="date"]::-webkit-datetime-edit, input[type="time"]::-webkit-datetime-edit { padding: 0; }
.row.wrap { align-items: flex-end; }

/* ---- AI connection ---- */
.ai-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; background: #cbd5e1; box-shadow: 0 0 0 2px rgba(255, 255, 255, .6); }
.ai-dot.ok { background: #22c55e; } .ai-dot.warn { background: #f59e0b; } .ai-dot.bad { background: #ef4444; }
.ai-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.ai-checks { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 8px; }
.ai-check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 12px; background: #faf8ff; border: 1px solid var(--line); }
.ai-check.bad { background: #fff1f1; border-color: #fecaca; }
.ai-check.warn { background: #fffbeb; border-color: #fde68a; }
.ai-text { font-weight: 700; font-size: .92rem; word-break: break-word; }
.ai-help { margin: 4px 0 8px; font-size: .9rem; }
.ai-help h3 { margin: 6px 0; }
.ai-help ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.ai-details { margin: 8px 0; font-size: .88rem; }
.ai-details summary { cursor: pointer; font-weight: 700; }
code { background: #f1edfb; padding: 1px 5px; border-radius: 6px; font-size: .85em; word-break: break-all; }
#aiDialog { width: min(94vw, 560px); max-height: 90vh; overflow: auto; }
