/* 濃務一條龍 — Prototype Styles */

/* ===== CSS Variables (set on :root, themed by JS) ===== */
:root {
  --bg: #f6f3ec;
  --surface: #fdfbf6;
  --surface-2: #f0ece2;
  --ink: #1f1d18;
  --ink-2: #4a4639;
  --ink-3: #8a8674;
  --line: #e3ddcc;
  --line-2: #d6cfb9;
  --accent: #2d5a3d;
  --accent-fg: #ffffff;
  --accent-2: #d4a23a;
  --gold: #c98b3c;
  --warn: #b8541a;
  --err: #a83232;
  --ok: #4a7c4f;
  --info: #3a6b8c;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 2px 6px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.06);
  --radius: 6px;
  --radius-lg: 12px;
  --font-sans: "Noto Sans TC", "Source Han Sans TC", "PingFang TC", -apple-system, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

/* Dark mode */
[data-dark="true"] {
  --bg: #1a1814;
  --surface: #24211b;
  --surface-2: #2e2a22;
  --ink: #f3eedc;
  --ink-2: #c4bca3;
  --ink-3: #807865;
  --line: #3a3528;
  --line-2: #4a4334;
  --accent: #6dba81;
  --accent-fg: #0f1d14;
  --accent-2: #d8b04a;
  --gold: #e0a850;
  --warn: #d27a3a;
  --err: #d96060;
  --ok: #6dba81;
  --info: #6ba3c5;
}

/* Style: warm-gov (default) — beige + deep green, conservative gov vibe */
[data-style="warm-gov"] {
  --bg: #f6f3ec;
  --surface: #fdfbf6;
  --surface-2: #f0ece2;
  --ink: #1f1d18;
  --line: #e3ddcc;
  --accent: #2d5a3d;
  --radius: 6px;
}
[data-style="warm-gov"][data-dark="true"] {
  --bg: #1a1814;
  --surface: #24211b;
  --surface-2: #2e2a22;
  --ink: #f3eedc;
  --line: #3a3528;
  --accent: #6dba81;
}

/* Style: modern-saas — slate neutrals + agriculture green */
[data-style="modern"] {
  --bg: #f3f5f1;
  --surface: #ffffff;
  --surface-2: #ebeee8;
  --ink: #18221b;
  --ink-2: #3d4a3f;
  --ink-3: #7a857c;
  --line: #dde2db;
  --line-2: #c9d0c5;
  --accent: #2f7a4d;
  --gold: #c98b3c;
  --radius: 10px;
  --radius-lg: 14px;
}
[data-style="modern"][data-dark="true"] {
  --bg: #14181a;
  --surface: #1d2225;
  --surface-2: #262b2e;
  --ink: #e8edea;
  --ink-2: #b3bcb6;
  --ink-3: #768079;
  --line: #2c3236;
  --line-2: #3b4347;
  --accent: #5fc188;
}

/* Style: notion-dense — light, clean, info-dense */
[data-style="dense"] {
  --bg: #fafaf8;
  --surface: #ffffff;
  --surface-2: #f3f3ef;
  --ink: #1d1d1b;
  --ink-2: #4d4d49;
  --ink-3: #8a8a85;
  --line: #ececea;
  --line-2: #d8d8d4;
  --accent: #2c3e2d;
  --radius: 4px;
  --radius-lg: 8px;
}
[data-style="dense"][data-dark="true"] {
  --bg: #131311;
  --surface: #1a1a18;
  --surface-2: #232321;
  --ink: #ededea;
  --ink-2: #b8b8b3;
  --ink-3: #767672;
  --line: #2a2a27;
  --line-2: #353532;
  --accent: #8fb494;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  min-height: 100vh;
}

button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

/* Top toolbar of the prototype shell */
.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.shell-top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(20px);
}
.shell-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 15px; letter-spacing: .02em;
  color: var(--ink);
}
.shell-brand .logo {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--accent); color: var(--accent-fg);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
.shell-brand .sub {
  font-size: 11px; color: var(--ink-3); font-weight: 400; margin-left: 4px;
  font-family: var(--font-mono);
}
.shell-tabs {
  display: flex; gap: 2px;
  margin-left: 24px;
  flex: 1;
  overflow-x: auto;
}
.shell-tab {
  appearance: none; border: 0; background: transparent;
  padding: 6px 12px; border-radius: var(--radius);
  font-size: 13px; color: var(--ink-2);
  white-space: nowrap;
}
.shell-tab:hover { background: var(--surface-2); color: var(--ink); }
.shell-tab[data-active="true"] {
  background: var(--ink); color: var(--surface);
  font-weight: 500;
}
.shell-right {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--ink-3);
}
.role-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2);
  font-size: 12px;
  border: 1px solid var(--line);
}
.role-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* Stage area */
.stage {
  flex: 1;
  padding: 24px;
  display: flex;
  gap: 24px;
  align-items: flex-start;
  justify-content: center;
  min-height: calc(100vh - 56px);
}
.stage[data-mode="both"] {
  align-items: stretch;
}

/* Phone frame */
.phone {
  width: 390px;
  flex-shrink: 0;
  border-radius: 38px;
  background: #1a1814;
  padding: 12px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,0,0,.4) inset;
  position: relative;
}
.phone-screen {
  background: var(--bg);
  border-radius: 28px;
  height: 800px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}
.phone-notch {
  position: absolute;
  top: 18px; left: 50%; transform: translateX(-50%);
  width: 110px; height: 30px;
  background: #1a1814;
  border-radius: 16px;
  z-index: 100;
}
.phone-status {
  flex-shrink: 0;
  padding: 14px 24px 4px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; font-weight: 600;
  color: var(--ink);
}
.phone-status .right { display: flex; gap: 5px; align-items: center; }
.phone-content {
  flex: 1;
  overflow-y: auto;
  position: relative;
  display: flex; flex-direction: column;
}
.phone-label {
  position: absolute;
  bottom: -28px;
  left: 50%; transform: translateX(-50%);
  font-size: 11px; color: var(--ink-3);
  font-family: var(--font-mono);
  letter-spacing: .05em;
}

/* Desktop frame */
.desktop {
  flex: 1;
  max-width: 1400px;
  min-width: 800px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  align-self: stretch;
  display: flex; flex-direction: column;
}
.desktop-chrome {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.desktop-chrome .dots { display: flex; gap: 6px; }
.desktop-chrome .dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--line-2);
}
.desktop-chrome .url {
  flex: 1; text-align: center;
  font-size: 11px; color: var(--ink-3);
  font-family: var(--font-mono);
  background: var(--surface);
  padding: 3px 12px; border-radius: 6px;
  max-width: 400px; margin: 0 auto;
  border: 1px solid var(--line);
}
.desktop-content {
  flex: 1; overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 800px;
  background: var(--bg);
}

/* App-internal styles for screens */
.app-shell { display: flex; flex: 1; min-height: 0; }
.sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto;
}
.sidebar h3 {
  font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 600;
  margin: 14px 8px 6px;
}
.sidebar h3:first-child { margin-top: 0; }
.nav-item {
  appearance: none; border: 0; background: transparent;
  padding: 7px 10px; border-radius: var(--radius);
  font-size: 13px; color: var(--ink-2);
  display: flex; align-items: center; gap: 10px;
  text-align: left; width: 100%;
  text-decoration: none;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item[data-active="true"] {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent); font-weight: 500;
}
[data-dark="true"] .nav-item[data-active="true"] {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}
.nav-icon {
  width: 16px; height: 16px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.nav-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--ink-3);
  font-family: var(--font-mono);
}

.main {
  flex: 1; overflow-y: auto;
  background: var(--bg);
}

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.card-flat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

/* Buttons */
.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 8px 14px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  transition: all .12s;
  text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--line-2); }
.btn-primary {
  background: var(--accent); color: var(--accent-fg);
  border-color: var(--accent);
}
.btn-primary:hover { filter: brightness(.95); background: var(--accent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 11px 18px; font-size: 14px; }
.btn-danger { color: var(--err); border-color: var(--line); }
.btn-danger:hover { background: color-mix(in srgb, var(--err) 8%, var(--surface)); border-color: var(--err); }

/* Status pill */
.status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 500;
  font-family: var(--font-mono);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
}
.status .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status[data-status="draft"] { color: var(--ink-3); }
.status[data-status="in_progress"] { color: var(--info); border-color: color-mix(in srgb, var(--info) 30%, var(--line)); }
.status[data-status="pending_review"] { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 30%, var(--line)); }
.status[data-status="approved"] { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, var(--line)); }
.status[data-status="rejected"] { color: var(--err); border-color: color-mix(in srgb, var(--err) 30%, var(--line)); }

/* Inputs */
.input, .select, .textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.label {
  display: block;
  font-size: 11px; font-weight: 600;
  color: var(--ink-2);
  letter-spacing: .04em;
  margin-bottom: 5px;
}

/* Phone-specific tweaks */
.phone-content .topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  flex-shrink: 0;
}
.phone-content .topbar .icon-btn {
  appearance: none; border: 0; background: transparent;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-2); border-radius: var(--radius);
}
.phone-content .topbar .title {
  font-size: 15px; font-weight: 600;
  flex: 1;
}
.phone-content .topbar .sub {
  font-size: 11px; color: var(--ink-3); font-family: var(--font-mono);
}
.phone-content .scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}
.phone-content .stickyfoot {
  flex-shrink: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  display: flex; gap: 10px;
}
.phone-content .stickyfoot .btn { flex: 1; }

.fab {
  position: absolute; right: 18px; bottom: 86px;
  width: 56px; height: 56px;
  border-radius: 28px;
  background: var(--accent); color: var(--accent-fg);
  display: flex; align-items: center; justify-content: center;
  border: none;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 50%, transparent);
  font-size: 24px;
  z-index: 10;
}

/* Photo grid */
.photo-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, 1fr);
}
.photo-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.photo-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.photo-with-note { display: flex; flex-direction: column; }
.photo-with-note .photo-tile { aspect-ratio: 1 / 1; }

.photo-tile {
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--line);
  cursor: pointer;
}
.photo-tile .ph-img {
  width: 100%; height: 100%;
  display: block;
  object-fit: cover;
}
.photo-tile .ph-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,.55));
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 6px 8px;
  color: white;
  font-size: 10px;
  pointer-events: none;
}
.photo-tile .ph-num {
  position: absolute; top: 6px; left: 6px;
  background: rgba(0,0,0,.55); color: white;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 6px; border-radius: 999px;
}
.photo-tile .ph-progress {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.5);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: white; font-size: 11px;
  gap: 6px;
}
.progress-bar {
  width: 70%;
  height: 4px; border-radius: 2px;
  background: rgba(255,255,255,.25);
  overflow: hidden;
}
.progress-bar-fill { height: 100%; background: white; }

/* Section card on phone */
.section-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 12px;
}
.section-card .cover {
  height: 110px;
  position: relative;
  background: var(--surface-2);
}
.section-card .cover .satellite {
  width: 100%; height: 100%;
  object-fit: cover;
}
.section-card .meta {
  padding: 12px 14px;
}
.section-card .meta .ti {
  font-size: 14px; font-weight: 600;
  color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.section-card .meta .ti .num {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--surface-2);
  color: var(--ink-2);
  padding: 1px 8px; border-radius: 4px;
}
.section-card .meta .sub {
  font-size: 12px; color: var(--ink-3);
  margin-top: 4px;
  display: flex; gap: 12px;
}

/* Triple-state buttons */
.triple {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.triple button {
  appearance: none;
  padding: 12px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.triple button[data-on="符合"] {
  background: color-mix(in srgb, var(--ok) 12%, var(--surface));
  border-color: var(--ok);
  color: var(--ok);
}
.triple button[data-on="不符合"] {
  background: color-mix(in srgb, var(--err) 12%, var(--surface));
  border-color: var(--err);
  color: var(--err);
}
.triple button[data-on="不適用"] {
  background: color-mix(in srgb, var(--ink-3) 12%, var(--surface));
  border-color: var(--ink-3);
  color: var(--ink-2);
}

/* Progress */
.progress {
  width: 100%; height: 6px;
  background: var(--surface-2);
  border-radius: 3px; overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width .3s;
}
.progress-fill.warn { background: var(--gold); }

/* Misc */
.divider {
  height: 1px; background: var(--line);
  margin: 12px 0;
}
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 12px; }
.kv .k { color: var(--ink-3); }
.kv .v { color: var(--ink); font-weight: 500; }

/* Notion-dense tightens */
[data-style="dense"] .card { padding: 12px; }
[data-style="dense"] .input, [data-style="dense"] .select, [data-style="dense"] .textarea { padding: 6px 10px; font-size: 12.5px; }
[data-style="dense"] .btn { padding: 6px 10px; font-size: 12.5px; }

/* Modern softens */
[data-style="modern"] .btn-primary { box-shadow: 0 1px 2px rgba(47, 122, 77, .25); }
[data-style="modern"] .card { box-shadow: var(--shadow-sm); }

/* Scrollbar tame */
.phone-content .scroll::-webkit-scrollbar,
.main::-webkit-scrollbar,
.sidebar::-webkit-scrollbar { width: 8px; height: 8px; }
.phone-content .scroll::-webkit-scrollbar-thumb,
.main::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb {
  background: var(--line-2); border-radius: 4px;
}

/* PDF preview "paper" */
.paper {
  background: white;
  color: #1a1814;
  box-shadow: 0 4px 24px rgba(0,0,0,.18);
  border: 1px solid #d8d2c2;
  margin: 0 auto;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn .2s ease-out both; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .55; }
}
.pulse { animation: pulse 1.4s ease-in-out infinite; }

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.shimmer {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--line) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
}

/* Utility flex */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; }
.gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.flex-1 { flex: 1; }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.text-md { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.text-3xl { font-size: 32px; }
.text-mono { font-family: var(--font-mono); }
.text-muted { color: var(--ink-3); }
.text-ink-2 { color: var(--ink-2); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-4 { margin-bottom: 4px; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.p-12 { padding: 12px; } .p-16 { padding: 16px; } .p-20 { padding: 20px; } .p-24 { padding: 24px; }
.px-16 { padding-left: 16px; padding-right: 16px; }
.py-12 { padding-top: 12px; padding-bottom: 12px; }
.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: 9999px; }
.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }
.text-accent { color: var(--accent); }
