:root {
  --bg: #f6f7f8;
  --panel: #ffffff;
  --ink: #151922;
  --muted: #687180;
  --line: #e3e6ea;
  --line-strong: #cfd5dd;
  --accent: #1f2937;
  --accent-soft: #edf1f5;
  --danger: #a02929;
  --danger-bg: #fff3f3;
  --shadow: 0 12px 30px rgba(17, 24, 39, 0.06);
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); }
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid rgba(37, 99, 235, .25); outline-offset: 2px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 286px minmax(0, 1fr); }
.sidebar { background: #101720; color: #edf2f7; padding: 26px 18px 18px; min-height: 100vh; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand-row { display: flex; align-items: flex-start; justify-content: space-between; margin: 0 4px 26px; }
.brand-row h1 { margin: 3px 0 0; font-size: 20px; letter-spacing: -.035em; }
.eyebrow { margin: 0; color: var(--muted); font-weight: 750; font-size: 10px; letter-spacing: .1em; }
.sidebar .eyebrow { color: #9ca8b8; }
.primary-button, .outline-button, .danger-button, .text-button { border-radius: 10px; border: 0; transition: transform .12s ease, background .12s ease, border-color .12s ease; }
.primary-button { background: var(--accent); color: white; padding: 11px 14px; font-weight: 700; border: 1px solid var(--accent); }
.primary-button:hover { background: #2d3848; }
.primary-button:active, .outline-button:active, .danger-button:active, .text-button:active { transform: translateY(1px); }
.sidebar .primary-button { width: 100%; background: #eaf0f7; color: #151b24; border-color: #eaf0f7; }
.sidebar .primary-button:hover { background: #ffffff; }
.primary-button.compact { padding: 9px 12px; font-size: 13px; }
.outline-button { background: var(--panel); border: 1px solid var(--line-strong); color: var(--ink); padding: 10px 12px; font-weight: 700; }
.outline-button:hover { background: #f8fafc; }
.danger-button { background: var(--danger-bg); color: var(--danger); border: 1px solid #f2d1d1; padding: 10px 12px; font-weight: 700; }
.danger-button:hover { background: #fee7e7; }
.icon-button { width: 34px; height: 34px; display: inline-grid; place-items: center; background: transparent; border: 1px solid transparent; border-radius: 9px; color: inherit; font-size: 21px; line-height: 1; }
.icon-button:hover { background: var(--accent-soft); border-color: var(--line); }
.sidebar .icon-button:hover { background: #202b38; border-color: #2a3746; }
.sidebar-close { display: none; }
.menu-button { display: none; }
.plan-list { display: flex; flex-direction: column; gap: 6px; margin-top: 24px; overflow-y: auto; padding-right: 2px; }
.plan-row { width: 100%; color: #d5dce7; text-align: left; padding: 11px 12px; background: transparent; border: 1px solid transparent; border-radius: 10px; display: grid; gap: 3px; }
.plan-row:hover { background: #18222f; }
.plan-row.is-active { background: #273444; border-color: #344357; color: #fff; }
.plan-row-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 14px; }
.plan-row-meta { color: #9ba9ba; font-size: 12px; }
.sidebar-footer { margin-top: auto; padding: 22px 5px 0; display: grid; gap: 6px; }
.text-button, .file-label { background: none; color: #bfc9d7; padding: 5px 0; text-align: left; font-weight: 650; font-size: 13px; border: 0; }
.text-button:hover, .file-label:hover { color: #fff; }
.file-label { cursor: pointer; }
.sidebar-footer p { margin: 8px 0 0; color: #8e9bac; font-size: 11px; line-height: 1.5; }

.main-content { width: min(100%, 1120px); margin: 0 auto; padding: 32px 38px 48px; }
.topbar { min-height: 44px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.topbar-title { min-width: 0; }
.topbar h2 { margin: 2px 0 0; font-size: 22px; letter-spacing: -.035em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace { display: grid; gap: 14px; }
.plan-header-card, .notice-card, .place-card { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: var(--radius); }
.plan-header-card { padding: 22px; }
.plan-settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 14px; }
.field-label { display: grid; gap: 7px; min-width: 0; }
.field-label > span { font-size: 12px; color: var(--muted); font-weight: 750; }
.field-label input { width: 100%; height: 40px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; color: var(--ink); padding: 0 10px; }
.field-label input:hover { border-color: #abb5c1; }
.field-label small { color: var(--muted); font-size: 11px; line-height: 1.3; margin-top: -2px; }
.plan-summary { color: #344052; font-size: 13px; padding-top: 16px; margin-top: 16px; border-top: 1px solid var(--line); }
.notice-card { padding: 13px 16px; display: grid; gap: 4px; font-size: 12px; color: #526071; box-shadow: none; line-height: 1.5; }
.notice-card strong { font-size: 12px; color: var(--ink); }
.timeline-section { padding-top: 16px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; margin: 0 2px 14px; }
.section-heading h3 { font-size: 19px; letter-spacing: -.025em; margin: 3px 0 0; }
.timeline { display: grid; gap: 12px; }
.place-card { position: relative; padding: 18px 18px 16px 42px; }
.timeline-marker { position: absolute; left: 18px; top: 20px; bottom: -14px; width: 12px; display: flex; justify-content: center; }
.timeline-marker::after { content: ''; position: absolute; top: 21px; bottom: 0; width: 1px; background: #d5dbe2; }
.timeline-marker span { width: 11px; height: 11px; border: 3px solid #eef1f4; background: #1f2937; border-radius: 100%; z-index: 1; }
.place-card:last-child .timeline-marker::after { display: none; }
.place-card.dragging { opacity: .55; }
.place-card.drop-target { outline: 2px dashed #7b8796; outline-offset: 3px; }
.place-card-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.arrival-block { display: grid; gap: 2px; }
.arrival-label { color: var(--muted); font-size: 11px; font-weight: 750; }
.arrival-time { font-size: 22px; letter-spacing: -.045em; }
.departure-text { font-size: 12px; color: #5c6776; }
.place-actions { display: flex; gap: 2px; }
.drag-handle { font-size: 17px; cursor: grab; }
.place-input-grid { display: grid; grid-template-columns: minmax(180px, 1fr) 124px 104px; gap: 11px; }
.unit-input { height: 40px; display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; overflow: hidden; }
.unit-input:focus-within { outline: 3px solid rgba(37, 99, 235, .25); outline-offset: 2px; }
.unit-input input { border: 0; border-radius: 0; outline: 0; padding-right: 2px; min-width: 0; }
.unit-input span { padding-right: 10px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.adjustment-details { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); }
.adjustment-details summary { color: #465264; font-size: 12px; cursor: pointer; font-weight: 720; width: max-content; }
.adjustment-grid { padding-top: 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.bottom-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 10px; }
.empty-state { min-height: calc(100vh - 140px); display: grid; place-items: center; align-content: center; text-align: center; padding: 40px 18px; }
.empty-state .empty-icon { width: 56px; height: 56px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--panel); font-size: 27px; color: #4f5e71; }
.empty-state h3 { margin: 18px 0 7px; font-size: 20px; letter-spacing: -.03em; }
.empty-state p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translate(-50%, 18px); opacity: 0; pointer-events: none; color: white; background: #17202c; border-radius: 10px; padding: 10px 14px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.2); transition: opacity .18s ease, transform .18s ease; max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.sidebar-backdrop { display: none; }

@media (max-width: 800px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 20; width: min(85vw, 310px); transform: translateX(-105%); transition: transform .2s ease; box-shadow: 14px 0 34px rgba(0,0,0,.18); }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; z-index: 15; inset: 0; background: rgba(15, 23, 32, .4); }
  .sidebar-backdrop.is-open { display: block; }
  .sidebar-close, .menu-button { display: inline-grid; }
  .main-content { padding: 20px 16px 34px; }
  .topbar { margin-bottom: 20px; gap: 10px; justify-content: flex-start; }
  .topbar-title { flex: 1; }
  .topbar h2 { font-size: 19px; }
  #install-app { font-size: 12px; padding: 8px 9px; }
  .plan-settings-grid { grid-template-columns: 1fr; }
  .place-card { padding-left: 37px; }
  .timeline-marker { left: 15px; }
  .place-input-grid { grid-template-columns: minmax(0, 1fr) 110px; }
  .place-name-field { grid-column: 1 / -1; }
  .adjustment-grid { grid-template-columns: 1fr; }
  .deadline-overview-copy { font-size: 11px; }
  .bottom-actions { justify-content: space-between; }
}

@media (max-width: 400px) {
  .main-content { padding-inline: 12px; }
  .place-input-grid { grid-template-columns: 1fr 1fr; }
  .travel-field, .stay-field { min-width: 0; }
  .place-card { padding: 15px 12px 14px 34px; }
  .timeline-marker { left: 12px; }
  .plan-header-card { padding: 17px; }
}

.outline-button.compact { padding: 8px 10px; font-size: 12px; }
.deadline-overview { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.deadline-overview-copy { color: #465264; font-size: 12px; font-weight: 650; line-height: 1.45; }
.deadline-status { margin-top: 14px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: #f8fafc; display: grid; gap: 3px; font-size: 12px; line-height: 1.45; }
.deadline-status-title { font-weight: 750; color: #273242; }
.deadline-status-detail { color: #5e6a79; }
.deadline-status.is-ok { background: #f5f8f6; border-color: #d7e3dc; }
.deadline-status.is-ok .deadline-status-title { color: #315443; }
.deadline-status.is-warning { background: #fff9ef; border-color: #f1deb8; }
.deadline-status.is-warning .deadline-status-title { color: #7d5313; }
.deadline-status.is-danger { background: var(--danger-bg); border-color: #f1caca; }
.deadline-status.is-danger .deadline-status-title { color: #8c2b2b; }

@media (max-width: 800px) {
  .deadline-overview { align-items: flex-start; flex-direction: column; }
}
