:root {
  --bg: #f0f4f8;
  --card: #fff;
  --primary: #1e4d7b;
  --primary-dark: #163a5c;
  --accent: #e67e22;
  --text: #1a1a1a;
  --muted: #5c6b7a;
  --border: #d8e0e8;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(30, 77, 123, 0.08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft JhengHei", sans-serif;
  background: linear-gradient(160deg, #e8eef5 0%, #f7f9fc 45%, #eef2f6 100%);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}
.topbar {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow);
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}
.brand {
  color: #fff;
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
}
.tagline {
  color: rgba(255,255,255,0.82);
  font-size: 0.9rem;
}
.nav {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
}
.nav a {
  color: #fff;
  text-decoration: none;
  font-size: 0.92rem;
}
.nav a:hover { text-decoration: underline; }
.nav .user {
  color: rgba(255,255,255,0.75);
  font-size: 0.85rem;
}
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 1.5rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.5rem;
}
.card h1, .card h2 { margin-top: 0; color: var(--primary); }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.tool-card {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(30, 77, 123, 0.14);
}
.tool-card .icon { font-size: 2rem; margin-bottom: 0.35rem; }
.tool-card h3 { margin: 0 0 0.35rem; color: var(--primary); }
.tool-card p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.badge-soon {
  display: inline-block;
  background: #fff3e0;
  color: #b45309;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-left: 0.35rem;
}
.login-wrap {
  min-height: calc(100vh - 4rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.login-card { width: 100%; max-width: 400px; }
.login-card h1 { font-size: 1.35rem; }
label { display: block; font-weight: 600; margin: 0.75rem 0 0.35rem; }
input[type=text], input[type=password], textarea, input[type=file] {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
}
textarea { resize: vertical; min-height: 5rem; }
.btn {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.65rem 1.25rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--primary-dark); }
.btn-secondary { background: #fff; color: var(--primary); border: 1px solid var(--border); }
.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}
.alert-error { background: #fdecea; color: #b42318; border: 1px solid #f5c2c0; }
.alert-info { background: #e8f1fb; color: #1e4d7b; border: 1px solid #c5d9f0; }
.muted { color: var(--muted); font-size: 0.9rem; }
ul.steps { padding-left: 1.2rem; }
ul.steps li { margin: 0.35rem 0; }
.status-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; }
.status-pill {
  display: inline-block;
  background: #eef2f6;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}
.status-pill.ok { background: #e8f5e9; color: #2e7d32; }
.status-pill.warn { background: #fff3e0; color: #b45309; }
.status-pill.error { background: #fdecea; color: #b42318; }
.job-list { display: grid; gap: 0.65rem; margin: 0.75rem 0 1rem; }
.job-item {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbfd;
  cursor: pointer;
}
.job-item input { margin-top: 0.2rem; }
.job-path {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.78rem;
  color: var(--muted);
  word-break: break-all;
}
.help-box { margin: 0.75rem 0 1rem; font-size: 0.9rem; color: var(--muted); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 1rem; }
.inline-form { display: inline; }
.section-divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.checkbox-inline { display: flex; align-items: center; gap: 0.4rem; font-weight: normal; }
a.btn.disabled, .btn.disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}
.totp-live-box {
  text-align: center;
  padding: 1.25rem;
  margin: 1rem 0 1.25rem;
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #f5f9fd 0%, #fff 100%);
}
.totp-live-label { color: var(--muted); font-size: 0.9rem; margin-bottom: 0.35rem; }
.totp-live-code {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  color: var(--primary);
  font-family: "Consolas", "Courier New", monospace;
}
.totp-live-meta { color: var(--muted); font-size: 0.85rem; margin-top: 0.35rem; }
.login-panel {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 0.5rem;
}
.saved-field { font-size: 1.1rem; font-weight: 600; margin: 0.25rem 0 0.75rem; }
.ok-tag {
  font-size: 0.8rem;
  font-weight: 600;
  color: #0d7a4e;
  background: #e8f8f0;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  margin-left: 0.35rem;
}
.otp-input {
  font-size: 1.5rem;
  letter-spacing: 0.25em;
  text-align: center;
  max-width: 12rem;
  font-family: "Consolas", "Courier New", monospace;
}
.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font: inherit;
}
.totp-live-box.compact {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  margin: 0.5rem 0 1rem;
  text-align: left;
}
.totp-inline {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--primary);
  font-family: "Consolas", "Courier New", monospace;
}
.simple-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 0.5rem 0 1rem;
}
.simple-table th,
.simple-table td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.6rem;
  text-align: left;
  vertical-align: top;
}
.simple-table th {
  background: #f5f8fb;
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.station-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.station-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  background: #fafcfd;
}
.station-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}
.route-tags,
.mini-jobs {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.88rem;
}
.route-tags li,
.mini-jobs li {
  margin: 0.2rem 0;
}
.report-panel {
  margin: 1.25rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f8fbfe;
}
.report-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
}
.report-form label {
  display: block;
  margin-bottom: 0.25rem;
}
.report-wrap {
  overflow-x: auto;
  margin-top: 1rem;
}
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  min-width: 960px;
}
.report-table th,
.report-table td {
  border: 1px solid #c5d0dc;
  padding: 0.4rem 0.55rem;
  vertical-align: top;
}
.report-table th {
  background: #e8eef5;
  white-space: nowrap;
}
.report-table td.num {
  text-align: right;
  white-space: nowrap;
}
.report-table td.notes {
  min-width: 220px;
  font-size: 0.82rem;
}
.notes-input {
  width: 100%;
  min-width: 200px;
  min-height: 2.5rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1.4;
  resize: vertical;
}
.report-editor-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
.report-table td.report-date {
  text-align: center;
  font-weight: 700;
  background: #f5f8fb;
}
.report-table tr.report-total td {
  background: #ffe8c8;
  font-weight: 700;
}
.report-table tr.report-total td:first-child {
  text-align: center;
}
.work-card h1 { margin-top: 0; }
.work-log {
  list-style: none;
  margin: 1rem 0 1.25rem;
  padding: 0;
}
.work-step {
  padding: 0.55rem 0.85rem;
  margin: 0.35rem 0;
  border-left: 3px solid var(--border);
  background: #f8fafc;
  border-radius: 0 8px 8px 0;
  color: var(--muted);
}
.work-step.is-active {
  border-left-color: var(--primary);
  color: var(--text);
  background: #eef4fa;
  font-weight: 600;
}
.work-step.is-done {
  border-left-color: #6abf69;
  color: var(--muted);
}
.work-step.is-done::after {
  content: ' ✓';
  color: #3d8b40;
}
.btn-hero {
  font-size: 1.1rem;
  padding: 0.85rem 1.5rem;
}
.report-panel-hero {
  background: linear-gradient(135deg, #f0f7ff 0%, #fff 100%);
  border-color: #c5d9ee;
}

.shipments-filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.shipments-filters-grid label {
  display: block;
  font-size: 0.9rem;
}
.shipments-filters-grid input,
.shipments-filters-grid select {
  width: 100%;
  margin-top: 0.25rem;
}
.shipments-scroll {
  max-height: 70vh;
}
.shipments-list-table {
  min-width: 2800px;
}
.shipments-list-table td.addr {
  min-width: 220px;
  max-width: 320px;
}

/* ── Portal shell (sidebar layout) ── */
.portal-body {
  min-height: 100vh;
  background: #eef2f7;
}
.portal-body-plain {
  background: linear-gradient(160deg, #e8eef5 0%, #f7f9fc 45%, #eef2f6 100%);
}
.portal-topbar {
  background: linear-gradient(90deg, #163a5c 0%, #1e4d7b 55%, #245a8a 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(22, 58, 92, 0.18);
  position: sticky;
  top: 0;
  z-index: 20;
}
.portal-topbar-inner {
  max-width: none;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.portal-topbar-start {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}
.portal-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  cursor: pointer;
}
.portal-menu-icon,
.portal-menu-icon::before,
.portal-menu-icon::after {
  display: block;
  width: 1.1rem;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}
.portal-menu-icon {
  position: relative;
}
.portal-menu-icon::before,
.portal-menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
}
.portal-menu-icon::before { top: -6px; }
.portal-menu-icon::after { top: 6px; }
.portal-page-title {
  display: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: rgba(255,255,255,0.88);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42vw;
}
.portal-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
  text-decoration: none;
}
.portal-brand-mark {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 10px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}
.portal-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.portal-brand-text strong {
  font-size: 1.02rem;
}
.portal-brand-text small {
  color: rgba(255,255,255,0.78);
  font-size: 0.78rem;
  font-weight: 400;
}
.portal-user-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.16);
}
.portal-user-name { font-size: 0.88rem; font-weight: 600; }
.portal-user-role { font-size: 0.72rem; color: rgba(255,255,255,0.72); }

.portal-frame {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: calc(100vh - 58px);
}
.portal-sidebar {
  background: #12283d;
  color: #dbe7f2;
  border-right: 1px solid rgba(255,255,255,0.06);
  display: flex;
  flex-direction: column;
  padding: 1rem 0.75rem;
}
.portal-nav { flex: 1; }
.portal-nav-section + .portal-nav-section {
  margin-top: 1.1rem;
}
.portal-nav-heading {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(219, 231, 242, 0.48);
  padding: 0 0.65rem 0.45rem;
}
.portal-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.portal-nav-link {
  display: flex;
  align-items: center;
  padding: 0.62rem 0.75rem;
  margin: 0.1rem 0;
  border-radius: 8px;
  color: #dbe7f2;
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}
.portal-nav-link:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}
.portal-nav-link.is-active {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-left-color: #e67e22;
  font-weight: 600;
}
.portal-nav-link-muted { color: rgba(219, 231, 242, 0.72); }
.portal-sidebar-foot {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.portal-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.portal-content {
  flex: 1;
  padding: 1.5rem 1.75rem 2rem;
  max-width: 1080px;
  width: 100%;
}
.portal-content-wide {
  max-width: 1180px;
}
.portal-content-home {
  max-width: none;
  width: 100%;
}
.portal-drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
}
.portal-drawer-backdrop {
  position: absolute;
  inset: 0;
  border: none;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.portal-drawer-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 88vw);
  background: #12283d;
  color: #dbe7f2;
  transform: translateX(-104%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 8px 0 28px rgba(0,0,0,0.22);
}
.portal-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.portal-drawer-close {
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.portal-drawer-foot {
  margin-top: auto;
  padding: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.portal-nav-drawer {
  overflow: auto;
  padding: 0.75rem;
}
body.portal-drawer-open .portal-drawer-backdrop { opacity: 1; }
body.portal-drawer-open .portal-drawer-panel { transform: translateX(0); }
.portal-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0.85rem 1rem 1.25rem;
  background: #e8edf3;
  border-top: 1px solid #dde5ee;
}

/* Home dashboard */
.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 1.25rem 1.5rem;
  align-items: start;
}
.home-main {
  min-width: 0;
}
.home-aside {
  display: grid;
  gap: 1rem;
  position: sticky;
  top: 4.5rem;
}
.home-aside-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
}
.home-aside-title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  color: var(--primary);
}
.home-status-list {
  list-style: none;
  margin: 0 0 0.85rem;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}
.home-status-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.88rem;
}
.home-status-list span { color: var(--muted); }
.home-status-list strong.ok { color: #2e7d32; }
.home-status-list strong.warn { color: #b45309; }
.btn-block {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 0;
}
.home-aside-links {
  display: grid;
  gap: 0.45rem;
}
.home-aside-links a {
  display: block;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: #f6f9fc;
  border: 1px solid var(--border);
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}
.home-aside-links a:hover {
  background: #eef4fa;
  border-color: #c5d9ee;
}
.home-aside-note p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.5;
}
.home-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  margin-bottom: 0.85rem;
}
.home-section-sub {
  margin: 0;
  font-size: 0.84rem;
}
.home-quick-card.is-primary {
  border-color: #b8cfe8;
  background: linear-gradient(160deg, #f8fbff 0%, #fff 55%);
  box-shadow: 0 10px 26px rgba(30, 77, 123, 0.1);
}
.home-welcome {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.home-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  text-transform: uppercase;
}
.home-welcome h1 {
  margin: 0 0 0.5rem;
  font-size: 1.55rem;
  color: var(--primary);
  font-weight: 700;
}
.home-lead {
  margin: 0;
  color: var(--muted);
  max-width: 36rem;
  font-size: 0.95rem;
}
.home-welcome-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}
.home-meta-item {
  min-width: 7.5rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: #f4f7fa;
  border: 1px solid var(--border);
}
.home-meta-item span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}
.home-meta-item strong {
  font-size: 0.92rem;
  color: var(--primary);
}
.home-meta-item strong.ok { color: #2e7d32; }
.home-meta-item strong.warn { color: #b45309; }
.home-section { margin-bottom: 1.5rem; }
.home-section-compact { margin-bottom: 0.5rem; }
.home-section-title {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.02em;
}
.home-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}
.home-quick-card {
  display: flex;
  flex-direction: column;
  min-height: 8.5rem;
  padding: 1.1rem 1.15rem;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 2px 10px rgba(30, 77, 123, 0.05);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.home-quick-card:hover {
  border-color: #b8cfe8;
  box-shadow: 0 8px 22px rgba(30, 77, 123, 0.1);
  transform: translateY(-1px);
}
.home-quick-tag {
  align-self: flex-start;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  background: #fff6ed;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  margin-bottom: 0.55rem;
}
.home-quick-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.02rem;
  color: var(--primary);
}
.home-quick-card p {
  margin: 0;
  flex: 1;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.45;
}
.home-quick-go {
  margin-top: 0.85rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary);
}
.home-inline-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}
.home-inline-links a {
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}
.home-inline-links a:hover { text-decoration: underline; }
.home-footnote { margin: 0.25rem 0; font-size: 0.88rem; }
.home-footnote a { color: var(--primary); font-weight: 600; }

.vehicle-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}
.vehicle-status-item {
  padding: 0.75rem 0.9rem;
  background: #f4f7fa;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.vehicle-status-item span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.vehicle-status-item strong { font-size: 0.95rem; color: var(--primary); }

/* Legacy dashboard (other pages) */
.dash-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(220px, 0.8fr);
  gap: 1.25rem;
  padding: 1.5rem 1.65rem;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, #ffffff 0%, #f7fbff 100%);
  border-color: #d3e0ec;
}
.dash-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.dash-hero h1 {
  margin: 0 0 0.65rem;
  font-size: 1.65rem;
  color: var(--primary);
}
.dash-lead {
  margin: 0;
  color: var(--muted);
  max-width: 42rem;
}
.dash-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.15rem;
}
.dash-hero-actions .btn { margin-top: 0; }
.dash-hero-aside {
  display: grid;
  gap: 0.65rem;
  align-content: start;
}
.dash-stat {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  background: #f3f7fb;
  border: 1px solid var(--border);
}
.dash-stat-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}
.dash-stat strong {
  font-size: 1rem;
  color: var(--primary);
}
.dash-section { margin-bottom: 1.35rem; }
.dash-section-head {
  margin-bottom: 0.85rem;
}
.dash-section-head h2 {
  margin: 0 0 0.2rem;
  font-size: 1.1rem;
  color: var(--primary);
}
.dash-module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
}
.dash-module-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.dash-module-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(30, 77, 123, 0.12);
  border-color: #c5d9ee;
}
.dash-module-card h3 {
  margin: 0 0 0.45rem;
  font-size: 1rem;
  color: var(--primary);
}
.dash-module-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  min-height: 2.6em;
}
.dash-module-cta {
  display: inline-block;
  margin-top: 0.85rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--accent);
}
.dash-module-card-soon {
  opacity: 0.78;
  cursor: default;
  pointer-events: none;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1.5rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}
.login-shell-card {
  width: 100%;
  max-width: 420px;
  border-top: 4px solid var(--accent);
}
.login-shell-card input[type=text],
.login-shell-card input[type=password] {
  min-height: 2.75rem;
}
.login-shell-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}
.login-shell-brand .portal-brand-mark {
  background: var(--primary);
  color: #fff;
  border: none;
}

@media (max-width: 900px) {
  .portal-frame {
    grid-template-columns: 1fr;
  }
  .portal-sidebar-desktop {
    display: none;
  }
  .portal-menu-btn {
    display: inline-flex;
  }
  .portal-page-title {
    display: inline-block;
  }
  .portal-user-role {
    display: none;
  }
  .dash-hero {
    grid-template-columns: 1fr;
  }
  .home-layout {
    grid-template-columns: 1fr;
  }
  .home-aside {
    position: static;
  }
}

@media (max-width: 640px) {
  .portal-content { padding: 1rem 0.85rem 1.5rem; }
  .portal-topbar-inner { padding: 0.65rem 0.85rem; }
  .portal-brand-text small { display: none; }
  .portal-user-chip {
    padding: 0.25rem 0.55rem;
    max-width: 38vw;
  }
  .portal-user-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .card { padding: 1rem 1.05rem; }
  .btn, .btn-lookup {
    min-height: 2.75rem;
    font-size: 1rem;
  }
}

/* --- 金鑰設定（憑證庫） --- */
.vault-page h1 { margin-bottom: 0.35rem; }
.vault-eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.vault-head { margin-bottom: 1.25rem; }
.vault-status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  margin-bottom: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid #c5d9f0;
  background: linear-gradient(135deg, #f0f6fc 0%, #fafcfe 55%, #eef4fa 100%);
}
.vault-status-main {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.vault-shield {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  background: var(--primary);
  font-size: 1.35rem;
  box-shadow: 0 6px 16px rgba(30, 77, 123, 0.22);
}
.vault-status-sub { margin: 0.15rem 0 0; font-size: 0.82rem; }
.vault-status-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.vault-meta-item {
  font-size: 0.78rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.75);
  border: 1px solid var(--border);
  color: var(--muted);
}
.vault-meta-secure {
  color: #0d7a4e;
  border-color: #b8e6cf;
  background: #edf9f2;
  font-weight: 600;
}
.vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.vault-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.1rem;
  background: linear-gradient(180deg, #fbfcfe 0%, #fff 100%);
  box-shadow: 0 4px 14px rgba(30, 77, 123, 0.05);
  transition: box-shadow 0.2s, border-color 0.2s;
}
.vault-card--ready {
  border-color: #b8dfc8;
  box-shadow: 0 8px 20px rgba(46, 125, 50, 0.08);
}
.vault-card--warn {
  border-color: #f0d4a8;
  background: linear-gradient(180deg, #fffaf3 0%, #fff 100%);
}
.vault-card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}
.vault-card-icon {
  font-size: 1.35rem;
  line-height: 1;
  margin-top: 0.1rem;
}
.vault-card-title {
  margin: 0;
  font-size: 1rem;
  color: var(--primary);
}
.vault-card-desc {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}
.vault-badge {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #eef2f6;
  color: var(--muted);
}
.vault-badge--ok {
  background: #e8f5e9;
  color: #2e7d32;
}
.vault-badge--pending {
  background: #fff3e0;
  color: #b45309;
}
.vault-badge--warn {
  background: #fdecea;
  color: #b42318;
}
.vault-fields {
  margin: 0;
  display: grid;
  gap: 0.55rem;
}
.vault-field {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: #f6f9fc;
  border: 1px solid #e8eef4;
}
.vault-field dt {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.vault-field dd {
  margin: 0;
  font-size: 0.92rem;
  word-break: break-all;
}
.vault-mono {
  font-family: "Consolas", "Courier New", monospace;
  font-weight: 600;
  color: var(--primary);
}
.vault-mono-sm { font-size: 0.84rem; }
.vault-secret {
  font-family: "Consolas", "Courier New", monospace;
  letter-spacing: 0.12em;
  color: #4a5568;
}
.vault-fingerprint {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.8rem;
  color: #6b7c8f;
  letter-spacing: 0.08em;
}
.vault-totp-live {
  margin-top: 0.85rem;
  border-color: #c5d9f0;
}
.vault-totp-code {
  font-size: 1.75rem !important;
  letter-spacing: 0.28em !important;
}
.vault-panel {
  margin-top: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 1rem 1rem;
  background: #fafbfd;
}
.vault-panel-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  padding: 0.85rem 0;
  cursor: pointer;
  font-weight: 700;
  color: var(--primary);
  list-style: none;
}
.vault-panel-summary::-webkit-details-marker { display: none; }
.vault-form { margin-top: 0.5rem; }

/* Account management */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.data-table th,
.data-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.data-table th {
  background: #f4f7fa;
  font-weight: 700;
  color: var(--primary);
}
.account-table-wrap { overflow-x: auto; margin: 1rem 0; }
.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-start;
}
.account-inline-form summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.88rem;
}
.compact-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}
.compact-form input[type="password"] { max-width: 10rem; }
.inline-delete-form { display: inline; }
.account-add-panel {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.account-add-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem 1rem;
  max-width: 720px;
}
.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}
.btn-danger {
  background: #c0392b;
  color: #fff;
  border: none;
}
.btn-danger:hover { background: #a93226; }

/* Personal keys live panel */
.keys-live-panel {
  margin: 1rem 0 1.5rem;
  padding: 1.1rem 1.15rem;
  background: linear-gradient(135deg, #f8fbff 0%, #eef4fa 100%);
  border: 1px solid #c5d9f0;
  border-radius: var(--radius);
}
.keys-live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.keys-live-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  min-height: 10rem;
}
.keys-live-label {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.03em;
}
.keys-jump-hint {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.76rem;
}
.keys-live-code {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  font-family: "Consolas", "Courier New", monospace;
  color: var(--primary);
}
.keys-live-meta {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.keys-live-sub {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
}
.jump-flip-stage {
  position: relative;
  min-height: 4.5rem;
  perspective: 800px;
}
.jump-flip-card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  transform: rotateX(90deg);
  transition: opacity 0.35s, transform 0.45s;
  pointer-events: none;
}
.jump-flip-card.is-active {
  opacity: 1;
  transform: rotateX(0deg);
  pointer-events: auto;
}
.jump-flip-card.is-flipping {
  animation: jumpFlipPulse 0.45s ease;
}
@keyframes jumpFlipPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}
.jump-flip-tag {
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 0.2rem;
}
.jump-flip-code {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  font-family: "Consolas", "Courier New", monospace;
  color: var(--primary);
}
.jump-dual-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.jump-dual-chip {
  flex: 1;
  min-width: 7rem;
  padding: 0.45rem 0.6rem;
  background: #f4f7fa;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.78rem;
}
.jump-dual-chip span {
  display: block;
  color: var(--muted);
  margin-bottom: 0.15rem;
}
.jump-dual-chip strong {
  font-family: "Consolas", "Courier New", monospace;
  letter-spacing: 0.12em;
  color: var(--primary);
}

/* Shipment lookup */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.lookup-page {
  display: grid;
  gap: 1rem;
}
.lookup-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 1.25rem 1.5rem;
  align-items: end;
  background: linear-gradient(135deg, #ffffff 0%, #f5f9fd 100%);
}
.lookup-eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.lookup-hero h1 {
  margin: 0 0 0.35rem;
  font-size: 1.55rem;
  color: var(--primary);
}
.lookup-hero-copy .muted { margin: 0; }
.lookup-form { margin: 0; }
.lookup-search-row {
  display: flex;
  gap: 0.65rem;
  align-items: stretch;
}
.lookup-search-row input[type="text"] {
  flex: 1;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  min-height: 2.75rem;
}
.btn-lookup {
  margin-top: 0;
  min-width: 5.5rem;
  font-weight: 700;
}
.lookup-result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.lookup-result-label {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.lookup-result-no {
  margin: 0.15rem 0 0;
  font-size: 1.45rem;
  color: var(--primary);
  letter-spacing: 0.03em;
}
.lookup-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  background: #eef2f6;
  color: #475569;
}
.lookup-badge.is-done { background: #e8f5e9; color: #2e7d32; }
.lookup-badge.is-transit { background: #fff8e1; color: #b45309; }
.lookup-badge.is-alert { background: #fdecea; color: #b42318; }
.lookup-badge.is-sorting { background: #e8f1fb; color: #1e4d7b; }
.lookup-result-badge { font-size: 0.92rem; }
.lookup-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.65rem;
}
.lookup-chip {
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  background: #f6f9fc;
  border: 1px solid var(--border);
}
.lookup-chip span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 0.15rem;
}
.lookup-chip strong {
  font-size: 0.92rem;
  color: var(--primary);
  line-height: 1.4;
  word-break: break-word;
}
.lookup-tms-links { margin: 0.85rem 0 0; font-size: 0.86rem; }
.lookup-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.lookup-panel-head h2 {
  margin: 0;
  font-size: 1.08rem;
  color: var(--primary);
}
.lookup-panel-meta {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}
.lookup-log-table-wrap { display: block; }
.lookup-log-timeline { display: none; }
.lookup-timeline-item {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 0.75rem;
  padding-bottom: 0.9rem;
}
.lookup-timeline-item:last-child { padding-bottom: 0; }
.lookup-timeline-dot {
  width: 10px;
  height: 10px;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.18);
}
.lookup-timeline-body {
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafcfe;
}
.lookup-timeline-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
}
.lookup-timeline-top time {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}
.lookup-timeline-meta {
  margin-top: 0.35rem;
  font-size: 0.9rem;
  color: var(--primary);
}
.lookup-timeline-note {
  margin-top: 0.25rem;
  font-size: 0.84rem;
  color: var(--muted);
}
.pager-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}
.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0.35rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}
.pager-btn:hover { background: #f4f7fa; }
.pager-btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}
.pager-summary {
  font-size: 0.84rem;
  color: var(--muted);
}
.lookup-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem 1rem;
}
.lookup-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.65rem;
  margin-top: 1rem;
}
.lookup-detail-item {
  padding: 0.65rem 0.75rem;
  background: #f6f9fc;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.lookup-detail-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.lookup-detail-value {
  font-size: 0.92rem;
  color: var(--primary);
  word-break: break-word;
}
.lookup-sign-image { margin: 0.75rem 0 1rem; }
.lookup-sign-panel {
  display: grid;
  grid-template-columns: minmax(140px, 220px) minmax(0, 1fr);
  gap: 1.25rem;
  margin-top: 0.75rem;
  align-items: start;
}
.lookup-sign-cod {
  padding: 1rem;
  background: #f6f9fc;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.lookup-sign-cod-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 0.35rem;
}
.lookup-sign-cod-value.is-cod { color: #b45309; }
.lookup-sign-image-wrap { min-width: 0; }
.lookup-sign-image {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  margin-top: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(30, 77, 123, 0.08);
}
@media (max-width: 640px) {
  .lookup-sign-panel { grid-template-columns: 1fr; }
  .lookup-hero {
    grid-template-columns: 1fr;
  }
  .lookup-log-table-wrap { display: none; }
  .lookup-log-timeline {
    display: block;
    border-left: 2px solid #e2e8f0;
    margin-left: 0.35rem;
    padding-left: 0.35rem;
  }
  .lookup-chip-grid {
    grid-template-columns: 1fr;
  }
}

