:root {
  --brown: #3b2417;
  --brown-2: #5a3a26;
  --cream: #f5efe6;
  --card: #ffffff;
  --ink: #241812;
  --muted: #8a7a6d;
  --line: #e7ddd0;
  --unread: #fff8ef;
  --red: #d64545; --orange: #e08a2b; --green: #3a9d5d;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; font-family: -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  background: var(--cream); color: var(--ink);
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
}
.screen { min-height: 100vh; }
.hidden { display: none !important; }

/* ログイン */
#login { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card { background: var(--card); border-radius: 18px; padding: 28px 24px; width: 100%; max-width: 360px; box-shadow: 0 8px 30px rgba(0,0,0,.12); }
.logo { font-size: 24px; font-weight: 700; color: var(--brown); }
.sub { color: var(--muted); margin: 4px 0 20px; font-size: 13px; }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.login-card select, .login-card input { width: 100%; margin-top: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 16px; background: #fff; }
.login-card button, .banner button { background: var(--brown); color: #fff; border: 0; border-radius: 10px; padding: 13px; width: 100%; font-size: 16px; font-weight: 600; }
.err { color: var(--red); font-size: 13px; min-height: 18px; margin: 8px 0 0; }

/* トップバー */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; background: var(--brown); color: #fff; padding: 12px 14px; padding-top: calc(12px + env(safe-area-inset-top)); }
.brand { font-weight: 700; }
.who { margin-left: auto; font-size: 13px; opacity: .85; }
.ghost { background: transparent; border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: 8px; padding: 6px 10px; font-size: 12px; }
.ghost.small { border-color: var(--line); color: var(--brown-2); }

.banner { display: flex; align-items: center; gap: 10px; background: #fff3d6; padding: 10px 14px; font-size: 13px; }
.banner button { width: auto; padding: 8px 14px; margin-left: auto; font-size: 13px; }

/* タブ */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 10px 12px; background: var(--cream); position: sticky; top: 52px; z-index: 9; }
.tabs button { flex: 0 0 auto; border: 1px solid var(--line); background: #fff; color: var(--brown-2); border-radius: 999px; padding: 7px 14px; font-size: 13px; }
.tabs button.active { background: var(--brown); color: #fff; border-color: var(--brown); }

.toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; font-size: 13px; color: var(--muted); }
.toolbar .ghost { margin-left: 0; }
.toolbar #refresh { margin-left: auto; }
.badge { background: var(--red); color: #fff; border-radius: 999px; padding: 1px 8px; font-weight: 700; font-size: 12px; }

/* リスト */
.list { list-style: none; margin: 0; padding: 0 12px 40px; }
.item { background: var(--card); border: 1px solid var(--line); border-left-width: 4px; border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.item.unread { background: var(--unread); }
.item.read { opacity: .72; }
.item.lv-critical { border-left-color: var(--red); }
.item.lv-warn { border-left-color: var(--orange); }
.item.lv-info { border-left-color: var(--green); }
.row1 { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.item .title { font-weight: 600; font-size: 15px; }
.item .body { font-size: 13px; color: #4a3a30; margin-top: 3px; white-space: pre-wrap; }
.item .src { font-size: 11px; color: var(--muted); margin-top: 6px; }
.empty { text-align: center; color: var(--muted); margin-top: 60px; }

/* 発送処理 */
.ghost.primary { background: var(--brown); color: #fff; border-color: var(--brown); }
.overlay { position: fixed; inset: 0; z-index: 50; background: var(--cream); overflow-y: auto; }
.ship-hint { font-size: 12px; color: #7a5a3a; background: #fff3d6; margin: 0; padding: 10px 14px; }
.ship-hint b { color: #b5471a; }
.loading { list-style: none; text-align: center; color: var(--muted); padding: 24px; }
.loading.err { color: var(--red); }
.ship-item .note, .dialog .note { font-size: 12px; color: #8a5a2a; background: #fbf3e8; border-radius: 6px; padding: 4px 8px; margin-top: 6px; }
.ship-btn { margin-top: 10px; width: 100%; background: var(--brown); color: #fff; border: 0; border-radius: 8px; padding: 10px; font-size: 14px; font-weight: 600; }

.dialog-bg { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.dialog { background: #fff; width: 100%; max-width: 460px; border-radius: 16px 16px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); }
.dialog-order { font-size: 15px; margin-bottom: 14px; }
.dialog label { display: block; font-size: 13px; color: var(--muted); }
.dialog input { width: 100%; margin-top: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 18px; letter-spacing: 1px; }
.dialog-warn { font-size: 12px; color: #b5471a; background: #fff0ea; border-radius: 8px; padding: 8px 10px; margin: 12px 0; }
.dialog-actions { display: flex; gap: 10px; }
.dialog-actions button { flex: 1; padding: 13px; border-radius: 10px; font-size: 15px; font-weight: 600; border: 0; }
.dialog-actions .ghost { background: #eee; color: #444; }
.dialog-actions .danger { background: #d64545; color: #fff; }
.dialog-actions .danger:disabled { opacity: .6; }
