/* ============================================================
   安心殯葬平台 — Prototype 共用樣式
   純展示用途。莊重、沉穩、可信賴的視覺調性。
   ============================================================ */

:root {
  /* 色彩 — 暖米底 + 墨綠側欄 + 銅金點綴 */
  --bg:        #F4F1EA;
  --bg-warm:   #FAF8F3;
  --surface:   #FFFFFF;
  --sidebar:   #17190F;
  --sidebar-2: #1F2116;
  --ink:       #26261F;
  --ink-soft:  #5E5E54;
  --muted:     #9A988C;
  --line:      #E9E4D8;
  --line-soft: #F0ECE2;

  --gold:      #B5893C;
  --gold-2:    #C9A24B;
  --gold-soft: #F3E9D3;

  /* 狀態色 */
  --st-green:  #4C8A5B;  --st-green-bg:  #E7F1E9;
  --st-blue:   #4F6FA6;  --st-blue-bg:   #E8EDF6;
  --st-amber:  #C08A2E;  --st-amber-bg:  #F8EED6;
  --st-gray:   #7C7A70;  --st-gray-bg:   #EDEAE1;
  --st-red:    #B0524A;  --st-red-bg:    #F6E5E2;

  /* 品項圖示底色 */
  --tile-1:#EFE6D6; --tile-2:#F5E0DA; --tile-3:#EAE3F0;
  --tile-4:#E1E9DE; --tile-5:#F5EAD3; --tile-6:#E3ECEF;

  --radius:   16px;
  --radius-sm:10px;
  --shadow:   0 1px 2px rgba(30,28,20,.04), 0 8px 24px rgba(30,28,20,.05);
  --shadow-sm:0 1px 2px rgba(30,28,20,.05);

  --serif: "Noto Serif TC", "Songti TC", serif;
  --sans:  "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

/* ---------- App 版面：側欄 + 主內容 ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  color: #CFCBBD;
  display: flex; flex-direction: column;
  padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 22px; }
.brand__mark {
  width: 40px; height: 40px; border-radius: 12px;
  background: radial-gradient(circle at 30% 30%, var(--gold-2), var(--gold));
  display: grid; place-items: center; font-size: 20px; color: #17190F;
  box-shadow: 0 4px 12px rgba(181,137,60,.35);
}
.brand__name { font-family: var(--serif); font-size: 17px; color: #F3EEDF; letter-spacing: .5px; }
.brand__sub  { font-size: 10px; color: #7E7B6B; letter-spacing: 1.5px; text-transform: uppercase; }

.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 10px;
  color: #B7B4A6; font-size: 14px; transition: background .15s, color .15s;
}
.nav a .ic { width: 20px; text-align: center; font-size: 15px; opacity: .9; }
.nav a:hover { background: rgba(255,255,255,.05); color: #F0ECDD; }
.nav a.active {
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #201C0F; font-weight: 600;
  box-shadow: 0 4px 14px rgba(181,137,60,.3);
}
.nav a .badge {
  margin-left: auto; background: var(--st-red); color: #fff;
  font-size: 11px; min-width: 20px; height: 20px; border-radius: 10px;
  display: grid; place-items: center; padding: 0 6px;
}
.nav a.active .badge { background: #201C0F; color: var(--gold-2); }

.sidebar__foot { margin-top: auto; padding-top: 18px; }
.hotline {
  background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px; padding: 14px;
}
.hotline__label { font-size: 11px; color: #8B8878; }
.hotline__num { font-family: var(--serif); font-size: 19px; color: var(--gold-2); letter-spacing: .5px; margin: 2px 0; }
.hotline__time { font-size: 11px; color: #7E7B6B; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- 頂列 ---------- */
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 20px 32px; background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topbar__greet { flex: 1; }
.topbar__greet h1 { font-family: var(--serif); font-size: 22px; margin: 0; font-weight: 600; }
.topbar__greet p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.iconbtn {
  width: 40px; height: 40px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--line); display: grid; place-items: center;
  font-size: 17px; position: relative; cursor: pointer;
}
.iconbtn .dot {
  position: absolute; top: -4px; right: -4px; background: var(--st-red); color: #fff;
  font-size: 10px; min-width: 18px; height: 18px; border-radius: 9px;
  display: grid; place-items: center; padding: 0 5px;
}
.userchip {
  display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 30px; cursor: pointer;
}
.userchip img, .avatar {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  background: linear-gradient(135deg,#D8CBB0,#B79A6A); display: grid; place-items: center;
  color: #fff; font-size: 15px; font-family: var(--serif);
}
.userchip b { font-size: 14px; }
.userchip small { display: block; color: var(--muted); font-size: 11px; }

.content { padding: 26px 32px 48px; }
.content--narrow { max-width: 1100px; }

/* ---------- 通用元件 ---------- */
.section-title {
  font-family: var(--serif); font-size: 19px; margin: 4px 0 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.section-title a { color: var(--gold); font-size: 13px; font-family: var(--sans); }
.section-title a:hover { text-decoration: underline; }

.stat-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 18px; margin-bottom: 30px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.stat__top { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 13px; }
.stat__ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; }
.stat__num { font-family: var(--serif); font-size: 30px; margin: 8px 0 6px; font-weight: 600; }
.stat__num small { font-size: 15px; color: var(--ink-soft); font-weight: 400; margin-left: 3px; }
.stat__link { color: var(--gold); font-size: 12px; }
.stat__link:hover { text-decoration: underline; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }

/* 進行中案件列 */
.case-row {
  display: grid; grid-template-columns: 260px 1fr auto; gap: 22px; align-items: center;
  padding: 20px 22px; border-bottom: 1px solid var(--line-soft);
}
.case-row:last-child { border-bottom: 0; }
.case-row__name { font-family: var(--serif); font-size: 17px; }
.case-row__name .hon { font-size: 13px; color: var(--muted); font-family: var(--sans); margin-left: 4px; }
.case-meta { color: var(--ink-soft); font-size: 13px; margin-top: 8px; }
.case-meta div { margin-top: 3px; }
.progress-label { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.progress { height: 8px; border-radius: 6px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 6px; }
.chev { color: var(--muted); font-size: 22px; }

/* 品項小圖 row */
.item-icons { display: flex; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.item-ic { text-align: center; width: 44px; }
.item-ic .b {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-size: 18px; margin: 0 auto 4px;
}
.item-ic small { font-size: 11px; color: var(--ink-soft); }

/* 品項底色輪替 */
.t1{background:var(--tile-1)} .t2{background:var(--tile-2)} .t3{background:var(--tile-3)}
.t4{background:var(--tile-4)} .t5{background:var(--tile-5)} .t6{background:var(--tile-6)}

/* 快速下單九宮格 */
.quick-grid { display: grid; grid-template-columns: repeat(10,1fr); gap: 14px; }
.quick-grid.cols-3 { grid-template-columns: repeat(3,1fr); }
.quick-tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 16px 8px; text-align: center; cursor: pointer; transition: transform .12s, box-shadow .12s;
}
.quick-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--gold-soft); }
.quick-tile .b { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; margin: 0 auto 8px; }
.quick-tile small { font-size: 12px; color: var(--ink-soft); }

/* 標籤 / 徽章 */
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 10px; border-radius: 20px; font-weight: 600; }
.tag--green { background: var(--st-green-bg); color: var(--st-green); }
.tag--blue  { background: var(--st-blue-bg);  color: var(--st-blue); }
.tag--amber { background: var(--st-amber-bg); color: var(--st-amber); }
.tag--gray  { background: var(--st-gray-bg);  color: var(--st-gray); }
.tag--red   { background: var(--st-red-bg);   color: var(--st-red); }

/* 表格 */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); font-size: 14px; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--bg-warm); }
.table .num { font-family: var(--serif); }

/* 按鈕 */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 9px 18px; border-radius: 10px; font-size: 14px; font-weight: 600;
  cursor: pointer; border: 1px solid transparent; font-family: var(--sans);
}
.btn--gold { background: linear-gradient(180deg,var(--gold-2),var(--gold)); color: #201C0F; }
.btn--gold:hover { filter: brightness(1.05); }
.btn--dark { background: var(--st-green); color: #fff; }
.btn--dark:hover { filter: brightness(1.05); }
.btn--ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn--ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn--danger { background: var(--st-red-bg); color: var(--st-red); }
.btn--danger:hover { background: #f0d6d1; }
.btn--sm { padding: 6px 14px; font-size: 13px; }

/* 頁面標題（子頁） */
.page-head { margin-bottom: 22px; }
.page-head h2 { font-family: var(--serif); font-size: 24px; margin: 0 0 4px; }
.page-head p { margin: 0; color: var(--muted); }

/* placeholder 空狀態（stub 頁面） */
.placeholder {
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 60px 30px; text-align: center; color: var(--muted);
}
.placeholder .ic { font-size: 40px; margin-bottom: 12px; }
.placeholder h3 { font-family: var(--serif); color: var(--ink); margin: 0 0 6px; font-size: 18px; }

/* 分頁 tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs a { padding: 12px 18px; font-size: 14px; color: var(--ink-soft); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--gold); border-bottom-color: var(--gold); font-weight: 600; }
.tabs a .n { color: var(--muted); font-size: 12px; margin-left: 4px; }

/* 訂單狀態時間軸 */
.timeline { list-style: none; margin: 0; padding: 6px 0; }
.timeline li { display: flex; gap: 14px; position: relative; padding-bottom: 20px; }
.timeline li::before {
  content: ""; position: absolute; left: 6px; top: 16px; bottom: -4px; width: 2px; background: var(--line);
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::before { display: none; }
.timeline .dot { width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--line); background: #fff; flex-shrink: 0; z-index: 1; }
.timeline li.done .dot { border-color: var(--st-green); background: var(--st-green); }
.timeline li.current .dot { border-color: var(--gold); background: var(--gold); }
.timeline .tl-time { font-size: 12px; color: var(--muted); }
.timeline .tl-text { font-size: 14px; }

/* 詳情鍵值列 */
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 10px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.kv dd.strong { font-family: var(--serif); font-size: 16px; }

/* 表單 */
.form-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 18px 22px; }
.field label { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-family: var(--sans); font-size: 14px; background: var(--bg-warm); color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--gold); background: #fff; }
.field--full { grid-column: 1 / -1; }

.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; align-items: start; }
.pad { padding: 22px; }
.pad-lg { padding: 26px; }

/* ---------- Demo 入口首頁 ---------- */
.launch {
  min-height: 100vh; display: grid; place-items: center;
  background:
    radial-gradient(1200px 500px at 50% -10%, #fff, transparent),
    var(--bg);
  padding: 40px;
}
.launch__inner { max-width: 960px; width: 100%; text-align: center; }
.launch__mark {
  width: 72px; height: 72px; border-radius: 20px; margin: 0 auto 20px;
  background: radial-gradient(circle at 30% 30%, var(--gold-2), var(--gold));
  display: grid; place-items: center; font-size: 36px; color: #17190F;
  box-shadow: 0 10px 30px rgba(181,137,60,.35);
}
.launch h1 { font-family: var(--serif); font-size: 34px; margin: 0 0 6px; }
.launch p.sub { color: var(--ink-soft); margin: 0 0 40px; letter-spacing: 1px; }
.launch__grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
.launch__card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 32px 24px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s;
}
.launch__card:hover { transform: translateY(-5px); box-shadow: 0 16px 40px rgba(30,28,20,.12); }
.launch__card .em { font-size: 40px; }
.launch__card h3 { font-family: var(--serif); font-size: 20px; margin: 14px 0 6px; }
.launch__card p { color: var(--muted); font-size: 13px; margin: 0 0 16px; }
.launch__note { margin-top: 34px; color: var(--muted); font-size: 12px; }

/* ---------- 手機 App ---------- */
.phone-stage { min-height: 100vh; display: grid; place-items: center; background: var(--bg); padding: 40px; }
.phone-wrap { display: flex; gap: 40px; align-items: flex-start; flex-wrap: wrap; justify-content: center; }
.phone {
  width: 340px; background: #000; border-radius: 44px; padding: 10px;
  box-shadow: 0 30px 70px rgba(30,28,20,.3);
}
.phone__screen { background: var(--bg); border-radius: 36px; overflow: hidden; height: 720px; overflow-y: auto; position: relative; }
.phone__screen::-webkit-scrollbar { width: 0; }
.phone__status { display: flex; justify-content: space-between; padding: 12px 24px 6px; font-size: 12px; font-weight: 600; }
.phone__notch { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 150px; height: 26px; background: #000; border-radius: 0 0 18px 18px; z-index: 5; }
.m-head { display: flex; align-items: center; gap: 12px; padding: 8px 20px 12px; }
.m-head h2 { flex: 1; font-family: var(--serif); font-size: 17px; margin: 0; text-align: center; }
.m-back, .m-menu { font-size: 20px; color: var(--ink-soft); width: 24px; }
.m-body { padding: 4px 18px 26px; }
.m-greet { font-family: var(--serif); font-size: 19px; margin: 8px 0 2px; }
.m-greet + p { color: var(--muted); font-size: 12px; margin: 0 0 16px; }
.m-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 22px; }
.m-stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: var(--shadow-sm); }
.m-stat .t { font-size: 12px; color: var(--ink-soft); display: flex; align-items: center; gap: 8px; }
.m-stat .n { font-family: var(--serif); font-size: 22px; margin-top: 6px; }
.m-stat .n small { font-size: 12px; color: var(--ink-soft); }
.m-sect { display: flex; justify-content: space-between; align-items: center; margin: 18px 0 12px; }
.m-sect h3 { font-family: var(--serif); font-size: 15px; margin: 0; }
.m-sect a { color: var(--gold); font-size: 12px; }
.m-case { display: block; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.m-case .r1 { display: flex; justify-content: space-between; align-items: baseline; }
.m-case .nm { font-family: var(--serif); font-size: 15px; }
.m-case .mt { color: var(--muted); font-size: 12px; margin: 6px 0 8px; }
.m-quick-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.m-fab { position: sticky; bottom: 78px; margin: 4px 6px 0 auto; width: 52px; height: 52px; border-radius: 50%; background: linear-gradient(180deg,var(--gold-2),var(--gold)); color:#201C0F; display: grid; place-items: center; font-size: 26px; box-shadow: 0 8px 20px rgba(181,137,60,.45); }
.m-tabbar { position: sticky; bottom: 0; display: flex; background: #fff; border-top: 1px solid var(--line); padding: 8px 0 14px; }
.m-tabbar a { flex: 1; text-align: center; font-size: 10px; color: var(--muted); }
.m-tabbar a .ic { display: block; font-size: 18px; margin-bottom: 2px; }
.m-tabbar a.active { color: var(--gold); }
.phone__label { text-align: center; color: var(--ink-soft); font-size: 13px; margin-top: 16px; font-family: var(--serif); }

/* 供應商小圖示標題 */
.supplier-head { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; }
.supplier-head .avatar { width: 44px; height: 44px; }
.supplier-head b { font-family: var(--serif); font-size: 16px; color: #F3EEDF; }
.supplier-head small { display: block; color: #8B8878; font-size: 12px; }

/* 漢堡鈕（僅手機顯示）與抽屜遮罩 */
.hamburger {
  display: none; width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--line); font-size: 18px; cursor: pointer;
  align-items: center; justify-content: center; color: var(--ink);
}
.backdrop { position: fixed; inset: 0; background: rgba(20,18,12,.45); z-index: 55; border: 0; }

/* ============ 響應式 ============ */

/* 平板：多欄縮減 */
@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2,1fr); }
  .quick-grid { grid-template-columns: repeat(5,1fr); }
  .two-col { grid-template-columns: 1fr; }
}

/* 手機：側欄改為滑出式抽屜 + 版面適配 */
@media (max-width: 720px) {
  .hamburger { display: inline-flex; }

  /* 側欄變成從左滑入的抽屜 */
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh; width: 258px; z-index: 60;
    transform: translateX(-100%); transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 10px 0 40px rgba(0,0,0,.35); }

  /* 頂列與內容縮排 */
  .topbar { padding: 14px 16px; gap: 12px; }
  .topbar__greet h1 { font-size: 18px; }
  .topbar__greet p { font-size: 12px; }
  .content { padding: 18px 16px 40px; }
  .userchip { padding: 4px; }
  .userchip small { display: none; }
  .userchip b { display: none; }

  /* 表格與分頁：容器內橫向捲動，避免撐破頁面 */
  .card:has(table) { overflow-x: auto; }
  .card:has(table) .table { min-width: 620px; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tabs a { white-space: nowrap; }

  /* 網格堆疊 */
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .quick-grid { grid-template-columns: repeat(4,1fr); }
  .case-row { grid-template-columns: 1fr; gap: 14px; }
  .case-row .chev { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .launch__grid { grid-template-columns: 1fr; }
  .launch h1 { font-size: 27px; }
}

/* 小手機：品項格再縮 */
@media (max-width: 400px) {
  .quick-grid { grid-template-columns: repeat(3,1fr); }
  .stat-grid { grid-template-columns: 1fr; }
}
