/* SF-065: Apple macOS / iCloud-inspired Minimalist Stylesheet (White + Navy #172D50, Crisp Status Colors) */
:root {
  --bg: #fbfbfd;
  --sidebar-bg: #f5f5f7;
  --card: #ffffff;
  --surface-2: #f0f2f5;
  --fg: #1d1d1f;
  --muted: #86868b;
  --border: rgba(23, 45, 80, 0.09);
  --border-strong: rgba(23, 45, 80, 0.16);
  --primary: #172d50;
  --primary-soft: rgba(23, 45, 80, 0.08);
  --primary-fg: #ffffff;
  --success: #16a34a;
  --warning: #eab308;
  --error: #dc2626;
  --radius: 14px;
  --shadow-xs: 0 1px 2px rgba(23, 45, 80, 0.04);
  --shadow-sm: 0 2px 10px rgba(23, 45, 80, 0.05);
  --ease-apple: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Hiragino Sans", sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
}

.tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.text-xs { font-size: 11px; }
.text-sm { font-size: 13px; }
.text-md { font-size: 14px; }
.font-semibold { font-weight: 600; }
.mt-1 { margin-top: 4px; }
.my-1 { margin: 4px 0; }
.flex-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.flex-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-md { display: flex; flex-direction: column; gap: 14px; }
.error-text { color: var(--error); }
.success-text { color: var(--success); }
.line-through { text-decoration: line-through; }

/* Auth Gate */
.centered-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--sidebar-bg);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 36px 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.brand-logo {
  width: 112px;
  height: 37px;
  color: var(--primary);
  display: block;
}
.brand-logo-center { margin: 0 auto; width: 130px; height: 43px; }

/* macOS Window Shell */
.app-shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--sidebar-bg);
  padding: 20px 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 2px 8px 18px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: #424245;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.14s ease, color 0.14s ease;
}
.nav-btn:hover { background: rgba(23, 45, 80, 0.05); color: var(--fg); }
.nav-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
}

.workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
}

.main-content {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 32px 72px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.mobile-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  z-index: 30;
}
.mobile-nav::-webkit-scrollbar { display: none; }

.mobile-nav-btn {
  flex-shrink: 0;
  white-space: nowrap;
  min-height: 44px;
  padding: 6px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.mobile-nav-btn.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }

/* Page Header & Typography */
.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.page-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.028em;
  color: var(--fg);
}
.page-header p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }

/* Surfaces & Grouped Lists (Apple Settings style) */
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
}

.card-title { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 12px; letter-spacing: -0.01em; }
.card-title-inline { margin: 0; }
.card-link { text-decoration: none; color: inherit; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.card-link:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.arch-frame { border-radius: 12px; background: #f5f7fa; padding: 10px; overflow-x: auto; }
.arch-svg { width: 100%; min-width: 560px; height: auto; display: block; }

.progress-bar {
  width: 100%;
  height: 6px;
  border: none;
  border-radius: 999px;
  overflow: hidden;
  appearance: none;
  background: #ebedf0;
}
.progress-bar::-webkit-progress-bar { background: #ebedf0; border-radius: 999px; }
.progress-bar::-webkit-progress-value { background: var(--primary); border-radius: 999px; transition: width 0.25s ease; }
.progress-bar.progress-done::-webkit-progress-value { background: var(--success); }
.progress-bar.progress-risk::-webkit-progress-value { background: var(--error); }

.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; margin: 4px 0 2px; color: var(--fg); }
.stat-sub { font-size: 12px; color: var(--muted); }

.alert-banner {
  border-radius: var(--radius);
  padding: 14px 18px;
  border: 1px solid rgba(220, 38, 38, 0.28);
  background: #fef2f2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

/* Crisp Solid Status & Notification Pills */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-2);
  color: #515154;
}
.pill-success { background: #16a34a; color: #ffffff; }
.pill-warning { background: #eab308; color: #1d1d1f; }
.pill-error { background: #dc2626; color: #ffffff; }
.pill-notify { background: #dc2626; color: #ffffff; min-width: 19px; height: 19px; justify-content: center; padding: 0 6px; }

/* Buttons & Inputs (Apple Controls) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--fg);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: background 0.14s ease, opacity 0.14s ease;
}
.btn:hover { background: #f5f5f7; }
.btn-primary {
  background: var(--primary);
  color: var(--primary-fg);
  border-color: transparent;
}
.btn-primary:hover { opacity: 0.9; background: var(--primary); }
.btn-danger {
  border-color: rgba(220, 38, 38, 0.35);
  color: var(--error);
  background: #ffffff;
}
.btn-danger:hover { background: var(--error); color: #ffffff; border-color: transparent; }

.btn-vote {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 36px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--fg);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.btn-vote:hover { background: #f5f5f7; }
.btn-vote.voted {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.prop-thread {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.prop-comments {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.prop-comment {
  background: var(--sidebar-bg);
  border-radius: 10px;
  padding: 9px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.prop-reply-form {
  display: flex;
  align-items: center;
  gap: 8px;
}
.prop-reply-input {
  flex: 1;
  min-height: 34px;
  padding: 6px 12px;
  font-size: 13px;
}

.input, .select {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--fg);
  font-size: 13.5px;
  width: 100%;
  outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.input:focus, .select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 45, 80, 0.1);
}

/* Apple Grouped List */
.row-list {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.row-list .card {
  border: none;
  border-radius: 0;
  box-shadow: none;
  border-bottom: 1px solid var(--border);
}
.row-list .card:last-child { border-bottom: none; }
.row-item {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 15px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: background 0.12s ease;
}
.row-item:last-child { border-bottom: none; }
.row-item:hover { background: #fafbfd; }

/* Apple Segmented Control */
.segment-group {
  display: inline-flex;
  flex-wrap: wrap;
  padding: 3px;
  border-radius: 10px;
  background: #eceef2;
  gap: 2px;
}
.segment-btn {
  min-height: 30px;
  padding: 4px 13px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #515154;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.14s ease, color 0.14s ease;
}
.segment-btn.active {
  background: #ffffff;
  color: var(--fg);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Donut Chart */
.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut-svg-box { position: relative; width: 120px; height: 120px; flex-shrink: 0; }
.donut-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut-track { stroke: #ebedf0; }
.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--muted);
}
.donut-center strong { font-size: 17px; color: var(--fg); }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.donut-legend-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.donut-legend-label { display: inline-flex; align-items: center; gap: 8px; }
.donut-dot { width: 9px; height: 9px; border-radius: 999px; flex-shrink: 0; }

/* Line, Bar & Funnel Charts */
.chart-svg { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; font-size: 12px; color: var(--muted); }
.chart-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.funnel-list { display: flex; flex-direction: column; gap: 12px; }
.funnel-row { display: flex; flex-direction: column; gap: 6px; }

/* Japan Map */
.map-frame {
  border-radius: 12px;
  background: #f4f7fb;
  overflow: hidden;
}
.japan-map-svg { width: 100%; height: 450px; display: block; }
.map-pin { cursor: pointer; }
.map-hit-region { cursor: zoom-in; }

/* Apple iMessage Chat */
.inbox-grid {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
  overflow: hidden;
  min-height: calc(100vh - 180px);
  box-shadow: var(--shadow-xs);
}
.inbox-list {
  border-right: 1px solid var(--border);
  background: var(--sidebar-bg);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.inbox-item {
  width: 100%;
  text-align: left;
  padding: 10px;
  border: none;
  border-radius: 11px;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.12s ease;
}
.inbox-item:hover { background: rgba(23, 45, 80, 0.05); }
.inbox-item.active { background: var(--primary); color: #ffffff; }
.inbox-avatar {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: #e5eaf1;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.inbox-item.active .inbox-avatar { background: rgba(255, 255, 255, 0.18); color: #ffffff; }
.inbox-avatar .status-dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 10px;
  height: 10px;
  border: 2px solid var(--sidebar-bg);
}
.inbox-item.active .inbox-avatar .status-dot { border-color: var(--primary); }
.inbox-item-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.inbox-item-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-item-preview { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-item.active .inbox-item-preview { color: rgba(255, 255, 255, 0.78); }

.status-dot { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; }
.status-dot-green { background: #16a34a; }
.status-dot-yellow { background: #eab308; }
.status-dot-red { background: #dc2626; }

.inbox-thread { display: flex; flex-direction: column; background: #ffffff; min-height: 0; }
.inbox-thread-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
}
.inbox-thread-body {
  padding: 20px 24px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  min-height: 0;
}

.chat-feed { display: flex; flex-direction: column; gap: 8px; flex: 1; overflow-y: auto; padding: 4px 0; }
.chat-msg { display: flex; flex-direction: column; max-width: 72%; }
.chat-msg.mine { align-self: flex-end; align-items: flex-end; }
.chat-msg.theirs { align-self: flex-start; align-items: flex-start; }
.chat-meta { font-size: 11px; color: var(--muted); margin: 0 8px 3px; }
.chat-bubble {
  padding: 10px 15px;
  border-radius: 18px 18px 18px 5px;
  font-size: 14px;
  line-height: 1.48;
  background: #e9e9eb;
  color: var(--fg);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.chat-msg.mine .chat-bubble { border-radius: 18px 18px 5px 18px; background: var(--primary); color: #ffffff; }
.chat-attach-img { display: block; max-width: 240px; max-height: 220px; border-radius: 12px; margin-bottom: 6px; object-fit: cover; }
.chat-attach-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 12px;
  margin-bottom: 6px;
}
.chat-msg.theirs .chat-attach-file { background: #ffffff; border: 1px solid var(--border); color: var(--fg); }

.imsg-composer-wrap { display: flex; flex-direction: column; gap: 8px; }
.imsg-attach-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--sidebar-bg);
  font-size: 12px;
}
.imsg-attach-thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.imsg-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 22px;
  background: #ffffff;
}
.imsg-attach-btn, .imsg-ai-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: #eff1f5;
  color: var(--primary);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.imsg-ai-btn { font-size: 13px; }
.imsg-attach-btn:hover, .imsg-ai-btn:hover, .imsg-ai-btn.active { background: var(--primary); color: #ffffff; }
.imsg-ai-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--sidebar-bg);
}
.imsg-ai-input { flex: 1; min-width: 180px; }
.imsg-ai-select { width: auto; min-width: 136px; }
.imsg-textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--fg);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  min-height: 32px;
  max-height: 140px;
  padding: 5px 4px;
  overflow-y: auto;
}
.imsg-send-btn {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: none;
  background: var(--primary);
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.imsg-send-btn:hover { opacity: 0.88; }
.imsg-confirm-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--sidebar-bg);
  font-size: 13px;
}
.imsg-single {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
  overflow: hidden;
  min-height: calc(100vh - 180px);
  box-shadow: var(--shadow-xs);
}

/* Drawer & Toast */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(23, 45, 80, 0.28);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: flex-end;
  z-index: 50;
}
.drawer {
  width: 100%;
  max-width: 440px;
  height: 100%;
  background: #ffffff;
  border-left: 1px solid var(--border);
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.empty-box { padding: 32px; text-align: center; font-size: 13px; color: var(--muted); }

.toast {
  position: fixed;
  right: 20px;
  bottom: 24px;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(29, 29, 31, 0.92);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  z-index: 60;
}

@media (max-width: 959px) {
  .sidebar { display: none; }
  .mobile-header { display: flex; }
  .mobile-nav { display: flex; }
  .main-content { padding: 18px 16px 84px; gap: 18px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .inbox-grid { grid-template-columns: 1fr; min-height: calc(100vh - 210px); }
  .inbox-list { border-right: none; border-bottom: 1px solid var(--border); }
  .japan-map-svg { height: 260px; }
  .btn { min-height: 44px; }
}

/* Apple-style Motion & Micro-interactions (GPU-accelerated, CSP-safe) */
@keyframes sfPageEnter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes sfSlideDown {
  from { opacity: 0; transform: translateY(-6px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes sfFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes sfDrawerIn {
  from { opacity: 0; transform: translateX(32px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes sfToastIn {
  from { opacity: 0; transform: translateY(14px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes sfBubbleIn {
  from { opacity: 0; transform: translateY(6px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes sfPop {
  0% { transform: scale(0.86); }
  65% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

.sf-page-enter {
  animation: sfPageEnter 0.28s var(--ease-apple) both;
}

.btn, .nav-btn, .segment-btn, .inbox-item, .imsg-send-btn, .imsg-attach-btn, .imsg-ai-btn, .btn-vote {
  transition: transform 0.16s var(--ease-apple), background 0.16s var(--ease-apple), color 0.16s var(--ease-apple), box-shadow 0.18s var(--ease-apple), border-color 0.16s var(--ease-apple), opacity 0.16s var(--ease-apple);
}
.btn:active, .nav-btn:active, .segment-btn:active, .inbox-item:active, .imsg-send-btn:active, .imsg-attach-btn:active, .imsg-ai-btn:active, .btn-vote:active {
  transform: scale(0.96);
}
.btn-vote.voted {
  animation: sfPop 0.28s var(--ease-spring);
}
.card-link {
  transition: transform 0.22s var(--ease-apple), border-color 0.2s var(--ease-apple), box-shadow 0.22s var(--ease-apple);
}
.card-link:hover {
  transform: translateY(-1px);
}
.row-item {
  transition: background 0.16s var(--ease-apple);
}
.pill-notify {
  animation: sfPop 0.26s var(--ease-spring);
}
.progress-bar::-webkit-progress-value {
  transition: width 0.55s var(--ease-apple);
}

.chat-msg {
  animation: sfBubbleIn 0.22s var(--ease-apple) both;
}
.imsg-ai-bar, .imsg-confirm-bar, .imsg-attach-preview,
#createGoalForm, #createProposalForm, #createTaskForm, #uploadFileForm {
  animation: sfSlideDown 0.24s var(--ease-apple) both;
}

.overlay:not(.hidden) {
  animation: sfFadeIn 0.2s var(--ease-apple) both;
}
.overlay:not(.hidden) .drawer {
  animation: sfDrawerIn 0.28s var(--ease-apple) both;
}
.toast:not(.hidden) {
  animation: sfToastIn 0.3s var(--ease-spring) both;
}

.map-pin circle, .map-pin rect {
  transition: transform 0.2s var(--ease-spring), opacity 0.2s var(--ease-apple);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Individual Chart Animations (Line draw, Area fade, Bar grow, Funnel sweep, Donut spin) */
@keyframes sfLineDraw {
  from { stroke-dashoffset: 1600; }
  to { stroke-dashoffset: 0; }
}
@keyframes sfAreaReveal {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes sfVbarGrow {
  from { transform: scaleY(0); opacity: 0.35; }
  to { transform: scaleY(1); opacity: 1; }
}
@keyframes sfHbarSweep {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
@keyframes sfDonutReveal {
  from { opacity: 0; transform: rotate(-120deg) scale(0.92); }
  to { opacity: 1; transform: rotate(-90deg) scale(1); }
}
@keyframes sfDotPop {
  from { opacity: 0; transform: scale(0); }
  to { opacity: 1; transform: scale(1); }
}

.chart-line-path {
  stroke-dasharray: 1600;
  stroke-dashoffset: 0;
  animation: sfLineDraw 0.9s var(--ease-apple) both;
}
.chart-line-dashed {
  animation: sfAreaReveal 0.8s var(--ease-apple) 0.15s both;
}
.chart-area-path {
  animation: sfAreaReveal 0.85s var(--ease-apple) 0.12s both;
}
.chart-dot {
  transform-box: fill-box;
  transform-origin: center;
  animation: sfDotPop 0.35s var(--ease-spring) both;
}
.chart-vbar-rect {
  transform-box: fill-box;
  transform-origin: bottom center;
  animation: sfVbarGrow 0.65s var(--ease-apple) both;
}
.chart-vbar-val {
  animation: sfAreaReveal 0.45s var(--ease-apple) 0.25s both;
}
.hbar-svg {
  width: 100%;
  height: 7px;
  display: block;
  border-radius: 999px;
  overflow: hidden;
}
.hbar-fill {
  transform-box: fill-box;
  transform-origin: left center;
  animation: sfHbarSweep 0.72s var(--ease-apple) both;
}
.donut-svg {
  animation: sfDonutReveal 0.65s var(--ease-apple) both;
}

.chart-delay-0 { animation-delay: 0.04s; }
.chart-delay-1 { animation-delay: 0.09s; }
.chart-delay-2 { animation-delay: 0.14s; }
.chart-delay-3 { animation-delay: 0.19s; }
.chart-delay-4 { animation-delay: 0.24s; }
.chart-delay-5 { animation-delay: 0.29s; }
.chart-delay-6 { animation-delay: 0.34s; }
.chart-delay-7 { animation-delay: 0.39s; }

/* Finder-style Integrated File Hub */
.finder-window {
  display: grid;
  grid-template-columns: 204px minmax(0, 1fr);
  min-height: 500px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
.finder-sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.finder-side-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.finder-side-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding: 4px 10px 4px;
}
.finder-side-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #3a3a3c;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.14s var(--ease-apple), color 0.14s var(--ease-apple), border-color 0.14s var(--ease-apple);
}
.finder-side-btn:hover { background: rgba(23, 45, 80, 0.06); }
.finder-side-btn.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.finder-side-btn.drop-target { background: rgba(23, 45, 80, 0.12); border-color: var(--primary); color: var(--primary); }

.finder-main {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--card);
  transition: background 0.16s var(--ease-apple), box-shadow 0.16s var(--ease-apple);
}
.finder-main.finder-drop-active {
  background: #f4f7fc;
  box-shadow: inset 0 0 0 2px var(--primary);
}
.finder-drop-hint {
  display: none;
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1.5px dashed var(--primary);
  background: rgba(23, 45, 80, 0.06);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  animation: sfSlideDown 0.2s var(--ease-apple) both;
}
.finder-main.finder-drop-active .finder-drop-hint { display: block; }

.finder-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: #fbfbfd;
}
.finder-nav-arrow {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--fg);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.14s var(--ease-apple), transform 0.14s var(--ease-apple);
}
.finder-nav-arrow:disabled { opacity: 0.35; cursor: default; }
.finder-nav-arrow:not(:disabled):hover { background: #f0f2f5; }
.finder-nav-arrow:not(:disabled):active { transform: scale(0.94); }
.finder-title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.finder-search { width: 176px; min-height: 34px; padding: 5px 10px; font-size: 13px; border-radius: 8px; }

.finder-canvas {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}
.finder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(126px, 1fr));
  gap: 14px 10px;
  animation: sfPageEnter 0.24s var(--ease-apple) both;
}
.finder-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 12px 8px;
  border-radius: 12px;
  border: 1.5px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s var(--ease-apple), transform 0.16s var(--ease-apple), border-color 0.15s var(--ease-apple);
}
.finder-tile:hover { background: #f4f6fa; transform: translateY(-2px); }
.finder-tile:active { transform: scale(0.96); }
.finder-tile.selected { background: rgba(23, 45, 80, 0.09); border-color: rgba(23, 45, 80, 0.22); }
.finder-tile.drop-target { background: rgba(23, 45, 80, 0.12); border-color: var(--primary); transform: scale(1.03); }
.finder-folder-svg { width: 74px; height: 58px; display: block; filter: drop-shadow(0 3px 6px rgba(23, 45, 80, 0.12)); }
.finder-doc-svg { width: 58px; height: 66px; display: block; filter: drop-shadow(0 2px 5px rgba(23, 45, 80, 0.09)); }
.finder-tile-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--fg);
  line-height: 1.3;
  word-break: break-word;
  max-width: 118px;
}
.finder-tile-sub { font-size: 10.5px; color: var(--muted); }

.finder-list {
  display: flex;
  flex-direction: column;
  animation: sfPageEnter 0.22s var(--ease-apple) both;
}
.finder-list-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.12s var(--ease-apple);
}
.finder-list-row:nth-child(even) { background: #fafbfd; }
.finder-list-row:hover { background: #f0f3f8; }
.finder-list-row.selected { background: rgba(23, 45, 80, 0.09); }
.finder-ext-chip {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--primary);
  color: #ffffff;
}

.finder-statusbar {
  border-top: 1px solid var(--border);
  background: #fbfbfd;
  padding: 10px 16px;
  min-height: 46px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

@media (max-width: 959px) {
  .page-header h1 { font-size: 21px; }
  .segment-group { max-width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .segment-btn { min-height: 36px; white-space: nowrap; }
  .inbox-list {
    flex-direction: row;
    overflow-x: auto;
    padding: 8px;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
  }
  .inbox-item { flex-shrink: 0; width: auto; min-width: 148px; }
  .finder-window { grid-template-columns: 1fr; min-height: 440px; }
  .finder-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    overflow-x: auto;
    padding: 8px 10px;
    gap: 6px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .finder-sidebar::-webkit-scrollbar { display: none; }
  .finder-side-section { flex-direction: row; align-items: center; gap: 4px; flex-shrink: 0; }
  .finder-side-label { display: none; }
  .finder-side-btn {
    width: auto;
    flex-shrink: 0;
    white-space: nowrap;
    gap: 6px;
    min-height: 38px;
    padding: 6px 12px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 999px;
  }
  .finder-side-btn.active { background: var(--primary); color: #ffffff; border-color: var(--primary); }
  .finder-side-btn.active .muted { color: rgba(255, 255, 255, 0.8); }
  .finder-toolbar { padding: 10px 12px; }
  .finder-toolbar-right { width: 100%; }
  .finder-search { flex: 1; width: auto; min-height: 40px; font-size: 16px; }
  .finder-nav-arrow { width: 38px; height: 38px; }
  .finder-canvas { padding: 14px 12px; }
  .finder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .finder-tile { padding: 14px 8px; }
  .finder-statusbar { padding: 10px 12px; }
  .input, .select { font-size: 16px; min-height: 44px; }
  .imsg-textarea { font-size: 16px; }
  .donut-wrap { flex-direction: column; align-items: flex-start; gap: 14px; }
}

.health-recent-title { margin: 0; }
.quick-link-card { text-decoration: none; color: inherit; overflow-wrap: anywhere; }

/* SF-066: Tabletop POP Generator (100x148mm postcard insert, self-hosted OFL Zen Kaku Gothic New 900 subset) */
@font-face {
  font-family: 'Zen Kaku Gothic New';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('./fonts/zen-kaku-gothic-new-900-pop.woff2') format('woff2');
  unicode-range: U+5b66, U+5b9a, U+751f, U+9650;
}

.pop-layout {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.pop-controls .field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pop-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pop-swatch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #ffffff;
  color: var(--fg);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s var(--ease-apple), box-shadow 0.15s var(--ease-apple);
}
.pop-swatch-btn.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(23, 45, 80, 0.14);
}
.pop-swatch-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(23, 45, 80, 0.18);
  flex-shrink: 0;
}
.pop-dot-yellow { background: #fef08a; }
.pop-dot-vivid { background: #fde047; }
.pop-dot-warm { background: #fde68a; }

.pop-dropzone {
  display: grid;
  color: var(--fg);
  border: 1.5px dashed rgba(23, 45, 80, 0.28);
  border-radius: 12px;
  padding: 14px 12px;
  background: #f8faff;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s var(--ease-apple), border-color 0.15s var(--ease-apple);
}
.pop-dropzone:hover,
.pop-dropzone.pop-drop-active {
  background: #eef4ff;
  border-color: var(--primary);
}
.pop-spec-box {
  background: #f8f9fb;
  border-radius: 12px;
  padding: 12px 14px;
  color: #424245;
  line-height: 1.65;
}
.pop-spec-box strong { color: var(--primary); }
.pop-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pop-stage {
  background: #dfe5ee;
  border-radius: 20px;
  padding: 36px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 600px;
}
.pop-clear-stand {
  width: min(345px, 100%);
  padding: 5px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.6);
  border: 1.5px solid rgba(255, 255, 255, 0.92);
  box-shadow:
    0 24px 46px rgba(23, 45, 80, 0.16),
    0 4px 12px rgba(23, 45, 80, 0.08),
    inset 0 0 0 1px rgba(23, 45, 80, 0.08);
}
.pop-preview-svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
  background: #ffffff;
}

@media (max-width: 959px) {
  .pop-layout { grid-template-columns: minmax(0, 1fr); }
  .pop-stage { min-height: 460px; padding: 24px 16px; }
  .pop-clear-stand { width: min(313px, 100%); }
}

@page {
  size: 100mm 148mm;
  margin: 0;
}
@media print {
  body { background: #ffffff; margin: 0; padding: 0; }
  .sidebar, .mobile-header, .mobile-nav, .overlay, .toast, .pop-no-print { display: none !important; }
  .app-shell, .workspace, .main-content, .pop-layout { display: block; margin: 0; padding: 0; border: none; max-width: none; }
  .pop-stage { background: none; padding: 0; min-height: 0; border-radius: 0; }
  .pop-clear-stand { width: 100mm; background: none; border: none; box-shadow: none; padding: 0; }
  .pop-preview-svg { width: 100mm; height: 148mm; border-radius: 0; }
}
