:root {
  color-scheme: light;
  --brand: #315de8;
  --brand-dark: #2448bd;
  --brand-soft: #eef2ff;
  --ink: #172033;
  --muted: #6b7487;
  --line: #e6e9f0;
  --surface: #ffffff;
  --canvas: #f6f7fb;
  --success: #0d9f79;
  --warning: #c17b0a;
  --danger: #c43f4a;
  --shadow: 0 16px 44px rgba(31, 47, 84, 0.09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .56; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(49, 93, 232, .22); outline-offset: 2px; }

.boot-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand > div:last-child { display: grid; gap: 1px; }
.brand strong { font-size: 17px; letter-spacing: -.02em; }
.brand small { color: var(--muted); font-size: 11px; }
.brand.compact small { display: none; }
.brand-mark { position: relative; width: 36px; height: 36px; border-radius: 11px; background: var(--brand); overflow: hidden; box-shadow: 0 8px 20px rgba(49, 93, 232, .25); }
.brand-mark span { position: absolute; display: block; border-radius: 999px; background: #fff; }
.brand-mark span:nth-child(1) { width: 18px; height: 7px; left: 8px; top: 8px; }
.brand-mark span:nth-child(2) { width: 7px; height: 14px; left: 8px; top: 17px; }
.brand-mark span:nth-child(3) { width: 9px; height: 9px; right: 8px; bottom: 6px; background: #ffca59; }

.primary, .secondary, .text-button, .icon-button, .row-action { border: 0; border-radius: 10px; font-weight: 700; }
.primary { padding: 12px 18px; color: white; background: var(--brand); box-shadow: 0 8px 18px rgba(49, 93, 232, .18); }
.primary:hover { background: var(--brand-dark); }
.secondary { padding: 11px 16px; color: var(--ink); border: 1px solid var(--line); background: white; }
.secondary:hover { border-color: #bcc5db; background: #fafbff; }
.large { min-height: 48px; padding-inline: 22px; }
.text-button { padding: 7px 0; color: var(--brand); background: transparent; }
.icon-button, .row-action { width: 36px; height: 36px; background: transparent; color: var(--muted); }

.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(400px, 1.05fr) minmax(420px, .95fr); }
.auth-story { position: relative; min-height: 100vh; padding: 46px 8vw; overflow: hidden; color: white; background: radial-gradient(circle at 86% 15%, rgba(122, 157, 255, .55), transparent 30%), linear-gradient(145deg, #17348a 0%, #315de8 58%, #5b7ff1 100%); display: flex; flex-direction: column; justify-content: space-between; }
.auth-story::after { content: ""; position: absolute; width: 460px; height: 460px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; right: -170px; bottom: -170px; box-shadow: 0 0 0 80px rgba(255,255,255,.04), 0 0 0 160px rgba(255,255,255,.025); }
.auth-story .brand { position: relative; z-index: 1; }
.auth-story .brand-mark { background: white; }
.auth-story .brand-mark span:nth-child(1), .auth-story .brand-mark span:nth-child(2) { background: var(--brand); }
.auth-story .brand small { color: rgba(255,255,255,.72); }
.story-copy { position: relative; z-index: 1; max-width: 580px; margin-block: auto; }
.eyebrow, .kicker { margin: 0 0 10px; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.story-copy .eyebrow { color: #cbd6ff; }
.story-copy h1 { margin: 0 0 22px; font-size: clamp(42px, 5.3vw, 74px); line-height: 1.05; letter-spacing: -.055em; }
.story-copy p { max-width: 540px; margin: 0; color: rgba(255,255,255,.78); font-size: 18px; line-height: 1.75; }
.story-steps { position: relative; z-index: 1; display: flex; gap: 28px; color: rgba(255,255,255,.74); font-size: 12px; font-weight: 700; }
.auth-panel { display: grid; place-items: center; min-height: 100vh; padding: 44px; background: #fbfbfd; }
.auth-card { width: min(450px, 100%); padding: 42px; border: 1px solid var(--line); border-radius: 24px; background: white; box-shadow: var(--shadow); }
.auth-card h2 { margin: 0 0 28px; font-size: 30px; letter-spacing: -.035em; }
.demo-banner { display: grid; gap: 3px; margin: -18px -18px 30px; padding: 14px 16px; border-radius: 12px; color: #674c05; background: #fff6d8; font-size: 12px; }
.demo-banner strong { font-size: 13px; }
.demo-actions, .form-stack { display: grid; gap: 14px; }
.form-stack label, .project-form label, .dialog-status { display: grid; gap: 8px; color: #353e51; font-size: 13px; font-weight: 700; }
input, textarea, select { width: 100%; border: 1px solid #d9deea; border-radius: 9px; padding: 12px 13px; color: var(--ink); background: white; }
input::placeholder, textarea::placeholder { color: #9ba3b2; }
textarea { resize: vertical; }
.auth-links { display: flex; justify-content: space-between; gap: 16px; }
.trust-note { display: flex; gap: 11px; align-items: flex-start; margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); }
.trust-note span { flex: 0 0 auto; display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; color: var(--success); background: #e7f7f1; font-weight: 900; }
.trust-note p { margin: 1px 0 0; font-size: 11px; line-height: 1.65; }

.portal-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 20px 22px; border-right: 1px solid var(--line); background: white; display: flex; flex-direction: column; }
.sidebar nav { display: grid; gap: 7px; margin-top: 44px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 13px; border: 0; border-radius: 10px; color: #4b5466; background: transparent; text-align: left; }
.nav-item b { display: grid; place-items: center; width: 24px; font-size: 18px; }
.nav-item.active, .nav-item:hover { color: var(--brand); background: var(--brand-soft); }
.sidebar-footer { display: grid; grid-template-columns: 38px minmax(0, 1fr) 36px; gap: 10px; align-items: center; margin-top: auto; padding-top: 20px; border-top: 1px solid var(--line); }
.sidebar-footer > div:nth-child(2) { min-width: 0; display: grid; }
.sidebar-footer strong, .sidebar-footer small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-footer strong { font-size: 13px; }
.sidebar-footer small { color: var(--muted); font-size: 10px; }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: white; background: linear-gradient(135deg, #315de8, #7a95f5); font-weight: 800; }
.portal-main { min-width: 0; }
.preview-bar { min-height: 38px; padding: 6px 30px; color: #563d00; background: #fff4cc; display: flex; justify-content: space-between; align-items: center; gap: 20px; font-size: 11px; font-weight: 700; }
.preview-bar div { display: flex; gap: 4px; }
.preview-bar button { border: 0; border-radius: 6px; padding: 4px 10px; background: transparent; color: inherit; }
.preview-bar button.active { background: white; }
.topbar { display: none; }
.view-container { max-width: 1320px; margin: 0 auto; padding: 54px 5vw 80px; }
.page-head { min-height: 104px; margin-bottom: 32px; display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; }
.page-head h1 { margin: 0 0 8px; font-size: clamp(30px, 4vw, 46px); letter-spacing: -.05em; }
.page-head p:not(.kicker) { margin: 0; color: var(--muted); line-height: 1.6; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 22px; }
.metric-grid article { position: relative; min-height: 124px; padding: 23px; border: 1px solid var(--line); border-radius: 15px; background: white; box-shadow: 0 8px 25px rgba(31,47,84,.035); display: grid; align-content: space-between; }
.metric-grid span { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric-grid strong { font-size: 34px; }
.metric-grid i { position: absolute; top: 23px; right: 22px; font-style: normal; }
.metric-grid .blue { color: var(--brand); }.metric-grid .amber { color: #e5a11e; }.metric-grid .green { color: var(--success); }
.content-card { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: 0 8px 28px rgba(31,47,84,.035); }
.card-head { padding: 24px 26px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.card-head h2 { margin: 0 0 3px; font-size: 18px; }.card-head p { margin: 0; color: var(--muted); font-size: 12px; }
.search-field { width: min(250px, 100%); display: flex; align-items: center; gap: 7px; padding-left: 10px; border: 1px solid var(--line); border-radius: 9px; background: #f8f9fc; }
.search-field input { border: 0; padding: 9px 10px 9px 0; background: transparent; outline: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 15px 18px; border-bottom: 1px solid #eef0f5; text-align: left; vertical-align: middle; font-size: 12px; }
th { color: var(--muted); background: #fbfbfd; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
td strong, td small { display: block; } td strong { color: #252e40; } td small { margin-top: 4px; color: var(--muted); }
.status { display: inline-flex; padding: 5px 9px; border-radius: 99px; color: #986007; background: #fff2cc; font-size: 10px; font-weight: 800; white-space: nowrap; }
.status.working { color: #2852bd; background: #eaf0ff; }.status.approval { color: #7738ad; background: #f5eaff; }.status.delivered { color: #08785a; background: #e2f7ef; }
.row-action { font-size: 21px; }.row-action:hover { color: var(--brand); background: var(--brand-soft); }
.empty-state { min-height: 270px; padding: 48px 24px; text-align: center; display: grid; justify-items: center; align-content: center; }
.empty-state > span { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 12px; border-radius: 50%; color: var(--brand); background: var(--brand-soft); font-size: 23px; }
.empty-state h3 { margin: 0 0 6px; }.empty-state p { max-width: 420px; margin: 0 0 18px; color: var(--muted); }

.project-form { display: grid; gap: 16px; }
.form-card { display: grid; grid-template-columns: 60px 1fr; gap: 20px; padding: 28px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.section-number { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: var(--brand); background: var(--brand-soft); font-weight: 900; }
.section-content h2 { margin: 2px 0 5px; font-size: 19px; }.section-content > p { margin: 0 0 24px; color: var(--muted); font-size: 12px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }.field-grid .full, .upload-zone, .file-list { grid-column: 1 / -1; }
.upload-zone { min-height: 150px; border: 1.5px dashed #bdc7df; border-radius: 12px; background: #fafbff; display: grid !important; place-items: center; align-content: center; gap: 5px !important; text-align: center; cursor: pointer; }
.upload-zone:hover { border-color: var(--brand); background: var(--brand-soft); }.upload-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }.upload-zone > span { color: var(--brand); font-size: 27px; }.upload-zone small { color: var(--muted); font-weight: 500; }
.file-list { display: flex; flex-wrap: wrap; gap: 8px; }.file-list span { padding: 6px 10px; border-radius: 8px; color: var(--success); background: #e5f8f1; font-size: 11px; }.file-list span.invalid { color: var(--danger); background: #ffeaec; }
.form-submit { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px 28px; border-radius: 16px; color: white; background: #172b69; }
.form-submit strong { display: block; margin-bottom: 5px; }.form-submit p { margin: 0; color: #c8d2f4; font-size: 11px; }
.admin-count { padding: 8px 12px; border-radius: 99px; color: #9b6100; background: #fff1c7; font-size: 11px; font-weight: 800; }
.delivery-card { padding: 8px 24px; }.delivery-item { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 20px 4px; border-bottom: 1px solid var(--line); }.delivery-item > div { display: flex; align-items: center; gap: 14px; }.delivery-item h3, .delivery-item p { margin: 0; }.delivery-item p { margin-top: 3px; color: var(--muted); font-size: 11px; }.delivery-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; color: var(--success); background: #e5f8f1; }

.project-dialog { width: min(660px, calc(100% - 32px)); max-height: calc(100vh - 48px); overflow-y: auto; padding: 32px; border: 0; border-radius: 18px; color: var(--ink); box-shadow: 0 30px 80px rgba(16,28,57,.28); }.project-dialog::backdrop { background: rgba(15,23,42,.55); }.project-dialog > form { float: right; }.dialog-close { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f1f3f8; font-size: 21px; }.project-dialog h2 { margin: 0 0 12px; font-size: 28px; }.project-dialog dl { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 24px 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }.project-dialog dl div { padding: 13px 15px; border-bottom: 1px solid var(--line); }.project-dialog dt { color: var(--muted); font-size: 10px; font-weight: 700; }.project-dialog dd { margin: 5px 0 0; line-height: 1.5; font-size: 13px; }.dialog-status { padding-top: 6px; }
.toast-region { position: fixed; z-index: 100; top: 18px; right: 18px; display: grid; gap: 8px; }.toast { max-width: 390px; padding: 13px 16px; border-radius: 10px; color: white; background: #14214a; box-shadow: var(--shadow); font-size: 13px; }.toast.error { background: #a62f3a; }.toast.info { background: #2d57c7; }
.mobile-nav { display: none; }

@media (max-width: 900px) {
  .auth-layout { grid-template-columns: 1fr; }.auth-story { min-height: 42vh; padding: 30px 7vw; }.story-copy { margin-block: 55px; }.story-copy h1 { font-size: 44px; }.story-steps { display: none; }.auth-panel { min-height: 58vh; padding: 28px 18px; }
  .portal-shell { display: block; }.sidebar { display: none; }.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 66px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: white; }.role-pill { padding: 6px 10px; border-radius: 99px; color: var(--brand); background: var(--brand-soft); font-size: 10px; font-weight: 800; }.view-container { padding: 30px 18px 105px; }.mobile-nav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; min-height: 70px; display: flex; justify-content: space-around; padding: 8px max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(14px); }.mobile-nav button { flex: 1; display: grid; justify-items: center; gap: 2px; border: 0; color: #71798b; background: transparent; font-size: 9px; }.mobile-nav b { font-size: 21px; }.mobile-nav button.active { color: var(--brand); }.preview-bar { padding-inline: 18px; }
}

@media (max-width: 650px) {
  .auth-story { min-height: 36vh; }.story-copy { margin: 45px 0 20px; }.story-copy h1 { font-size: 36px; }.story-copy p { font-size: 14px; }.auth-card { padding: 28px 22px; border-radius: 18px; }.page-head { align-items: flex-start; flex-direction: column; gap: 18px; }.page-head .primary { width: 100%; }.metric-grid { grid-template-columns: 1fr; }.metric-grid article { min-height: 90px; }.card-head { align-items: stretch; flex-direction: column; }.search-field { width: 100%; }.form-card { grid-template-columns: 1fr; padding: 22px 18px; }.field-grid { grid-template-columns: 1fr; }.field-grid .full { grid-column: auto; }.form-submit { align-items: stretch; flex-direction: column; }.form-submit .primary { width: 100%; }.project-dialog dl { grid-template-columns: 1fr; }.delivery-item { align-items: stretch; flex-direction: column; }.preview-bar { align-items: flex-start; flex-direction: column; gap: 4px; }
}

@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast-in .2s ease-out; } @keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
}
