:root {
  --sky-start: #7DD3FC;
  --sky-mid: #BFDBFE;
  --sky-end: #E0E7FF;
  --bg-page: #F3F4F6;
  --card: #fff;
  --glass: rgba(255,255,255,.72);
  --ink: #0A0A0A;
  --title: #111827;
  --body: #374151;
  --muted: #9CA3AF;
  --blue: #3B82F6;
  --blue-100: #DBEAFE;
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --admin: #7C3AED;
  --finance: #EA580C;
  --web-accent: #2563EB;
  --line: #E5E7EB;
  --shadow: 0 8px 30px rgba(17,24,39,.08);
  --shadow-soft: 0 2px 8px rgba(17,24,39,.04);
  --radius: 28px;
  --radius-sm: 20px;
  --tab-clear: calc(128px + env(safe-area-inset-bottom));
  --sans: "SF Pro Display", "SF Pro Text", Inter, "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  scroll-padding-bottom: var(--tab-clear);
}
body {
  font-family: var(--sans);
  color: var(--title);
  background: var(--bg-page);
  font-size: 15px;
  line-height: 1.45;
}
button, input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
.hidden { display: none !important; }
.tabular { font-variant-numeric: tabular-nums; }

/* ===== Login ===== */
.login-sky {
  min-height: 100dvh;
  background: linear-gradient(180deg, var(--sky-start), var(--sky-mid) 42%, var(--sky-end));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: env(safe-area-inset-top, 0px) 20px 32px;
}
.login-sky .brand-logo { margin: 0 0 12px; }
.login-sky h1 { font-size: 28px; margin: 0 0 8px; }
.login-sky .sub {
  color: var(--body);
  margin-bottom: 28px;
  font-size: 10.5px;
  text-align: left;
  line-height: 1.55;
}
.login-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-top: -8px;
  position: relative;
  z-index: 1;
}
.login-card h2 { font-size: 22px; margin: 0 0 4px; line-height: 1.25; }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.login-card input {
  width: 100%; height: 48px; border: 1px solid var(--line); border-radius: 14px;
  padding: 0 14px; font-size: 16px; background: #fff;
}
.preview-stack { margin: 8px 0 0; }
.mini-todo {
  background: #fff; border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow);
  display: flex; justify-content: space-between; align-items: center;
}
.login-horse {
  height: 176px;
  border-radius: 0;
  overflow: visible;
  background: transparent;
}
.login-horse svg {
  display: block;
  width: 100%;
  height: 100%;
}
.err { color: #DC2626; font-size: 13px; min-height: 18px; margin-top: 8px; }
.demo { font-size: 8.4px; color: var(--body); margin-top: 16px; line-height: 1.6; }

/* Buttons */
.btn-primary {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 56px; border: 0; border-radius: 999px;
  background: linear-gradient(135deg, #7DD3FC 0%, #3B82F6 52%, #2563EB 100%);
  color: #fff; font-size: 17px; font-weight: 600;
}
.btn-blue { background: var(--web-accent); }
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  padding: 0 18px;
  line-height: 1;
  box-sizing: border-box;
}
.btn-danger {
  background: linear-gradient(90deg, #F97316, #EF4444); color: #fff;
  border: 0; height: 56px; border-radius: 999px; width: 100%; font-weight: 600; font-size: 17px;
}
.btn-ghost { background: none; border: 0; color: var(--body); }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; width: auto; display: inline-flex; }

/* Tags */
.tag {
  display: inline-flex; align-items: center; height: 24px; padding: 0 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600;
}
.tag-todo { background: #F3F4F6; color: #6B7280; }
.tag-doing { background: var(--blue-100); color: var(--blue); }
.tag-review { background: #FEF3C7; color: #D97706; }
.tag-done, .tag-paid, .tag-delivered { background: #DCFCE7; color: var(--success); }
.tag-canceled, .tag-rejected, .tag-paused { background: #FEE2E2; color: #DC2626; }
.tag-prep, .tag-draft { background: #F3F4F6; color: #6B7280; }
.tag-pending, .tag-active, .tag-planned { background: #FEF3C7; color: var(--warning); }
.tag-approved { background: var(--blue-100); color: var(--blue); }
.tag-admin { background: #EDE9FE; color: var(--admin); }
.tag-manager { background: var(--blue-100); color: var(--blue); }
.tag-finance { background: #FFEDD5; color: var(--finance); }
.tag-member { background: #F3F4F6; color: #6B7280; }
.tag-high { background: #FEE2E2; color: #DC2626; }
.tag-mid { background: #FEF3C7; color: #D97706; }
.tag-low { background: #F3F4F6; color: #6B7280; }
.soon { opacity: .45; pointer-events: none; }

/* ===== Mobile shell ===== */
.m-app { min-height: 100dvh; padding-bottom: var(--tab-clear); }
.sky-head {
  background: linear-gradient(180deg, var(--sky-start), var(--sky-mid) 50%, var(--sky-end));
  padding: env(safe-area-inset-top, 0px) 20px 72px;
}
.sky-head.short { padding-bottom: 48px; }
.sky-row { display: flex; justify-content: space-between; align-items: center; }
.hello { font-size: 17px; font-weight: 600; line-height: 1.2; }
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}
.brand-copy { min-width: 0; padding-top: 0; }
.brand-copy .row-cap { margin-top: 4px; }
.brand-logo {
  height: 63px;
  width: auto;
  display: block;
  margin: 0;
  object-fit: contain;
  flex-shrink: 0;
}
.hero-num { font-size: 56px; line-height: 64px; font-weight: 700; letter-spacing: -1px; }
.hero-cap { color: var(--body); font-size: 13px; }
.sky-head .hero-num { text-align: center; margin-bottom: 30px; }
.sky-head .hero-nova {
  width: 39px;
  height: 39px;
  display: block;
  margin: 0 auto 30px;
  object-fit: contain;
}
.sky-head .hero-cap { text-align: center; }
.hero-roll {
  overflow-x: auto;
  overflow-y: hidden;
  text-align: left;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  cursor: grab;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.hero-roll::-webkit-scrollbar { display: none; }
.hero-roll:active { cursor: grabbing; }
.hero-roll-track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.hero-roll-track a { color: inherit; font-weight: 600; flex-shrink: 0; }
.hero-roll-dot { padding: 0 14px; opacity: .45; flex-shrink: 0; }
.sky-head .hello,
.sky-head .brand-copy .row-cap,
.sky-head .hero-num,
.sky-head .hero-cap {
  color: var(--blue);
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(20px);
  line-height: 0;
  font-size: 20px;
  flex-shrink: 0;
}
.icon-btn .glyph {
  display: block;
  line-height: 1;
  font-size: 20px;
  transform: translateY(-0.5px);
}
.float-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; margin: -48px 20px 16px;
}
.block { padding: 0 20px 24px; }
.block h2 { font-size: 20px; margin: 8px 0 12px; }
.block-title { margin: 8px 0 30px; }
.block-title h2 { margin: 0; font-size: 20px; line-height: 1.2; }
.block-title .h2-en {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.group {
  background: #fff; border-radius: var(--radius-sm); box-shadow: var(--shadow-soft); overflow: hidden;
}
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 30px 16px; border-bottom: 1px solid #F3F4F6;
}
.row:last-child { border-bottom: 0; }
.row-ico {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: block;
}
.dot { width: 8px; height: 8px; border-radius: 99px; background: var(--blue); flex-shrink: 0; }
.dot.todo { background: #9CA3AF; }
.dot.doing { background: var(--blue); }
.dot.review { background: var(--warning); }
.dot.done { background: var(--success); }
.grow { flex: 1; min-width: 0; }
.row-title { font-size: 17px; font-weight: 600; }
.row-cap { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-plain { padding: 16px 20px var(--tab-clear); }
.page-plain h1 { font-size: 28px; margin: 8px 0 16px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 12px; scrollbar-width: none; }
.chip {
  flex-shrink: 0; height: 36px; padding: 0 16px; border-radius: 999px; border: 0;
  background: #E5E7EB; color: var(--body); font-weight: 600; font-size: 13px;
}
.chip.on { background: var(--blue); color: #fff; }
.tabbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(8px + env(safe-area-inset-bottom));
  height: 64px; border-radius: 999px; background: var(--glass);
  backdrop-filter: blur(22px); display: flex; align-items: center; justify-content: space-around;
  box-shadow: var(--shadow); z-index: 40;
}
.tabbar a, .tabbar button {
  flex: 1; border: 0; background: none; display: flex; flex-direction: column;
  align-items: center; gap: 2px; font-size: 10px; color: var(--muted); font-weight: 500;
}
.tabbar .on { color: var(--title); }
.tabbar .ico {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
}
.tabbar .ico img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
  background: transparent;
}
.tabbar .on span.ico {
  background: var(--blue-100); color: var(--title); border-radius: 999px; padding: 4px 10px;
}
.fab {
  position: fixed;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  bottom: calc(92px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 999px; border: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #7DD3FC 0%, #3B82F6 52%, #2563EB 100%);
  color: #fff;
  font-size: 28px; line-height: 1; padding: 0; z-index: 30; box-shadow: var(--shadow);
}
.sheet-mask {
  position: fixed; inset: 0; background: rgba(17,24,39,.4); z-index: 50;
  display: flex; align-items: flex-end;
}
.sheet {
  background: #fff; width: 100%; border-radius: 32px 32px 0 0; padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
}
.sheet p { margin: 0 0 10px; }
.sheet p .btn-primary,
.sheet p .btn-secondary { width: 100%; justify-content: center; }
.sheet .btn-primary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
.sheet .btn-primary,
.sheet .btn-secondary {
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.sheet .btn-primary.on,
.sheet .btn-secondary.on {
  background: linear-gradient(135deg, #7DD3FC 0%, #3B82F6 52%, #2563EB 100%);
  color: #fff;
  border-color: transparent;
}
.sheet-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0 0 10px;
}
.sheet-row .btn-secondary { flex: 1; width: auto; justify-content: center; }
.sheet-upload {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px dashed #D1D5DB;
  background: #F9FAFB;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}
.sheet-upload input { display: none; }
.sheet-upload img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kpi-board {
  margin: -48px 16px 16px;
  padding: 0;
  background: none;
  box-shadow: none;
}
.kpi-scroll {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 4px 0 8px;
  perspective: 1100px;
}
.kpi-mini {
  min-width: 0;
  aspect-ratio: 1;
  background: linear-gradient(180deg, #D6E8F2 0%, #F3F4F6 100%);
  border-radius: 32px;
  padding: 16px 14px 18px;
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.05);
  color: var(--title);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.kpi-flip {
  position: relative;
  padding: 0;
  cursor: pointer;
  transform-style: preserve-3d;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  --gx: 50%;
  --gy: 22%;
  background: linear-gradient(160deg, #EAF4F9 0%, #D6E8F2 42%, #EEF1F4 100%);
  box-shadow:
    0 16px 34px rgba(59, 130, 246, 0.12),
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 -14px 22px rgba(148, 163, 184, 0.14) inset;
  will-change: transform;
}
.kpi-glare {
  position: absolute;
  inset: 0;
  border-radius: 32px;
  pointer-events: none;
  z-index: 4;
  opacity: 0.38;
  background: radial-gradient(circle 120px at var(--gx) var(--gy), rgba(255,255,255,.78) 0%, rgba(255,255,255,.22) 32%, transparent 64%);
  mix-blend-mode: screen;
  transition: opacity .22s ease;
}
.kpi-flip.is-press .kpi-glare { opacity: 0.95; }
.kpi-face {
  position: absolute;
  inset: 0;
  padding: 16px 14px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 32px;
  backface-visibility: hidden;
}
.kpi-face-back {
  display: none;
  align-items: stretch;
  text-align: left;
}
.kpi-flip.is-back .kpi-face-front { display: none; }
.kpi-flip.is-back .kpi-face-back { display: flex; }
.kpi-back-list {
  flex: 1;
  overflow-y: auto;
  width: 100%;
  margin-top: 8px;
  -webkit-overflow-scrolling: touch;
}
.kpi-back-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(17, 24, 39, .06);
  color: var(--title);
  font-size: 13px;
  font-weight: 600;
}
.kpi-back-list a span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kpi-back-list a b {
  flex: none;
  font-size: 13px;
  display: block;
}
.kpi-mini .row-cap {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  display: block;
  margin-bottom: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.kpi-mini b {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.h-scroll {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.proj-chip {
  min-width: 0;
  background: #fff;
  border-radius: 20px;
  padding: 14px;
  box-shadow: var(--shadow-soft);
}
.proj-chip.is-live {
  background: linear-gradient(180deg, #D6E8F2 0%, #F3F4F6 100%);
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.05);
}
.proj-chip .row-title {
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.sticky-bar {
  position: sticky; bottom: 0; background: var(--glass); backdrop-filter: blur(20px);
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  display: flex; gap: 10px; border-top: 1px solid var(--line);
}
.form-screen label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.form-screen input, .form-screen select, .form-screen textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; font-size: 16px;
}
.form-screen textarea { min-height: 96px; }
.avatar {
  width: 72px; height: 72px; border-radius: 999px; background: var(--blue-100);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.avatar img {
  height: 72px;
  width: auto;
  display: block;
  object-fit: contain;
}
.me-card { margin-top: -36px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty h3 { color: var(--title); }
.msg-bubble { max-width: 80%; padding: 10px 14px; border-radius: 20px; margin: 8px 0; }
.msg-me { margin-left: auto; background: var(--blue); color: #fff; }
.msg-you { background: #fff; box-shadow: var(--shadow-soft); }
.warn { background: #FEF3C7; color: #92400E; border-radius: 16px; padding: 12px 14px; }
.lock-card { max-width: 320px; margin: 48px auto; text-align: center; background: #fff; border-radius: 28px; padding: 32px 20px; }

/* ===== Web shell ===== */
@media (min-width: 768px) {
  .m-only { display: none !important; }
  .tabbar, .fab { display: none !important; }
  .m-app { padding-bottom: 0; }
  body { background: #F8FAFC; }
  .web-shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100dvh; }
  .sidenav {
    background: #0F172A; color: #E2E8F0; padding: 20px 12px;
    display: flex; flex-direction: column; gap: 4px;
  }
  .sidenav .brand { padding: 8px 12px 20px; font-weight: 700; color: #fff; letter-spacing: .04em; }
  .sidenav a, .sidenav button.nav {
    display: flex; align-items: center; gap: 10px;
    height: 40px; padding: 0 12px; border-radius: 10px; color: #94A3B8; border: 0; background: none; text-align: left; width: 100%;
  }
  .sidenav a.on, .sidenav button.nav.on { background: #1E293B; color: #fff; }
  .topbar {
    height: 56px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; background: #fff; border-bottom: 1px solid var(--line);
  }
  .content { padding: 24px; max-width: 1200px; }
  .web-grid { display: grid; grid-template-columns: 7fr 5fr; gap: 16px; }
  .stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
  .stat {
    background: #fff; border-radius: 12px; padding: 18px 20px; box-shadow: var(--shadow-soft); height: 96px;
  }
  .stat b { font-size: 28px; display: block; }
  .card { background: #fff; border-radius: 12px; padding: 18px; box-shadow: var(--shadow-soft); }
  .table { width: 100%; border-collapse: collapse; font-size: 14px; }
  .table th { text-align: left; color: var(--muted); font-weight: 500; padding: 10px 8px; border-bottom: 1px solid var(--line); }
  .table td { padding: 12px 8px; border-bottom: 1px solid #F3F4F6; height: 48px; }
  .table tr { cursor: pointer; }
  .table tr:hover { background: #F8FAFC; }
  .btn-primary { width: auto; padding: 0 22px; height: 40px; font-size: 14px; background: var(--web-accent); border-radius: 10px; }
  .btn-secondary { height: 40px; border-radius: 10px; }
  .float-card, .group, .proj-chip { border-radius: 12px; }
  .sky-head { background: none; padding: 0; }
  .hero-num { font-size: 36px; line-height: 1.1; }
  .page-plain { padding: 0; }
  .split { display: grid; grid-template-columns: 320px 1fr; min-height: calc(100dvh - 56px); }
  .split-list { border-right: 1px solid var(--line); background: #fff; overflow: auto; }
  .drawer-mask {
    position: fixed; inset: 0; background: rgba(15,23,42,.35); display: flex; justify-content: flex-end; z-index: 50;
  }
  .drawer { width: 480px; background: #fff; height: 100%; overflow: auto; padding: 24px; }
  .login-sky {
    display: grid; place-items: center; background: linear-gradient(135deg, #0F172A, #1E3A8A);
  }
  .login-sky .brand-side { color: #fff; max-width: 420px; }
  .login-wrap { display: grid; grid-template-columns: 1fr 400px; gap: 48px; align-items: center; width: min(960px, 92vw); }
  .login-card { padding: 28px; border-radius: 16px; }
}
@media (max-width: 767px) {
  .web-only { display: none !important; }
  .web-shell { display: block; }
  .sidenav, .topbar { display: none !important; }
}

.badge {
  min-width: 18px; height: 18px; border-radius: 99px; background: var(--blue); color: #fff;
  font-size: 11px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px;
}
.muted { color: var(--muted); font-size: 13px; }
.progress {
  height: 6px; background: #E5E7EB; border-radius: 99px; overflow: hidden;
}
.progress > i { display: block; height: 100%; background: var(--blue); }
.seg { display: flex; gap: 6px; overflow-x: auto; margin: 12px 0; }
.seg button {
  flex-shrink: 0; height: 32px; padding: 0 12px; border-radius: 999px; border: 0; background: #E5E7EB; font-weight: 600; font-size: 13px;
}
.seg button.on { background: var(--blue); color: #fff; }
.top-nav {
  display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 4px;
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
