    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root {
      --bg:           #FDFBF7;
      --surface:      #FFFFFF;
      --primary:      #E07846;
      --primary-dk:   #C4622C;
      --primary-lt:   #FEF0E7;
      --green:        #4A7C59;
      --green-lt:     #E6F2EA;
      --text:         #1A1A1A;
      --text-soft:    #6B6B6B;
      --border:       #E8E4DC;
      --red:          #C83030;
      --red-lt:       #FDEDED;
      --amber:        #B06000;
      --amber-lt:     #FEF3E2;
      --shadow-sm:    0 2px 8px rgba(0,0,0,0.07);
      --shadow-md:    0 6px 20px rgba(0,0,0,0.12);
      --r-card:       18px;
      --r-btn:        14px;
    }

    html, body {
      height: 100%; background: var(--bg);
      font-family: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', sans-serif;
      font-size: 16px; color: var(--text); line-height: 1.6;
      -webkit-font-smoothing: antialiased;
    }
    #root { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

    /* ── Header ── */
    .header {
      position: sticky; top: 0; z-index: 10;
      background: var(--bg); border-bottom: 1px solid var(--border);
      padding: 16px 20px 12px;
      display: flex; align-items: center; justify-content: space-between;
    }
    .header-title {
      font-size: 21px; font-weight: 800; color: var(--primary);
      display: flex; align-items: center; gap: 8px;
    }
    .header-badge {
      font-size: 13px; font-weight: 700; color: var(--primary);
      background: var(--primary-lt); padding: 3px 11px; border-radius: 20px;
    }

    /* ── Main ── */
    .main {
      flex: 1; padding: 16px 16px 160px;
      max-width: 600px; width: 100%; margin: 0 auto;
    }

    /* ── Cards ── */
    .card {
      background: var(--surface); border-radius: var(--r-card);
      padding: 18px 20px; margin-bottom: 12px;
      box-shadow: var(--shadow-sm); border: 1px solid var(--border);
      cursor: pointer;
      transition: transform 0.12s, box-shadow 0.12s;
      -webkit-tap-highlight-color: transparent;
    }
    .card:hover  { box-shadow: var(--shadow-md); }
    .card:active { transform: scale(0.97); }
    .card-plain { cursor: default; }
    .card-plain:hover  { box-shadow: var(--shadow-sm); }
    .card-plain:active { transform: none; }

    /* ── Status badges ── */
    .badge {
      display: inline-block; font-size: 12px; font-weight: 700;
      padding: 3px 10px; border-radius: 20px; white-space: nowrap;
    }
    .badge-overdue { background: var(--red-lt);   color: var(--red);   }
    .badge-soon    { background: var(--amber-lt);  color: var(--amber); }
    .badge-ok      { background: var(--green-lt);  color: var(--green); }
    .badge-none    { background: #F0F0F0; color: #888; }

    /* ── Appliance card ── */
    .app-card-row { display: flex; align-items: flex-start; gap: 14px; }
    .app-card-icon {
      width: 52px; height: 52px; border-radius: 14px;
      background: var(--primary-lt); display: flex; align-items: center;
      justify-content: center; font-size: 26px; flex-shrink: 0;
    }
    .app-card-body { flex: 1; min-width: 0; }
    .app-card-name { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
    .app-card-meta { font-size: 14px; color: var(--text-soft); display: flex; gap: 10px; }
    .app-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
    .app-card-date { font-size: 13px; color: var(--text-soft); }

    /* ── Appliance detail ── */
    .detail-back {
      display: inline-flex; align-items: center; gap: 6px;
      font-size: 16px; font-weight: 700; color: var(--primary);
      background: none; border: none; cursor: pointer; padding: 0;
      margin-bottom: 20px;
      -webkit-tap-highlight-color: transparent;
    }
    .detail-header {
      display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px;
    }
    .detail-icon {
      width: 64px; height: 64px; border-radius: 18px;
      background: var(--primary-lt); display: flex; align-items: center;
      justify-content: center; font-size: 32px; flex-shrink: 0;
    }
    .detail-title { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
    .detail-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
    .chip {
      display: inline-flex; align-items: center; gap: 4px;
      font-size: 13px; font-weight: 500; color: var(--text-soft);
      background: var(--bg); border: 1px solid var(--border);
      padding: 4px 10px; border-radius: 20px;
    }
    .detail-note { font-size: 15px; color: var(--text-soft); margin-top: 8px; }
    .section-title {
      font-size: 16px; font-weight: 800; color: var(--text-soft);
      letter-spacing: 0.05em; text-transform: uppercase;
      margin: 20px 0 12px;
    }
    .record-item {
      border-left: 3px solid var(--border); padding-left: 14px; margin-bottom: 16px;
    }
    .record-date { font-size: 14px; font-weight: 700; color: var(--text-soft); margin-bottom: 4px; }
    .record-type {
      display: inline-block; font-size: 13px; font-weight: 700;
      background: var(--primary-lt); color: var(--primary);
      padding: 2px 10px; border-radius: 10px; margin-bottom: 6px;
    }
    .record-memo { font-size: 15px; color: var(--text); }
    .record-next { font-size: 13px; color: var(--green); margin-top: 4px; }
    .detail-actions { display: flex; gap: 10px; margin-top: 24px; }

    /* ── Shopping items ── */
    .shop-item {
      background: var(--surface); border-radius: var(--r-card);
      border: 1px solid var(--border); box-shadow: var(--shadow-sm);
      display: flex; align-items: center; gap: 12px;
      padding: 14px 16px; margin-bottom: 10px;
      transition: opacity 0.2s;
    }
    .shop-item.checked { opacity: 0.45; }
    .shop-check {
      width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
      border: 2.5px solid var(--border); background: var(--bg);
      display: flex; align-items: center; justify-content: center;
      cursor: pointer; transition: all 0.15s;
      -webkit-tap-highlight-color: transparent;
    }
    .shop-check.checked { background: var(--green); border-color: var(--green); }
    .shop-name {
      flex: 1; font-size: 17px; font-weight: 500;
      text-decoration: none;
    }
    .shop-item.checked .shop-name { text-decoration: line-through; }
    .shop-del {
      padding: 8px; background: none; border: none;
      color: #CCCCCC; cursor: pointer; border-radius: 8px;
      transition: color 0.15s, background 0.15s;
      display: flex; align-items: center; justify-content: center;
      -webkit-tap-highlight-color: transparent;
    }
    .shop-del:hover { color: var(--red); background: var(--red-lt); }

    .clear-btn {
      display: flex; align-items: center; justify-content: center; gap: 6px;
      width: 100%; padding: 14px;
      background: none; border: 2px dashed var(--border); border-radius: var(--r-btn);
      font-family: inherit; font-size: 15px; font-weight: 700;
      color: var(--text-soft); cursor: pointer; margin-top: 4px;
      transition: all 0.15s;
    }
    .clear-btn:hover { border-color: var(--red); color: var(--red); background: var(--red-lt); }

    /* ── Memo card ── */
    .memo-title  { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
    .memo-body   {
      font-size: 15px; color: var(--text-soft);
      display: -webkit-box; -webkit-box-orient: vertical;
      line-clamp: 2; -webkit-line-clamp: 2;
      overflow: hidden; line-height: 1.55;
    }
    .memo-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
    .memo-date   { font-size: 13px; color: var(--text-soft); opacity: 0.7; }
    .memo-hint   { font-size: 13px; color: var(--primary); display: flex; align-items: center; gap: 4px; }

    /* ── Dashboard ── */
    .dash-date {
      font-size: 14px; color: var(--text-soft); font-weight: 500;
      text-align: center; margin-bottom: 18px;
    }
    .dash-card { margin-bottom: 14px; }
    .dash-card-top {
      display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
    }
    .dash-card-title { font-size: 16px; font-weight: 800; }
    .dash-card-count { font-size: 26px; font-weight: 800; color: var(--primary); line-height: 1; }
    .dash-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
    .dash-list-item {
      font-size: 15px; color: var(--text-soft);
      padding: 5px 0; border-bottom: 1px solid var(--border);
      display: flex; align-items: center; gap: 6px;
    }
    .dash-list-item:last-child { border-bottom: none; }
    .dash-more { font-size: 13px; color: var(--text-soft); padding-top: 6px; }
    .dash-memo-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
    .dash-memo-body  { font-size: 14px; color: var(--text-soft); line-height: 1.55; }
    .dash-empty { font-size: 14px; color: var(--text-soft); }
    .dash-done  { font-size: 14px; color: var(--green); font-weight: 700; }
    .dash-link  {
      font-size: 13px; font-weight: 700; color: var(--primary);
      margin-top: 12px; text-align: right;
    }
    .dash-alert {
      background: var(--red-lt); border: 1.5px solid #F4C0C0;
      border-radius: var(--r-card); padding: 14px 18px; margin-bottom: 14px;
      font-size: 15px; font-weight: 700; color: var(--red);
      display: flex; align-items: center; gap: 10px;
    }

    /* ── Calendar ── */
    .cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
    .cal-month-label { font-size: 18px; font-weight: 800; }
    .cal-nav {
      width: 40px; height: 40px; border-radius: 12px;
      background: var(--bg); border: 1.5px solid var(--border);
      font-family: inherit; font-size: 22px; line-height: 1; cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      color: var(--text-soft); transition: background 0.12s;
    }
    .cal-nav:hover { background: var(--border); }
    .cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 4px; }
    .cal-dow > span { text-align: center; font-size: 12px; font-weight: 700; color: var(--text-soft); padding: 4px 0; }
    .cal-dow > span:first-child { color: #CC3030; }
    .cal-dow > span:last-child  { color: #3050CC; }
    .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
    .cal-cell {
      min-height: 46px; display: flex; flex-direction: column; align-items: center;
      padding: 4px 0 3px; background: none; border: none; border-radius: 10px;
      cursor: pointer; font-family: inherit; transition: background 0.12s;
      -webkit-tap-highlight-color: transparent;
    }
    .cal-cell:hover    { background: var(--bg); }
    .cal-cell.selected { background: var(--primary-lt); }
    .cal-num {
      font-size: 14px; font-weight: 600; line-height: 1; margin-bottom: 3px;
      width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
      border-radius: 50%;
    }
    .cal-cell.today .cal-num   { background: var(--primary); color: white; font-weight: 800; }
    .cal-cell.sun .cal-num     { color: #CC3030; }
    .cal-cell.sat .cal-num     { color: #3050CC; }
    .cal-cell.today.sun .cal-num, .cal-cell.today.sat .cal-num { color: white; }
    .cal-cell.other .cal-num   { color: #CCCCCC; }
    .cal-dots { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; max-width: 22px; }
    .cal-dot  { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
    .cal-day-section { margin-top: 14px; padding-top: 14px; border-top: 2px solid var(--border); }
    .cal-day-title   { font-size: 16px; font-weight: 800; margin-bottom: 10px; }
    .cal-ev-card {
      background: var(--surface); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px;
      box-shadow: var(--shadow-sm); border: 1px solid var(--border);
      display: flex; gap: 10px; cursor: pointer; transition: box-shadow 0.12s;
      -webkit-tap-highlight-color: transparent;
    }
    .cal-ev-card:hover { box-shadow: var(--shadow-md); }
    .cal-ev-bar  { width: 4px; border-radius: 2px; flex-shrink: 0; align-self: stretch; }
    .cal-ev-time { font-size: 13px; font-weight: 700; color: var(--text-soft); margin-bottom: 3px; }
    .cal-ev-title{ font-size: 16px; font-weight: 700; margin-bottom: 5px; }
    .cal-ev-chip { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
    .cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
    .cat-btn {
      height: 48px; border: 2px solid var(--border); border-radius: 12px;
      background: var(--bg); font-family: inherit; font-size: 14px; font-weight: 700;
      color: var(--text-soft); cursor: pointer; display: flex; align-items: center;
      justify-content: center; gap: 5px; transition: all 0.15s;
    }
    .toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }
    .toggle-label { font-size: 16px; font-weight: 700; }
    .tog {
      width: 52px; height: 30px; border-radius: 15px; border: none; cursor: pointer;
      position: relative; transition: background 0.2s; flex-shrink: 0;
      -webkit-tap-highlight-color: transparent;
    }
    .tog::after {
      content: ''; position: absolute; width: 24px; height: 24px; border-radius: 50%;
      background: white; top: 3px; left: 3px; transition: transform 0.2s;
      box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    }
    .tog.on  { background: var(--primary); }
    .tog.on::after  { transform: translateX(22px); }
    .tog.off { background: var(--border); }
    .time-row { display: flex; gap: 8px; align-items: center; }
    .time-sep { font-size: 16px; font-weight: 700; color: var(--text-soft); flex-shrink: 0; }
    .share-bar { display: flex; gap: 8px; margin-bottom: 14px; }
    .btn-outline {
      flex: 1; height: 42px; background: none; border: 1.5px solid var(--border);
      border-radius: var(--r-btn); font-family: inherit; font-size: 13px; font-weight: 700;
      color: var(--text-soft); cursor: pointer; display: flex; align-items: center;
      justify-content: center; gap: 6px; transition: background 0.12s, border-color 0.12s;
    }
    .btn-outline:hover { background: var(--bg); border-color: var(--primary); color: var(--primary); }

    /* ── Letters ── */
    .search-bar { position: relative; margin-bottom: 12px; }
    .search-input {
      width: 100%; height: 48px; border: 1.5px solid var(--border);
      border-radius: var(--r-btn); background: var(--surface); box-sizing: border-box;
      font-family: inherit; font-size: 16px; padding: 0 16px 0 44px;
      color: var(--text); outline: none; -webkit-appearance: none; appearance: none;
    }
    .search-input:focus { border-color: var(--primary); }
    .search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-soft); pointer-events: none; }
    .chip-row { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
    .chip-row::-webkit-scrollbar { display: none; }
    .chip {
      height: 34px; padding: 0 12px; border-radius: 17px; flex-shrink: 0;
      border: 1.5px solid var(--border); background: var(--surface);
      font-family: inherit; font-size: 13px; font-weight: 700; color: var(--text-soft);
      cursor: pointer; white-space: nowrap; transition: all 0.15s;
    }
    .chip.active { background: var(--primary); border-color: var(--primary); color: white; }
    .letter-card {
      background: var(--surface); border-radius: var(--r-card); padding: 14px 16px;
      margin-bottom: 10px; box-shadow: var(--shadow-sm); border: 1px solid var(--border);
      cursor: pointer; transition: box-shadow 0.12s; position: relative; overflow: hidden;
      -webkit-tap-highlight-color: transparent;
    }
    .letter-card:hover { box-shadow: var(--shadow-md); }
    .letter-card.unread::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--primary); border-radius: 4px 0 0 4px; }
    .letter-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
    .letter-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 10px; flex-shrink: 0; }
    .letter-date-label { font-size: 12px; color: var(--text-soft); margin-left: auto; flex-shrink: 0; }
    .letter-title { font-size: 16px; font-weight: 800; margin-bottom: 5px; }
    .letter-card:not(.unread) .letter-title { color: var(--text-soft); }
    .letter-summary { font-size: 14px; color: var(--text-soft); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
    .letter-footer { font-size: 12px; color: var(--text-soft); margin-top: 6px; }
    .source-row { display: flex; gap: 8px; flex-wrap: wrap; }
    .source-btn { height: 44px; padding: 0 16px; border: 2px solid var(--border); border-radius: 12px; background: var(--bg); font-family: inherit; font-size: 15px; font-weight: 700; color: var(--text-soft); cursor: pointer; transition: all 0.15s; }
    .source-btn.selected { border-color: var(--primary); background: var(--primary-lt); color: var(--primary); }
    .analyze-box { background: var(--bg); border: 1.5px solid var(--border); border-radius: 14px; padding: 16px; margin: 10px 0; }
    .analyze-ok { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--green); margin-bottom: 10px; }
    .analyze-loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 24px; color: var(--primary); font-size: 15px; font-weight: 700; }
    @keyframes spin { to { transform: rotate(360deg); } }
    .spinner { display: inline-block; animation: spin 0.9s linear infinite; font-size: 22px; }
    .letter-detail-cat { margin-bottom: 12px; }
    .letter-detail-title { font-size: 22px; font-weight: 800; margin-bottom: 8px; line-height: 1.35; }
    .letter-detail-meta { font-size: 14px; color: var(--text-soft); margin-bottom: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
    .letter-section { margin-bottom: 18px; }
    .letter-section-label { font-size: 12px; font-weight: 800; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
    .letter-section-body { font-size: 16px; line-height: 1.7; }
    .letter-date-item { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; padding: 6px 0; border-bottom: 1px solid var(--border); }
    .letter-date-item:last-child { border-bottom: none; }
    .original-toggle { width: 100%; height: 44px; background: none; border: 1.5px solid var(--border); border-radius: var(--r-btn); font-family: inherit; font-size: 14px; font-weight: 700; color: var(--text-soft); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
    .original-text { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 14px; font-size: 14px; line-height: 1.7; color: var(--text-soft); white-space: pre-wrap; max-height: 280px; overflow-y: auto; margin-top: 10px; }
    /* Image upload */
    .img-upload-btn { width: 100%; height: 52px; border: 2px dashed var(--border); border-radius: var(--r-btn); background: var(--bg); font-family: inherit; font-size: 15px; font-weight: 700; color: var(--text-soft); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: border-color 0.15s; }
    .img-upload-btn:hover { border-color: var(--primary); color: var(--primary); }
    .img-preview-wrap { position: relative; margin-bottom: 0; }
    .img-preview { width: 100%; max-height: 220px; object-fit: contain; border-radius: 12px; border: 1.5px solid var(--border); background: #111; display: block; }
    .img-clear { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%; background: rgba(0,0,0,0.55); border: none; color: white; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
    /* Child tag */
    .child-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 10px; border: 1.5px solid; }
    /* Settings */
    .settings-overlay { position: fixed; inset: 0; z-index: 90; background: var(--bg); animation: slideInRight 0.26s cubic-bezier(0.32, 0.72, 0, 1); overflow-y: auto; }
    @keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
    .header-gear { margin-left: auto; background: none; border: none; color: var(--text-soft); cursor: pointer; padding: 6px; border-radius: 10px; display: flex; align-items: center; transition: background 0.12s; }
    .header-gear:hover { background: var(--border); color: var(--text); }
    .settings-section { font-size: 13px; font-weight: 800; color: var(--text-soft); text-transform: uppercase; letter-spacing: 0.06em; margin: 20px 0 10px; }
    .child-row { background: var(--surface); border-radius: 14px; padding: 14px 16px; margin-bottom: 8px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
    .child-row-info { flex: 1; min-width: 0; }
    .child-row-name { font-size: 17px; font-weight: 800; }
    .child-row-school { font-size: 13px; color: var(--text-soft); margin-top: 2px; }
    .child-row-actions { display: flex; gap: 8px; }
    .icon-btn { width: 36px; height: 36px; border-radius: 10px; border: 1.5px solid var(--border); background: none; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-soft); transition: background 0.12s; }
    .icon-btn:hover { background: var(--bg); }
    .school-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
    .child-select-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
    .child-select-btn { height: 44px; padding: 0 14px; border: 2px solid var(--border); border-radius: 12px; background: var(--bg); font-family: inherit; font-size: 14px; font-weight: 700; color: var(--text-soft); cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.15s; white-space: nowrap; }
    .child-select-btn.selected { border-color: var(--primary); background: var(--primary-lt); color: var(--primary); }

    /* ── Empty state ── */
    .empty {
      text-align: center; padding: 60px 20px 40px;
    }
    .empty-icon-wrap {
      width: 88px; height: 88px; border-radius: 24px;
      background: var(--primary-lt);
      display: flex; align-items: center; justify-content: center;
      margin: 0 auto 20px; font-size: 42px;
    }
    .empty-title { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
    .empty-sub   { font-size: 16px; color: var(--text-soft); line-height: 1.7; }

    /* ── Bottom bar ── */
    .bottom-bar {
      position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
      background: var(--bg); border-top: 1px solid var(--border);
      padding: 10px 16px 0;
      padding-bottom: calc(6px + env(safe-area-inset-bottom));
    }
    .btn-add {
      display: flex; align-items: center; justify-content: center; gap: 10px;
      width: 100%; max-width: 440px; margin: 0 auto 10px;
      height: 52px;
      background: var(--primary); color: white; border: none; border-radius: var(--r-btn);
      font-family: inherit; font-size: 17px; font-weight: 700;
      cursor: pointer; letter-spacing: 0.02em;
      box-shadow: 0 3px 12px rgba(224,120,70,0.35);
      transition: background 0.15s, transform 0.1s;
      -webkit-tap-highlight-color: transparent;
    }
    .btn-add:hover  { background: #EC8755; }
    .btn-add:active { background: var(--primary-dk); transform: scale(0.97); }

    .tab-nav {
      display: flex; max-width: 440px; margin: 0 auto;
    }
    .tab-btn {
      flex: 1; display: flex; flex-direction: column;
      align-items: center; justify-content: center; gap: 2px;
      height: 54px; background: none; border: none;
      font-family: inherit; font-size: 9px; font-weight: 700;
      color: var(--text-soft); cursor: pointer; border-radius: 10px;
      transition: color 0.15s, background 0.15s;
      -webkit-tap-highlight-color: transparent;
    }
    .tab-btn.active { color: var(--primary); background: var(--primary-lt); }
    .tab-btn svg    { width: 22px; height: 22px; }

    /* ── Sheet ── */
    .overlay {
      position: fixed; inset: 0;
      background: rgba(0,0,0,0.42); z-index: 30;
      animation: fadeIn 0.2s ease;
    }
    .sheet {
      position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
      background: var(--surface); border-radius: 26px 26px 0 0;
      padding: 16px 22px 28px;
      padding-bottom: calc(28px + env(safe-area-inset-bottom));
      max-height: 90vh; overflow-y: auto;
      animation: slideUp 0.28s cubic-bezier(0.32, 0.72, 0, 1);
    }
    .sheet-2 { z-index: 50; }
    @keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
    @keyframes slideUp { from { transform: translateY(110%); } to { transform: translateY(0); } }
    @keyframes popIn   { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
    .handle { width: 44px; height: 4px; background: var(--border); border-radius: 2px; margin: 0 auto 22px; }
    .sheet-title { font-size: 21px; font-weight: 800; margin-bottom: 22px; }

    /* ── Form controls ── */
    .form-group { margin-bottom: 18px; }
    .form-label {
      display: block; font-size: 13px; font-weight: 700;
      color: var(--text-soft); margin-bottom: 7px; letter-spacing: 0.04em;
    }
    .form-input, .form-select, .form-textarea {
      width: 100%; border: 2px solid var(--border); border-radius: var(--r-btn);
      font-family: inherit; font-size: 16px; color: var(--text);
      background: var(--bg); outline: none; transition: border-color 0.18s;
    }
    .form-input    { height: 52px; padding: 0 16px; }
    .form-select   { height: 52px; padding: 0 16px; appearance: none; cursor: pointer; }
    .form-textarea { padding: 14px 16px; min-height: 130px; resize: vertical; line-height: 1.7; }
    .form-input::placeholder, .form-textarea::placeholder { color: #C0C0C0; }
    .form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); }

    .type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
    .type-btn {
      height: 48px; border: 2px solid var(--border); border-radius: 12px;
      background: var(--bg); font-family: inherit; font-size: 14px; font-weight: 700;
      color: var(--text-soft); cursor: pointer; transition: all 0.15s;
    }
    .type-btn.selected { border-color: var(--primary); background: var(--primary-lt); color: var(--primary); }

    /* ── Sheet buttons ── */
    .btn-row  { display: flex; gap: 10px; margin-top: 22px; }
    .btn-save, .btn-cancel, .btn-outline, .btn-danger {
      height: 52px; border-radius: var(--r-btn);
      font-family: inherit; font-size: 16px; font-weight: 700;
      cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
      transition: all 0.15s;
      -webkit-tap-highlight-color: transparent;
    }
    .btn-save    { flex: 1; background: var(--primary); color: white; border: none; }
    .btn-save:hover  { background: #EC8755; }
    .btn-save:active { background: var(--primary-dk); }
    .btn-save:disabled { opacity: 0.4; cursor: not-allowed; }
    .btn-cancel  { padding: 0 20px; background: transparent; color: var(--text-soft); border: 2px solid var(--border); }
    .btn-cancel:hover  { background: var(--bg); }
    .btn-cancel:active { background: var(--border); }
    .btn-outline { flex: 1; background: transparent; color: var(--primary); border: 2px solid var(--primary); }
    .btn-outline:hover  { background: var(--primary-lt); }
    .btn-danger  { width: 100%; background: transparent; color: var(--red); border: 2px solid #F4C0C0; margin-top: 12px; }
    .btn-danger:hover  { background: var(--red-lt); border-color: #F4A0A0; }

    .divider { height: 1px; background: var(--border); margin: 20px 0; }

    /* ── Dialog ── */
    .dialog-overlay {
      position: fixed; inset: 0; background: rgba(0,0,0,0.52);
      z-index: 60; display: flex; align-items: center; justify-content: center; padding: 24px;
      animation: fadeIn 0.15s ease;
    }
    .dialog {
      background: var(--surface); border-radius: 22px; padding: 28px 24px;
      width: 100%; max-width: 320px; animation: popIn 0.18s ease;
    }
    .dialog-title { font-size: 19px; font-weight: 800; margin-bottom: 10px; }
    .dialog-body  { font-size: 15px; color: var(--text-soft); margin-bottom: 24px; line-height: 1.65; }
    .dialog-btns  { display: flex; gap: 10px; }
    .dlg-cancel, .dlg-confirm {
      flex: 1; height: 50px; border-radius: 12px;
      font-family: inherit; font-size: 16px; font-weight: 700; cursor: pointer;
    }
    .dlg-cancel  { background: var(--bg); border: 2px solid var(--border); color: var(--text-soft); }
    .dlg-confirm { background: var(--red); border: none; color: white; }

    ::-webkit-scrollbar { width: 5px; }
    ::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

    @media (min-width: 600px) {
      .header { padding: 18px 28px 14px; }
      .main   { padding: 20px 28px 160px; }
      .bottom-bar { padding: 10px 28px 0; padding-bottom: calc(6px + env(safe-area-inset-bottom)); }
    }
