/* 视觉直接沿用 8299 后台（app/static/style.css）的变量、卡片、按钮与输入框规范。 */
:root {
  --primary: #4f8cff;
  --accent: #28c7b7;
  --danger: #ef4444;
  --surface: rgba(255, 255, 255, 0.92);
  --line: #c6d9ec;
  --line-strong: #9fc3ee;
  --text: #1f2a44;
  --muted: #5f7190;
  --dim: #8ba0b8;
  --radius: 18px;
  --shadow: 0 14px 36px rgba(62, 118, 169, 0.12);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
body {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 12% -6%, rgba(79, 140, 255, 0.22), transparent 30%),
    radial-gradient(circle at 92% 5%, rgba(40, 199, 183, 0.18), transparent 32%),
    linear-gradient(180deg, #f7fcff 0%, #eef8ff 48%, #f9fffc 100%);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* ---- 按钮 / 输入（同后台） ---- */
button {
  min-height: 38px; padding: 9px 14px; border: 0; border-radius: 999px;
  font: inherit; font-size: 13px; font-weight: 760; color: #fff; cursor: pointer; white-space: nowrap;
  background: linear-gradient(135deg, var(--primary), #6aa6ff);
  box-shadow: 0 9px 22px rgba(79, 140, 255, 0.22);
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
  -webkit-tap-highlight-color: transparent;
}
button:active { transform: scale(0.97); }
button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
button.sm { min-height: 32px; padding: 6px 11px; font-size: 12px; }
button.outline { color: #426484; background: #f7fbff; border: 1px solid var(--line); box-shadow: none; }
button.danger { background: linear-gradient(135deg, #ff7b88, var(--danger)); box-shadow: 0 9px 22px rgba(239, 68, 68, 0.16); }
button.danger-outline { color: #d92d43; border-color: #ffd0d7; background: #fff7f8; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(79, 140, 255, .35); outline-offset: 2px; }
input, textarea, select {
  width: 100%; min-height: 42px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 14px;
  background: #fbfdff; color: #4a5b75; font: inherit; font-size: 14px; font-weight: 500; outline: none;
  -webkit-appearance: none; appearance: none;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
input:focus, textarea:focus, select:focus { border-color: #8fc2ff; background: #fff; box-shadow: 0 0 0 4px rgba(79, 140, 255, .1); }
select {
  padding-right: 36px; cursor: pointer;
  background: #fbfdff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%235f7190' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center;
}
.form-grid label small.hint { font-weight: 500; }
input[readonly] { background: #f3f7fb; color: var(--muted); }
input::placeholder, textarea::placeholder { color: #a5b5c8; }
textarea { resize: vertical; min-height: 76px; }

/* ---- 卡片（同后台） ---- */
.card {
  position: relative; overflow: hidden; padding: 16px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, #8ec5ff, #9df0e7, #d6c9ff);
}
.card h2 { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; font-size: 15px; font-weight: 780; }
.card h2::before {
  content: ''; width: 9px; height: 9px; flex-shrink: 0; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 0 0 5px rgba(79, 140, 255, .12);
}
.section-desc { margin: -4px 0 12px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.section-head h2 { margin-bottom: 0; }

/* ---- 登录页（同后台 login.html） ---- */
.center-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card, .state-card { width: min(420px, 100%); padding: 24px; }
.login-brand { margin-bottom: 12px; font-size: 22px; font-weight: 880; letter-spacing: -.03em; }
.login-notice {
  display: flex; gap: 10px; align-items: flex-start; margin: 10px 0 14px; padding: 12px 13px;
  border: 1px solid rgba(245, 158, 11, .45); border-radius: 16px;
  background: linear-gradient(135deg, #fff7ed, #fffbeb); color: #7c2d12;
  box-shadow: 0 12px 26px rgba(245, 158, 11, .14);
}
.notice-icon {
  display: grid; place-items: center; flex: 0 0 24px; width: 24px; height: 24px; border-radius: 999px;
  background: #f97316; color: #fff; font-size: 15px; font-weight: 900; line-height: 1;
}
.login-notice strong { display: block; margin-bottom: 4px; color: #111827; font-size: 15px; font-weight: 900; }
.login-notice span { display: block; font-size: 13px; font-weight: 760; line-height: 1.65; }
.login-form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.login-form label, .field, .form-grid label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 760; }
.login-form button { min-height: 44px; margin-top: 4px; font-size: 14px; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: #eef5fc; }
.tabs button { flex: 1; min-height: 34px; color: #6b7c93; background: transparent; box-shadow: none; font-weight: 700; }
.tabs button[aria-selected="true"] { color: var(--primary); background: #fff; box-shadow: 0 4px 12px rgba(62, 118, 169, .14); }
.state-card { text-align: center; }
.state-card h2 { justify-content: center; }
.state-card h2::before { display: none; }
.state-card button { margin-top: 4px; }
.spinner {
  width: 28px; height: 28px; margin: 4px auto 12px; border-radius: 50%;
  border: 3px solid #dcebf7; border-top-color: var(--primary); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- 已登录布局（同后台 header / grid） ---- */
.app-header {
  position: sticky; top: 0; z-index: 100; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px 12px; background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid rgba(220, 235, 247, .78);
}
.app-header h1 { font-size: 18px; font-weight: 850; letter-spacing: -.02em; }
.muted { color: var(--dim); font-size: 11px; margin-top: 2px; }
.account-actions { display: flex; align-items: center; gap: 8px; }
.account-name {
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 999px; background: rgba(255, 255, 255, .75); color: var(--muted); font-size: 12px; font-weight: 760;
}
.grid { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 720px; margin: 0 auto; padding: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
#profile-id-card { font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
#form-task { display: flex; flex-direction: column; gap: 14px; }
.field-label small, .field small { color: var(--dim); font-weight: 500; }

.form-error { padding: 10px 12px; border: 1px solid #fecaca; border-radius: 12px; background: #fff1f2; color: #dc2626; font-size: 12px; font-weight: 700; }
.login-card .form-error { margin-top: 12px; }
.hint { color: var(--dim); font-size: 12px; }
.empty { padding: 18px 12px; border: 1px dashed var(--line-strong); border-radius: 14px; background: #f8fbff; color: var(--muted); font-size: 13px; text-align: center; }

/* 日期 / 时段 chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 36px; padding: 7px 13px; border: 1px solid var(--line); border-radius: 12px;
  background: #f7fbff; color: #426484; box-shadow: none; font-size: 13px; font-weight: 700;
}
.chip small { display: block; color: var(--dim); font-size: 11px; font-weight: 600; }
.chip[aria-checked="true"], .chip[aria-pressed="true"] {
  border-color: var(--primary); background: linear-gradient(135deg, var(--primary), #6aa6ff); color: #fff;
  box-shadow: 0 6px 16px rgba(79, 140, 255, .24);
}
.chip[aria-checked="true"] small, .chip[aria-pressed="true"] small { color: rgba(255, 255, 255, .85); }
.chip.date { min-width: 64px; text-align: center; line-height: 1.25; }

/* 预约列表 */
.task-list { display: flex; flex-direction: column; gap: 9px; }
.task-item { padding: 12px 13px; border: 1px solid var(--line); border-radius: 14px; background: #fbfdff; }
.task-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.task-item h3 { font-size: 14px; font-weight: 780; overflow-wrap: anywhere; }
.pill { display: inline-flex; align-items: center; flex: none; min-height: 22px; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; color: #0f8a49; background: #eafaf1; border: 1px solid #bdebcf; }
.task-meta { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.slot-tag { padding: 2px 8px; border-radius: 8px; background: #eaf4ff; color: #2f6fe8; font-size: 12px; font-weight: 700; }
.task-note { margin-top: 6px; color: var(--muted); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.task-actions { display: flex; gap: 8px; margin-top: 10px; }

.danger-card::before { background: linear-gradient(90deg, #ffb4bd, #ffd6dc); }
.danger-card h2::before { background: var(--danger); box-shadow: 0 0 0 5px rgba(239, 68, 68, .12); }
.danger-notice { padding: 11px 12px; border: 1px solid #ffd0d7; border-radius: 12px; background: #fff0f2; color: #b4233a; font-size: 13px; font-weight: 700; }
.footer { padding: 2px 8px 18px; color: var(--dim); font-size: 12px; text-align: center; }

/* 提示条 */
.toast {
  position: fixed; left: 50%; top: 76px; z-index: 200; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 999px; font-size: 13px; font-weight: 760;
  color: #0f8a49; background: #eafaf1; border: 1px solid #bdebcf; box-shadow: var(--shadow);
}
.toast.error { color: #d92d43; background: #fff0f2; border-color: #ffd0d7; }

/* 弹窗 */
.modal { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(31, 42, 68, .28); backdrop-filter: blur(6px); }
.modal-box { position: relative; width: min(380px, 100%); padding: 20px; }
.modal-box .field { margin-bottom: 12px; }
.modal-box .form-actions button { flex: 1; }

@media (max-width: 600px) {
  .app-header { padding: 12px 13px 10px; }
  .grid { padding: 12px; gap: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .login-card { padding: 20px 18px; }
  .form-actions > button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- 我的预约 / 账号状态 / 执行记录 ---------- */
.pill.warn { color: #b77900; background: #fff8e6; border-color: #ffe1a3; }
.pill.bad { color: #d92d43; background: #fff0f2; border-color: #ffd0d7; }
.pill.none { color: var(--muted); background: #f3f6fb; border-color: var(--line); }
.slot-tag.expired { color: var(--dim); background: #f1f4f8; text-decoration: line-through; }
.task-reason { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: #fff8e6; color: #8a5a00; font-size: 12px; overflow-wrap: anywhere; }
.task-actions { flex-wrap: wrap; }
.empty-action { margin-top: 10px; }
#picked-summary:empty { display: none; }
#picked-summary { margin: 2px 0 10px; }
.run-list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0 2px 0 0; list-style: none; }
.run-item { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fbfdff; }
.run-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.run-time { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.run-slot { margin-top: 5px; color: #2f6fe8; font-size: 12px; font-weight: 700; }
.run-msg { margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.more { display: block; margin: 10px auto 0; }
@media (max-width: 560px) {
  .task-actions > button { flex: 1 1 40%; }
}

/* ---------- 我的预约 v9：扁平键值布局 ---------- */
.account-hint { margin: 2px 0 10px; padding: 8px 10px; border-radius: 10px; background: #fff0f2; color: #b4233a; font-size: 12px; }
.task-panel { margin-top: 6px; }
.kv { margin: 0; display: flex; flex-direction: column; }
.kv-row { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: start; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.kv-row:first-child { padding-top: 4px; }
.kv-row dt { color: var(--dim); font-size: 12px; line-height: 22px; }
.kv-row dd { margin: 0; min-width: 0; font-size: 14px; line-height: 22px; font-weight: 700; color: var(--text, #1f2d3d); overflow-wrap: anywhere; }
.kv-row dd.reason { font-size: 12px; font-weight: 500; line-height: 1.65; color: #8a5a00; }
.slot-list { display: flex; flex-wrap: wrap; gap: 6px; }
.slot-list .slot-tag { display: inline-flex; gap: 6px; align-items: baseline; padding: 2px 8px; font-size: 12px; font-weight: 600; line-height: 20px; }
.slot-list .slot-tag b { font-weight: 800; }
.muted { color: var(--dim); font-weight: 500; font-size: 13px; }
.task-panel .task-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.task-panel .task-actions > button { min-height: 38px; padding: 8px 6px; font-size: 13px; }
.task-foot { display: flex; justify-content: center; margin-top: 10px; }
button.link-danger { min-height: 28px; padding: 4px 10px; background: none; border: 0; box-shadow: none; color: #d92d43; font-size: 12px; font-weight: 700; }
button.link-danger:hover { text-decoration: underline; }
@media (max-width: 560px) { .task-panel .task-actions > button { flex: none; } }
.kv-row { padding: 8px 0; }
.kv-row:last-child { border-bottom: 0; }
.task-panel .task-actions { padding-top: 12px; border-top: 1px dashed var(--line); }

/* ---------- v11：开关按钮配色、任务参数 ---------- */
.task-panel .task-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
button.toggle-on { background: #3bd6c9; box-shadow: 0 9px 22px rgba(59, 214, 201, .22); }
button.toggle-off { background: linear-gradient(135deg, #ffc15a, #f59e0b); box-shadow: 0 9px 22px rgba(245, 158, 11, .18); }
.task-opts { margin-bottom: 12px; }
.task-opts label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; }
.task-opts small.hint { font-weight: 500; line-height: 1.5; }
@media (max-width: 560px) { .task-opts { grid-template-columns: 1fr; } }
/* v12：去掉按钮上方的第二条虚线（最后一行可能被隐藏，改为统一靠行底线分隔） */
.task-panel .task-actions { border-top: 0; padding-top: 0; }
.kv-row:last-child { border-bottom: 1px dashed var(--line); }
/* v13：日期时间输入框的原生文字与其他输入框同色 */
input::-webkit-datetime-edit { color: #4a5b75; }
input[type="datetime-local"]::-webkit-calendar-picker-indicator { opacity: .55; }
