/* Print Lab Studio 雲端版：登入與帳戶中心 */
:root {
  --bg: #f1f3f6;
  --surface: #ffffff;
  --surface2: #f6f8fa;
  --line: #dce2e9;
  --line2: #c6cfd9;
  --ink: #17212b;
  --ink2: #526071;
  --ink3: #8592a2;
  --accent: #0a6ea8;
  --accent-ink: #ffffff;
  --accent-soft: #dfeffa;
  --good: #17794a;
  --good-soft: #dff2e7;
  --bad: #b3261e;
  --bad-soft: #fbe2df;
  --band: #10222f;
  --band2: #173044;
  --band-ink: #e8f0f6;
  --band-dim: #9db3c4;
  --band-accent: #5cc0f2;
  --shadow: 0 1px 2px rgba(20, 30, 45, 0.06), 0 10px 30px rgba(20, 30, 45, 0.08);
  --radius: 12px;
  --f-body: 'Noto Sans TC', 'PingFang HK', 'Microsoft JhengHei', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--f-body);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.muted { color: var(--ink2); }
.small { font-size: 12.5px; }
.mono { font-family: var(--f-mono); }

/* ---------- 登入 ---------- */
.auth-shell { min-height: 100%; display: grid; grid-template-columns: minmax(360px, 46%) 1fr; }
.brand-panel {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 20% 10%, rgba(92, 192, 242, 0.16), transparent 60%),
    linear-gradient(155deg, var(--band) 0%, var(--band2) 100%);
  color: var(--band-ink);
  padding: 48px 52px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.brand-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 78%);
  pointer-events: none;
}
.brand-panel::after {
  content: '';
  position: absolute;
  width: 240px;
  height: 240px;
  right: -90px;
  bottom: -90px;
  border: 1px solid rgba(92, 192, 242, 0.28);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(92, 192, 242, 0.05), 0 0 0 56px rgba(92, 192, 242, 0.03);
}
.brand-head { position: relative; z-index: 1; }
.brand-mark {
  width: 54px;
  height: 54px;
  border: 1px solid rgba(232, 240, 246, 0.5);
  display: grid;
  place-items: center;
  font-family: var(--f-mono);
  font-weight: 500;
  letter-spacing: 0.06em;
  font-size: 20px;
  color: var(--band-accent);
  margin-bottom: 26px;
}
.brand-title { font-size: 20px; letter-spacing: 0.02em; margin: 0 0 6px; font-weight: 700; }
.brand-sub { color: var(--band-dim); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
.brand-hero { position: relative; z-index: 1; margin: 40px 0; }
.brand-hero h2 { font-size: clamp(26px, 3.2vw, 38px); line-height: 1.35; margin: 0 0 14px; font-weight: 700; letter-spacing: 0.01em; }
.brand-hero p { color: var(--band-dim); font-size: 14px; line-height: 1.9; margin: 0; max-width: 30em; }
.brand-points { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 10px; }
.brand-points li { display: flex; gap: 10px; align-items: baseline; color: var(--band-dim); font-size: 13px; }
.brand-points b { color: var(--band-ink); font-weight: 500; }
.brand-points span { font-family: var(--f-mono); color: var(--band-accent); font-size: 11px; }
.brand-foot { position: relative; z-index: 1; color: var(--band-dim); font-size: 11.5px; letter-spacing: 0.04em; display: flex; justify-content: space-between; gap: 12px; }

.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 28px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 26px; margin: 0 0 8px; letter-spacing: 0.01em; }
.auth-card .lede { margin: 0 0 30px; color: var(--ink2); font-size: 14px; line-height: 1.7; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 12.5px; font-weight: 500; color: var(--ink2); margin-bottom: 7px; letter-spacing: 0.02em; }
.input-wrap { position: relative; }
input[type='email'], input[type='password'], input[type='text'] {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line2);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type='password'] { padding-right: 64px; }
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input.err { border-color: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.pw-toggle {
  position: absolute;
  right: 6px;
  top: 6px;
  height: 34px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--ink2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  border-radius: 6px;
}
.pw-toggle:hover { background: var(--surface2); }
.check {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  font-size: 12.5px;
  color: var(--ink2);
  line-height: 1.55;
  margin: 2px 0 22px;
}
.check input { width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line2);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn:hover { background: var(--surface2); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 500; }
.btn-primary:hover { background: #08608f; }
.btn-block { width: 100%; height: 48px; font-size: 14.5px; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink2); }
.btn-danger { color: var(--bad); border-color: #e8b6b1; }
.link-row { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; font-size: 12.5px; }
.msg { border-radius: 9px; padding: 11px 13px; font-size: 13px; line-height: 1.6; margin: 0 0 18px; display: none; }
.msg.show { display: block; }
.msg.bad { background: var(--bad-soft); color: #7c1a14; border: 1px solid #efc4bf; }
.msg.good { background: var(--good-soft); color: #105c37; border: 1px solid #bde4cd; }
.auth-foot { margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink3); font-size: 12px; line-height: 1.7; }
.spinner { width: 15px; height: 15px; border: 2px solid rgba(255, 255, 255, 0.45); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.config-bad { padding: 16px; border: 1px solid #efc4bf; background: var(--bad-soft); color: #7c1a14; border-radius: 10px; font-size: 13px; line-height: 1.7; }

/* ---------- 帳戶中心 ---------- */
.topbar {
  background: var(--band);
  color: var(--band-ink);
  padding: 12px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .brand-mini { font-family: var(--f-mono); color: var(--band-accent); font-size: 15px; letter-spacing: 0.08em; }
.topbar .sep { color: var(--band-dim); }
.topbar .title { font-size: 14px; font-weight: 500; }
.topbar .grow { flex: 1; }
.topbar .who { color: var(--band-dim); font-size: 12.5px; }
.topbar .btn { background: transparent; border-color: rgba(232, 240, 246, 0.28); color: var(--band-ink); height: 34px; }
.topbar .btn:hover { background: rgba(255, 255, 255, 0.08); }
.wrap { max-width: 980px; margin: 0 auto; padding: 30px 22px 70px; }
.page-head { margin: 0 0 24px; display: flex; align-items: flex-end; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
.page-head h1 { margin: 0 0 6px; font-size: 24px; }
.page-head p { margin: 0; color: var(--ink2); font-size: 13px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: 0 1px 2px rgba(20, 30, 45, 0.04);
}
.card h2 { margin: 0 0 4px; font-size: 16px; }
.card .hint { margin: 0 0 18px; color: var(--ink2); font-size: 12.5px; line-height: 1.6; }
.profile-row { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 700;
  flex: none;
}
.profile-main { flex: 1; min-width: 220px; }
.profile-main h2 { font-size: 18px; margin-bottom: 4px; }
.profile-main .email { color: var(--ink2); font-size: 13px; font-family: var(--f-mono); }
.pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--line);
  color: var(--ink2);
  font-size: 11.5px;
  margin: 0 6px 0 0;
}
.pill.ok { background: var(--good-soft); border-color: #bde4cd; color: var(--good); }
.pill.off { background: var(--bad-soft); border-color: #efc4bf; color: var(--bad); }
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.meta-grid .k { color: var(--ink3); font-size: 11.5px; letter-spacing: 0.03em; margin-bottom: 4px; }
.meta-grid .v { font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--surface2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 12px; color: var(--ink2); }
.chip.on { background: var(--accent-soft); border-color: #c6e2f4; color: #085a86; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { background: var(--surface2); color: var(--ink2); font-weight: 500; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12px; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.is-off td { opacity: 0.55; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions .btn { height: 30px; padding: 0 9px; font-size: 12px; }
.section-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 14px; }
.section-head h2 { margin: 0; }
.section-head .btn { height: 34px; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(16, 34, 47, 0.45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal-card { background: var(--surface); border-radius: 14px; width: 100%; max-width: 620px; max-height: min(86vh, 760px); overflow: auto; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; background: var(--surface); }
.icon-btn { width: 32px; height: 32px; border: 0; background: transparent; font-size: 20px; cursor: pointer; color: var(--ink2); border-radius: 6px; }
.icon-btn:hover { background: var(--surface2); }
.perm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin-top: 8px; }
.perm-grid label { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--ink2); line-height: 1.5; }
.perm-grid input { accent-color: var(--accent); margin-top: 2px; }
select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line2);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 10px;
  font: inherit;
  font-size: 13.5px;
}
.note { background: var(--surface2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; color: var(--ink2); line-height: 1.6; }
.site-foot { color: var(--ink3); font-size: 11.5px; text-align: center; margin-top: 26px; }

@media (max-width: 880px) {
  .auth-shell { grid-template-columns: 1fr; }
  .brand-panel { padding: 26px 24px; min-height: auto; }
  .brand-hero { margin: 22px 0 8px; }
  .brand-points, .brand-foot { display: none; }
  .brand-panel::after { display: none; }
  .auth-main { padding: 30px 18px 48px; align-items: flex-start; }
  .form-grid, .perm-grid { grid-template-columns: 1fr; }
  .wrap { padding: 22px 14px 60px; }
  .card { padding: 18px; }
  .topbar { padding: 10px 14px; }
  .topbar .title, .topbar .sep { display: none; }
}
