:root {
  --bg: #070b18;
  --bg-2: #0d1328;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #e8ecf8;
  --muted: #8f9bbd;
  --gold: #f4c36a;
  --gold-2: #e8a33d;
  --teal: #4fd1c5;
  --violet: #8b7cf6;
  --danger: #ff6b81;
  --ok: #3ddc97;
  --radius: 18px;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.7);
  --font: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  --font-en: "Outfit", var(--font);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #18214a 0%, transparent 60%),
              radial-gradient(900px 500px at 110% 10%, #2a1c45 0%, transparent 55%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { font-family: inherit; }

/* ---------- background orbs ---------- */
.bg-orbs { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .35; animation: float 18s ease-in-out infinite; }
.orb-1 { width: 420px; height: 420px; background: var(--violet); top: -120px; left: -80px; }
.orb-2 { width: 360px; height: 360px; background: var(--teal); bottom: -120px; right: -60px; animation-delay: -6s; opacity: .22; }
.orb-3 { width: 280px; height: 280px; background: var(--gold-2); top: 40%; left: 55%; animation-delay: -12s; opacity: .14; }
@keyframes float { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(40px,-30px) scale(1.08); } }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(7, 11, 24, 0.65);
  backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #1a1205;
  box-shadow: 0 6px 20px -6px rgba(244, 195, 106, .6);
}
.brand-logo svg { width: 22px; height: 22px; }
.brand-title { font-weight: 900; letter-spacing: .5px; }
.brand-sub { font-family: var(--font-en); font-size: 11px; color: var(--muted); letter-spacing: 1.5px; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.admin-badge { font-size: 13px; color: var(--ok); padding: 6px 12px; border-radius: 999px; background: rgba(61, 220, 151, .1); border: 1px solid rgba(61, 220, 151, .3); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 12px; border: 1px solid transparent;
  font-size: 14px; font-weight: 700; cursor: pointer; color: var(--text);
  transition: transform .18s ease, box-shadow .2s ease, background .2s ease, border-color .2s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #1a1205; box-shadow: 0 8px 24px -10px rgba(244, 195, 106, .8); }
.btn-primary:hover { box-shadow: 0 12px 30px -10px rgba(244, 195, 106, 1); }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: rgba(255, 107, 129, .12); border-color: rgba(255, 107, 129, .4); color: var(--danger); }
.btn-danger:hover { background: rgba(255, 107, 129, .22); }
.btn-block { width: 100%; padding: 12px; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }

/* ---------- layout ---------- */
.container { position: relative; z-index: 1; max-width: 1240px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px) 60px; }

.hero { text-align: center; padding: 56px 0 30px; animation: rise .7s ease both; }
.eyebrow { font-family: var(--font-en); letter-spacing: 4px; font-size: 12px; color: var(--gold); margin: 0 0 10px; }
.hero h1 { font-size: clamp(32px, 5vw, 54px); font-weight: 900; margin: 0; letter-spacing: 1px; line-height: 1.2; }
.grad { background: linear-gradient(120deg, var(--gold) 0%, #ffe3a8 40%, var(--teal) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-desc { color: var(--muted); margin: 14px auto 0; max-width: 560px; }

.stats { display: flex; justify-content: center; gap: 16px; margin-top: 30px; flex-wrap: wrap; }
.stat {
  min-width: 150px; padding: 16px 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); backdrop-filter: blur(10px);
}
.stat-num { font-family: var(--font-en); font-size: 32px; font-weight: 800; background: linear-gradient(135deg, #fff, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-label { font-size: 13px; color: var(--muted); }

.glass { background: var(--surface); border: 1px solid var(--border); backdrop-filter: blur(14px); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- search ---------- */
.search-panel {
  display: grid; grid-template-columns: 1fr 180px 180px; gap: 14px 16px; padding: 20px;
  animation: rise .7s .1s ease both;
}
.quick { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 6px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
  background: transparent; border: 1px solid var(--border-strong); color: var(--muted); transition: all .2s;
}
.chip:hover, .chip.active { color: #1a1205; background: var(--gold); border-color: var(--gold); }
.chip-clear:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 500; }
.field.two { flex-direction: row; gap: 12px; }
.field.two > div { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.hint { color: #6c789b; font-size: 12px; font-weight: 400; }
.req { color: var(--danger); }

input, textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--text);
  background: rgba(0, 0, 0, .25); border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 11px 14px; outline: none; transition: border-color .2s, box-shadow .2s, background .2s;
}
input:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(244, 195, 106, .18); background: rgba(0, 0, 0, .35); }
input::placeholder, textarea::placeholder { color: #5d6788; }
input[type="date"], input[type="time"] { color-scheme: dark; }
textarea { resize: vertical; min-height: 90px; line-height: 1.7; }
.input-icon { position: relative; }
.input-icon svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.input-icon input { padding-left: 40px; }

.result-bar { margin: 26px 4px 14px; color: var(--muted); font-size: 14px; }

/* ---------- board ---------- */
.board { display: flex; flex-direction: column; gap: 34px; }
.month-group { animation: rise .5s ease both; }
.month-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.month-head h2 { margin: 0; font-family: var(--font-en); font-size: 18px; font-weight: 700; color: var(--gold); letter-spacing: 1px; }
.month-head .line { flex: 1; height: 1px; background: linear-gradient(90deg, var(--border-strong), transparent); }
.month-head .cnt { font-size: 12px; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 12px;
  padding: 20px 20px 18px; border-radius: var(--radius); cursor: pointer;
  background: linear-gradient(160deg, rgba(255,255,255,.07), rgba(255,255,255,.02));
  border: 1px solid var(--border); overflow: hidden;
  transition: transform .25s ease, border-color .25s, box-shadow .25s;
  animation: rise .5s ease both;
}
.card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--gold), var(--teal)); opacity: .8;
}
.card:hover { transform: translateY(-4px); border-color: rgba(244, 195, 106, .45); box-shadow: 0 24px 40px -22px rgba(244, 195, 106, .45); }
.card:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.card-top { display: flex; gap: 14px; align-items: flex-start; }
.date-badge {
  flex: none; width: 58px; text-align: center; border-radius: 14px; padding: 6px 0;
  background: rgba(244, 195, 106, .1); border: 1px solid rgba(244, 195, 106, .3);
}
.date-badge .d { font-family: var(--font-en); font-size: 24px; font-weight: 800; line-height: 1.1; color: var(--gold); }
.date-badge .w { font-size: 11px; color: var(--muted); }
.card h3 { margin: 0; font-size: 17px; line-height: 1.45; font-weight: 700; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); margin-top: 4px; }
.meta span { display: inline-flex; align-items: center; gap: 5px; }
.card-summary { color: #c3cbe2; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0; white-space: pre-line; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 4px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 12px; padding: 2px 10px; border-radius: 999px; background: rgba(79, 209, 197, .12); color: var(--teal); border: 1px solid rgba(79, 209, 197, .25); }
.att-count { font-size: 12px; color: var(--muted); white-space: nowrap; }
.new-dot { position: absolute; top: 14px; right: 14px; font-size: 11px; font-weight: 700; color: #1a1205; background: var(--gold); padding: 1px 8px; border-radius: 999px; }

.empty { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty-icon { font-size: 48px; }
.empty h2 { color: var(--text); font-size: 20px; margin: 10px 0 6px; }

.skeleton { height: 210px; border-radius: var(--radius); background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3, 5, 12, .7); backdrop-filter: blur(6px); animation: fade .2s ease; }
.modal-card {
  position: relative; width: 100%; max-height: calc(100vh - 40px); overflow-y: auto;
  background: linear-gradient(180deg, #121a35, #0c1226); border: 1px solid var(--border-strong);
  border-radius: 22px; padding: 30px; box-shadow: 0 40px 80px -30px #000; animation: pop .28s cubic-bezier(.2,.9,.3,1.2);
}
.modal-sm { max-width: 400px; display: flex; flex-direction: column; gap: 14px; }
.modal-lg { max-width: 820px; }
.modal-x { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; font-size: 14px; transition: all .2s; z-index: 2; }
.modal-x:hover { color: var(--text); background: var(--surface-2); transform: rotate(90deg); }
.modal-title { margin: 0 0 18px; font-size: 22px; }
.center { text-align: center; }
.muted { color: var(--muted); margin: -8px 0 4px; font-size: 14px; }
.login-icon { font-size: 40px; text-align: center; }
.form-error { color: var(--danger); font-size: 14px; min-height: 1em; margin: 6px 0 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.span-2 { grid-column: span 2; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  padding: 22px; border: 1.5px dashed var(--border-strong); border-radius: 14px; cursor: pointer;
  color: var(--text); font-size: 14px; transition: all .2s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--gold); background: rgba(244, 195, 106, .06); }
.dz-icon { font-size: 26px; }
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-list:not(:empty) { margin: 4px 0 8px; }
.file-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  background: rgba(0, 0, 0, .22); border: 1px solid var(--border); font-size: 14px;
}
.file-item .ficon { flex: none; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 11px; font-weight: 800; font-family: var(--font-en); color: #fff; }
.file-item .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .fsize { color: var(--muted); font-size: 12px; white-space: nowrap; }
.file-item .pending { color: var(--gold); font-size: 12px; }
a.file-item { color: var(--text); text-decoration: none; transition: border-color .2s, background .2s; }
a.file-item:hover { border-color: var(--gold); background: rgba(244, 195, 106, .06); }
.icon-btn { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; padding: 4px 6px; border-radius: 8px; }
.icon-btn:hover { color: var(--danger); background: rgba(255, 107, 129, .1); }

/* ---------- detail ---------- */
.detail-head { padding-right: 40px; }
.detail-date { font-family: var(--font-en); color: var(--gold); font-weight: 700; letter-spacing: 1px; font-size: 14px; }
.detail-head h2 { margin: 6px 0 12px; font-size: 26px; line-height: 1.35; }
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 20px 0; }
.info { padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.info .k { font-size: 12px; color: var(--muted); }
.info .v { font-size: 15px; font-weight: 500; }
.section { margin-top: 22px; }
.section h3 { font-size: 15px; color: var(--gold); margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.section h3::before { content: ""; width: 4px; height: 16px; border-radius: 4px; background: linear-gradient(var(--gold), var(--teal)); }
.prose { white-space: pre-wrap; word-break: break-word; color: #d4daec; background: rgba(0,0,0,.18); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; margin: 0; }
.people { display: flex; flex-wrap: wrap; gap: 8px; }
.person { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 14px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #1a1205; }
.todo { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.todo li { display: flex; gap: 10px; padding: 10px 14px; border-radius: 12px; background: rgba(79, 209, 197, .06); border: 1px solid rgba(79, 209, 197, .18); }
.todo li::before { content: "✓"; color: var(--teal); font-weight: 900; }
.detail-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.detail-actions .stamp { font-size: 12px; color: var(--muted); }
.detail-actions .btns { display: flex; gap: 8px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); z-index: 100;
  padding: 12px 22px; border-radius: 12px; font-size: 14px; font-weight: 500;
  background: #1b2547; border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  animation: toastIn .3s ease;
}
.toast.ok { border-color: rgba(61, 220, 151, .5); }
.toast.err { border-color: rgba(255, 107, 129, .6); color: #ffc2cc; }

.footer { position: relative; z-index: 1; text-align: center; color: #5d6788; font-size: 13px; padding: 24px; border-top: 1px solid var(--border); }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(10px); } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .search-panel { grid-template-columns: 1fr 1fr; }
  .search-panel .grow { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .brand-sub { display: none; }
  .btn-new-text { display: none; }
  .modal-card { padding: 22px; }
  .cards { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  #btn-login span { display: none; }
  .admin-badge { display: none; }
}

@media print {
  .topbar, .search-panel, .bg-orbs, .footer, .modal-x, .detail-actions .btns { display: none !important; }
  body { background: #fff; color: #000; }
}
