/* ============================================================
   PRICIA — プライスカード印刷システム 共通スタイル
   ============================================================ */

:root {
  /* --- Deep navy on light grey palette --- */
  --bg: oklch(0.985 0.003 250);
  --bg-soft: oklch(0.965 0.005 250);
  --bg-card: oklch(1 0 0);
  --ink: oklch(0.22 0.05 255);
  --ink-soft: oklch(0.42 0.04 255);
  --ink-mute: oklch(0.58 0.025 255);
  --line: oklch(0.91 0.008 250);
  --line-strong: oklch(0.80 0.012 250);

  --primary: oklch(0.28 0.10 260);
  --primary-deep: oklch(0.20 0.11 260);
  --primary-soft: oklch(0.93 0.025 255);

  --accent: oklch(0.32 0.11 258);
  --accent-soft: oklch(0.94 0.022 255);

  --success: oklch(0.62 0.10 150);
  --success-soft: oklch(0.95 0.03 150);
  --warn: oklch(0.70 0.12 75);
  --danger: oklch(0.55 0.18 25);
  --danger-soft: oklch(0.96 0.03 25);

  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-pill: 999px;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.04), 0 1px 3px oklch(0 0 0 / 0.03);
  --shadow-md: 0 2px 14px oklch(0 0 0 / 0.06), 0 1px 3px oklch(0 0 0 / 0.04);
  --shadow-lg: 0 14px 36px oklch(0 0 0 / 0.10), 0 4px 10px oklch(0 0 0 / 0.05);

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text",
               "Hiragino Sans", "Hiragino Kaku Gothic ProN",
               "Yu Gothic Medium", "游ゴシック Medium", YuGothic, Meiryo, sans-serif;
  --font-display: var(--font-sans);
  --font-num: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-weight: 400;
  letter-spacing: -0.014em;
  color: var(--ink);
  background: var(--bg-soft);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "palt" 1;
}
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -0.028em; font-weight: 700; }
strong, b { font-weight: 700; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.num { font-family: var(--font-num); letter-spacing: -0.022em; font-feature-settings: "tnum" 1; font-weight: 600; }

/* ---------- App shell ---------- */
.app-shell {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ---------- Top bar ---------- */
.topbar {
  flex: 0 0 auto;
  height: 52px;
  background: oklch(1 0 0 / 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid oklch(0 0 0 / 0.08);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar nav { display: flex; gap: 4px; margin-left: 24px; }
.topbar nav a, .topbar nav button {
  padding: 8px 16px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: -0.012em;
  transition: background .15s, color .15s;
  display: inline-block;
}
.topbar nav a:hover, .topbar nav button:hover { color: var(--ink); }
.topbar nav a.active { background: var(--bg-soft); color: var(--ink); }
.topbar .spacer { flex: 1; }
.topbar .user { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-soft); }
.topbar .user .u-name { font-size: 13px; font-weight: 700; color: var(--ink); }
.topbar .user .u-meta { font-size: 11px; color: var(--ink-mute); }
.topbar .user .u-role { color: var(--primary); font-weight: 600; }
.topbar .avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg-soft); color: var(--ink);
  display: grid; place-items: center;
  font-weight: 600; font-size: 13px;
  border: 1px solid var(--line);
}
.topbar .logout-link {
  font-size: 12px; color: var(--ink-mute);
  padding: 6px 10px; border-radius: var(--r-pill);
  display: inline-flex; align-items: center; gap: 4px;
}
.topbar .logout-link:hover { background: var(--bg-soft); color: var(--ink); }

/* PRICIA logo mark */
.pricia-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  display: grid; place-items: center;
  font-family: var(--font-num);
  font-weight: 700; font-size: 18px;
  letter-spacing: -0.04em;
  flex: 0 0 auto;
  position: relative;
}
.pricia-mark::before {
  content: ""; position: absolute;
  top: 5px; left: 50%; transform: translateX(-50%);
  width: 12px; height: 3px;
  background: white; border-radius: 1.5px;
  opacity: 0.9;
}
.pricia-mark.lg { width: 56px; height: 56px; border-radius: 14px; font-size: 32px; }
.pricia-mark.lg::before { top: 9px; width: 22px; height: 5px; border-radius: 2.5px; }
.pricia-brand { display: flex; flex-direction: column; line-height: 1; gap: 3px; }
.pricia-brand .b1 { font-weight: 700; font-size: 16px; letter-spacing: -0.02em; color: var(--primary); }
.pricia-brand .b2 { font-size: 8px; font-weight: 600; letter-spacing: 0.18em; color: var(--ink-mute); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px;
  border-radius: var(--r-pill);
  font-size: 14px; font-weight: 600;
  letter-spacing: -0.014em;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: white; }
.btn-primary:hover { background: var(--primary-deep); }
.btn-primary:disabled { background: var(--line-strong); cursor: default; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-strong); }
.btn-ghost:hover { background: var(--bg-soft); }
.btn-lg { padding: 14px 24px; font-size: 16px; }

/* ---------- Cards / Chips / Fields ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 11px; font-weight: 500;
  background: var(--bg-soft); color: var(--ink-soft);
  border: 1px solid var(--line);
  letter-spacing: -0.005em;
}
.chip-primary { background: var(--ink); color: white; border-color: transparent; }
.chip-plan { background: oklch(0.86 0.055 255); color: oklch(0.30 0.11 258); border: none; }
.chip-done { background: oklch(0.44 0.012 250); color: white; border: none; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.field input[type="text"], .field input[type="password"], .field input[type="number"],
.field select, .field textarea {
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  font-size: 14px;
  background: var(--bg-card);
  letter-spacing: -0.01em;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px oklch(0 0 0 / 0.06);
}

/* ---------- Scrollbar ---------- */
.nice-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.nice-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
.nice-scroll::-webkit-scrollbar-thumb:hover { background: var(--ink-mute); background-clip: padding-box; }
.nice-scroll::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   Home — main layout
   ============================================================ */
.home-main { flex: 1; overflow: auto; padding: 28px 36px 40px; }
.home-top {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(340px, 3fr);
  gap: 20px;
  margin-bottom: 22px;
  align-items: stretch;
}
@media (max-width: 1080px) {
  .home-top { grid-template-columns: 1fr; }
}

/* --- Panel headers (campaign / calendar) --- */
.panel-head {
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  flex: 0 0 auto; gap: 8px;
}
.panel-head .ph-left { display: flex; align-items: center; gap: 8px; }
.panel-head .ph-icon {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--primary-soft); color: var(--primary-deep);
  display: grid; place-items: center;
}
.panel-head h3 { font-size: 14px; font-weight: 700; margin: 0; }
.panel-head .ph-note { font-size: 12px; color: var(--ink-mute); display: flex; align-items: center; gap: 12px; }
.panel-head .ph-link { font-size: 12px; font-weight: 600; color: var(--primary); display: inline-flex; align-items: center; gap: 2px; }

/* --- Campaign table --- */
.campaign-card { padding: 0; overflow: hidden; height: 100%; display: flex; flex-direction: column; }
.campaign-scroll { flex: 1; overflow: auto; min-height: 0; }
.campaign-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.campaign-table thead tr {
  background: var(--bg-soft);
  text-align: left;
  position: sticky; top: 0; z-index: 1;
}
.campaign-table th {
  padding: 8px 14px;
  font-size: 11px; font-weight: 700;
  color: var(--ink-mute); letter-spacing: 0.04em;
}
.campaign-table td { padding: 10px 14px; }
.campaign-table tbody tr { border-top: 1px solid var(--line); transition: background .12s; }
.campaign-table tbody tr.clickable { cursor: pointer; }
.campaign-table tbody tr.clickable:hover { background: var(--primary-soft) !important; }
.status-chip {
  display: inline-flex; padding: 3px 10px;
  border-radius: 999px; font-size: 11px; font-weight: 700;
}
.st-active  { background: var(--primary); color: white; }
.st-plan    { background: oklch(0.86 0.055 255); color: oklch(0.30 0.11 258); }
.st-done    { background: oklch(0.44 0.012 250); color: white; }
tr.row-plan { background: oklch(0.965 0.018 255); }
tr.row-done { background: oklch(0.74 0.006 250); color: oklch(0.34 0.01 250); }
.campaign-empty {
  padding: 42px 20px; text-align: center;
  color: var(--ink-mute); font-size: 13px;
}

/* --- Calendar --- */
.cal-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.cal-nav-btn {
  width: 26px; height: 26px; border-radius: 7px;
  display: grid; place-items: center;
  color: var(--ink-soft);
}
.cal-nav-btn:hover { background: var(--bg-soft); }
.cal-week {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: var(--bg-soft); border-bottom: 1px solid var(--line);
}
.cal-week span { padding: 7px 0; text-align: center; font-size: 11px; font-weight: 700; color: var(--ink-mute); }
.cal-week span.sat { color: oklch(0.48 0.11 250); }
.cal-week span.sun { color: oklch(0.50 0.14 25); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); flex: 1; }
.cal-cell {
  min-height: 62px; padding: 5px 4px 6px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--bg-card);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.empty { background: oklch(0.98 0.003 250); }
.cal-day {
  font-family: var(--font-num);
  font-size: 12px; font-weight: 500; color: var(--ink-soft);
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
}
.cal-day.sat { color: oklch(0.48 0.11 250); }
.cal-day.sun { color: oklch(0.50 0.14 25); }
.cal-day.today { background: var(--primary); color: white; font-weight: 700; }
.cal-badge {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary); color: white;
  border: 2px solid oklch(0.93 0.025 255);
  display: grid; place-items: center;
  font-family: var(--font-num); font-weight: 700; font-size: 12px;
  letter-spacing: -0.03em;
  cursor: pointer; transition: transform .1s, box-shadow .15s;
}
.cal-badge:hover { transform: scale(1.12); box-shadow: 0 3px 10px oklch(0.28 0.10 260 / 0.35); }
.cal-foot {
  padding: 10px 16px;
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--ink-soft);
  background: var(--bg-soft);
}
.cal-foot .demo-badge {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--primary); color: white;
  display: grid; place-items: center;
  font-size: 9px; font-weight: 700; font-family: var(--font-num);
}

/* --- Quick actions --- */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
@media (max-width: 1080px) { .quick-grid { grid-template-columns: repeat(2, 1fr); } }
.quick-action {
  padding: 18px; text-align: left; cursor: pointer;
  display: flex; align-items: center; gap: 14px;
  transition: transform .1s, box-shadow .15s;
  width: 100%;
}
.quick-action:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.quick-action .qa-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--primary-soft); color: var(--primary-deep);
  display: grid; place-items: center; flex: 0 0 auto;
}
.quick-action.highlight { border: 2px solid var(--primary); background: linear-gradient(135deg, var(--primary-soft), white); }
.quick-action.highlight .qa-icon { background: var(--primary); color: white; }
.quick-action .qa-label { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.quick-action .qa-desc { font-size: 12px; color: var(--ink-mute); }
.quick-action .qa-body { flex: 1; min-width: 0; }

/* --- Admin menu --- */
.admin-divider { display: flex; align-items: center; gap: 8px; margin: 8px 4px 8px; color: var(--ink-soft); }
.admin-divider span.t { font-size: 12px; font-weight: 700; letter-spacing: 0.05em; }
.admin-divider span.rule { flex: 1; height: 1px; background: var(--line); }
.admin-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 28px; }
@media (max-width: 1080px) { .admin-grid { grid-template-columns: repeat(2, 1fr); } }
.admin-action {
  padding: 14px; text-align: left; cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-card);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-md);
  transition: all .12s;
  width: 100%;
}
.admin-action:hover { border-style: solid; background: var(--bg-soft); }
.admin-action .aa-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: oklch(0.94 0.01 60); color: var(--ink-soft);
  display: grid; place-items: center; flex: 0 0 auto;
}
.admin-action .aa-label { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.admin-action .aa-desc { font-size: 11px; color: var(--ink-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-action .aa-body { flex: 1; min-width: 0; }

/* --- Layout cards --- */
.layouts-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.layouts-head h2 { font-size: 19px; font-weight: 700; margin: 0; }
.layout-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1080px) { .layout-grid { grid-template-columns: repeat(2, 1fr); } }
.layout-card { overflow: hidden; transition: all .12s; cursor: pointer; }
.layout-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.layout-card .lc-preview {
  height: 130px; background: var(--bg-soft);
  display: grid; place-items: center;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.layout-card .lc-size { position: absolute; top: 10px; right: 10px; }
.layout-card .lc-body { padding: 12px 16px; }
.layout-card .lc-name { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.layout-card .lc-desc { font-size: 12px; color: var(--ink-mute); margin-bottom: 8px; }
.layout-card .lc-meta { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--ink-mute); }
.layout-card .lc-open { display: flex; align-items: center; gap: 2px; color: var(--primary); font-weight: 600; }
.mini-card {
  background: white; border: 1px solid var(--line-strong);
  border-radius: 3px; overflow: hidden;
  box-shadow: 0 2px 6px oklch(0.28 0.02 60 / 0.1);
}

/* ---------- Alert banner (DB error etc.) ---------- */
.alert-banner {
  margin: 0 0 18px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--danger-soft);
  border: 1px solid oklch(0.85 0.08 25);
  color: var(--danger);
  font-size: 13px;
  display: flex; gap: 8px; align-items: flex-start;
}

/* ============================================================
   Login page
   ============================================================ */
body.login-body {
  background:
    radial-gradient(1200px 600px at 80% -10%, oklch(0.93 0.025 255 / 0.8), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, oklch(0.94 0.022 255 / 0.9), transparent 55%),
    var(--bg-soft);
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.login-card {
  width: 420px; max-width: 100%;
  padding: 36px 36px 30px;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
}
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-brand .lb-name { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; color: var(--primary); line-height: 1; }
.login-brand .lb-sub { font-size: 11px; font-weight: 600; letter-spacing: 0.22em; color: var(--ink-mute); }
.login-form { display: flex; flex-direction: column; gap: 18px; }
.emp-name-preview {
  min-height: 20px;
  font-size: 13px;
  display: flex; align-items: center; gap: 6px;
}
.emp-name-preview.ok { color: var(--ink); font-weight: 700; }
.emp-name-preview.ng { color: var(--danger); }
.login-error {
  background: var(--danger-soft);
  border: 1px solid oklch(0.85 0.08 25);
  color: var(--danger);
  border-radius: var(--r-md);
  font-size: 13px;
  padding: 10px 14px;
  display: none;
}
.login-error.show { display: block; }
.login-foot { margin-top: 22px; text-align: center; font-size: 11px; color: var(--ink-mute); }

/* ---------- Confirm modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: oklch(0.2 0.03 255 / 0.45);
  display: none; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
  width: 400px; max-width: 100%;
  background: var(--bg-card);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 24px;
}
.modal h3 { margin: 0 0 10px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.modal p { margin: 0 0 20px; font-size: 13px; color: var(--ink-soft); line-height: 1.7; }
.modal .modal-actions { display: flex; gap: 10px; justify-content: flex-end; }
