:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-soft: #faf7f6;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #9f1f24;
  --primary-dark: #7f171b;
  --primary-soft: #f7e7e8;
  --success: #147d4f;
  --danger: #b42318;
  --shadow: 0 10px 30px rgba(31, 41, 55, .08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: calc(16px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 16px max(20px, env(safe-area-inset-left)); background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(14px); }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(26px, 4vw, 36px); letter-spacing: .02em; }
h2 { margin-bottom: 0; }
.eyebrow { margin-bottom: 4px; color: var(--primary); font-size: 13px; font-weight: 800; letter-spacing: .12em; }
main { width: min(1100px, 100%); margin: 0 auto; padding: 24px max(18px, env(safe-area-inset-right)) calc(60px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); }
.hero-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.action-card { min-height: 112px; display: flex; gap: 16px; align-items: center; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 20px; box-shadow: var(--shadow); color: var(--text); }
.action-card:active { transform: scale(.99); }
.action-icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--primary-soft); font-size: 27px; flex: 0 0 auto; }
.action-card strong { display: block; font-size: 19px; margin-bottom: 5px; }
.action-card small { color: var(--muted); }
.search-panel { margin-top: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 16px; box-shadow: var(--shadow); }
.search-box { display: flex; align-items: center; gap: 10px; background: #f3f4f6; border-radius: 15px; padding: 0 14px; }
.search-box input { width: 100%; min-height: 54px; border: 0; outline: 0; background: transparent; font-size: 17px; }
.chips { display: flex; gap: 9px; overflow-x: auto; padding-top: 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 10px 15px; white-space: nowrap; font-weight: 700; }
.chip.active { background: var(--primary); color: white; border-color: var(--primary); }
.list-header { display: flex; align-items: end; justify-content: space-between; margin: 26px 2px 14px; }
.list-header h2 { font-size: 25px; }
.muted { margin-bottom: 3px; color: var(--muted); }
.plan-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.plan-card { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.plan-card::before { content: ""; position: absolute; inset: 0 auto auto 0; width: 100%; height: 5px; background: var(--primary); }
.plan-card-body { padding: 22px 20px 16px; }
.plan-tags { display: flex; flex-wrap: wrap; gap: 8px; padding-right: 55px; }
.tag { display: inline-flex; align-items: center; min-height: 30px; padding: 5px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-dark); font-size: 13px; font-weight: 800; }
.tag.folder { background: #edf3ff; color: #284d93; }
.plan-card h3 { margin: 17px 0 12px; font-size: 24px; line-height: 1.35; }
.plan-meta { display: grid; gap: 9px; color: #374151; }
.meta-row { display: flex; gap: 9px; align-items: flex-start; }
.meta-label { min-width: 92px; color: var(--muted); }
.favorite-btn { position: absolute; top: 17px; right: 16px; width: 46px; height: 46px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-size: 24px; }
.favorite-btn.active { color: #d89700; background: #fff7dc; }
.card-actions { display: grid; grid-template-columns: 1fr auto auto; gap: 9px; padding: 14px; border-top: 1px solid var(--line); background: var(--surface-soft); }
.primary, .secondary, .danger { min-height: 50px; border-radius: 14px; padding: 0 18px; font-weight: 800; border: 1px solid transparent; }
.primary { background: var(--primary); color: white; }
.primary:active { background: var(--primary-dark); }
.secondary { background: white; color: var(--text); border-color: #d1d5db; }
.danger { background: var(--danger); color: white; }
.compact { min-height: 46px; padding: 0 16px; }
.small { min-height: 42px; padding: 0 14px; }
.empty-state { display: none; text-align: center; background: var(--surface); border: 1px dashed #cbd5e1; border-radius: 24px; padding: 45px 24px; }
.empty-state.visible { display: block; }
.empty-icon { font-size: 52px; margin-bottom: 12px; }
.empty-state p { color: var(--muted); max-width: 540px; margin: 0 auto 22px; line-height: 1.8; }
.modal { width: min(640px, calc(100% - 28px)); border: 0; border-radius: 24px; padding: 0; box-shadow: 0 24px 70px rgba(0,0,0,.22); }
.modal::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px); }
.modal form, .modal > div, .modal > p { margin: 0; }
.modal form, .small-modal { padding: 22px; }
.small-modal { width: min(460px, calc(100% - 28px)); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.icon-btn { width: 42px; height: 42px; border: 0; border-radius: 12px; background: #f3f4f6; font-size: 25px; }
.file-summary { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px; background: #f7f7f8; margin-bottom: 18px; }
.file-icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 14px; background: var(--primary); color: white; font-size: 13px; font-weight: 900; }
.file-summary strong, .file-summary small { display: block; word-break: break-all; }
.file-summary small { margin-top: 4px; color: var(--muted); }
.modal label { display: grid; gap: 7px; margin-top: 15px; font-weight: 800; }
.modal input, .modal select { width: 100%; min-height: 52px; border: 1px solid #cfd4dc; border-radius: 13px; padding: 0 13px; background: white; color: var(--text); }
.modal input:focus, .modal select:focus { outline: 3px solid rgba(159,31,36,.15); border-color: var(--primary); }
.required { color: var(--primary); font-size: 12px; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 24px; }
.form-error { min-height: 20px; margin: 12px 0 0; color: var(--danger); font-weight: 700; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 30; transform: translate(-50%, 18px); background: #111827; color: white; padding: 12px 17px; border-radius: 999px; opacity: 0; pointer-events: none; transition: .2s ease; max-width: calc(100% - 32px); text-align: center; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 760px) {
  .hero-grid, .plan-list { grid-template-columns: 1fr; }
  .card-actions { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 520px) {
  .topbar { padding-left: 16px; padding-right: 16px; }
  main { padding-left: 14px; padding-right: 14px; }
  .action-card { min-height: 95px; padding: 16px; }
  .plan-card h3 { font-size: 21px; }
  .card-actions { grid-template-columns: 1fr 1fr; }
  .card-actions .open-btn { grid-column: 1 / -1; }
}
