/* 日历助手 · 网页版
   产品决策 6：只有一套浅色配色，不跟随系统深浅色。 */

:root {
  --bg: #f2f4f8;
  --card: #ffffff;
  --ink: #1b1f27;
  --ink-2: #5d6675;
  --ink-3: #8c95a5;
  --line: #e2e7ef;
  --brand: #2b5fd9;
  --brand-ink: #ffffff;
  --warn-bg: #fff6e5;
  --warn-line: #f0d29a;
  --warn-ink: #8a5a00;
  --ok-bg: #eaf6ee;
  --ok-line: #b6dfc4;
  --ok-ink: #1f6b39;
  --bad-bg: #fdeceb;
  --bad-line: #f3c2bf;
  --bad-ink: #a32a22;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
}

.hidden { display: none !important; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; word-break: break-all; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-t) + 10px) 16px 10px;
  background: rgba(242, 244, 248, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: 18px; font-weight: 700; letter-spacing: 0.3px; }

#main { padding: 14px 14px calc(var(--safe-b) + 40px); max-width: 720px; margin: 0 auto; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}

/* ---------- 横幅 ---------- */
.banner {
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 14px;
}
.banner-title { font-weight: 700; margin-bottom: 4px; }
.banner-body { color: var(--ink-2); }
.banner-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.banner-warn .banner-body { color: #7a5200; }
.banner-ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
.banner-ok .banner-body { color: #2c6b41; }
.banner-bad { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-ink); }
.banner-bad .banner-body { color: #8f2b23; }
.banner .btn { margin-top: 10px; }

/* ---------- 按钮 ---------- */
.btn {
  appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 11px; padding: 11px 14px; font-size: 15px; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: transform .06s, opacity .15s;
}
.btn:active { transform: scale(0.985); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary[disabled] { background: #a9bce8; border-color: #a9bce8; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 8px 12px; font-size: 13.5px; border-radius: 9px; }
.btn-block { display: block; width: 100%; margin-top: 12px; }
.icon-btn {
  appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 9px; padding: 7px 12px; font-size: 14px; font-family: inherit; cursor: pointer;
}

.row { display: flex; align-items: center; gap: 8px; }
.row-between { justify-content: space-between; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 2px 8px; }
.section-title { font-weight: 700; font-size: 15px; }

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 6px; background: #eef1f6; border-radius: 11px; padding: 4px; margin-bottom: 12px; }
.tab {
  flex: 1; appearance: none; border: 0; background: transparent; color: var(--ink-2);
  border-radius: 8px; padding: 9px; font-size: 14.5px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(20,30,60,.10); }

/* ---------- 输入 ---------- */
textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 11px;
  padding: 12px; font: inherit; font-size: 15px; line-height: 1.6;
  resize: vertical; min-height: 150px; background: #fcfdff; color: var(--ink);
}
textarea:focus { outline: 2px solid #c3d3f7; border-color: #b9cbf3; }

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; border: 2px dashed #ccd6e6; border-radius: 12px; padding: 26px 14px;
  background: #fbfcfe; cursor: pointer; text-align: center;
}
.drop-icon { font-size: 26px; color: var(--ink-3); line-height: 1; }
.drop-title { font-weight: 600; }
.drop-sub { font-size: 13px; color: var(--ink-3); }

.file-info { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px; background: #f7f9fc; border-radius: 11px; }
#file-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 9px; background: #e8edf5; }
.file-meta { flex: 1; min-width: 0; }
.file-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 状态 ---------- */
.status-head { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #cfd9ea; border-top-color: var(--brand);
  animation: spin .8s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 事件卡片 ---------- */
.ev {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; margin-bottom: 10px;
}
.ev.unchecked { background: #fafbfd; }
.ev-head { display: flex; gap: 10px; align-items: flex-start; }
.ev-check { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--brand); }
.ev-main { flex: 1; min-width: 0; }
.ev-title { font-weight: 700; font-size: 15.5px; word-break: break-word; }
.ev-time { font-size: 13.5px; color: var(--ink-2); margin-top: 2px; }
.ev-meta { font-size: 13px; color: var(--ink-2); margin-top: 4px; word-break: break-word; }
.ev-meta .k { color: var(--ink-3); }
.ev-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.tag {
  font-size: 12px; padding: 2px 8px; border-radius: 20px;
  background: #eef2fa; color: #3a4a6b; border: 1px solid #dde5f5;
}
.tag-rrule { background: #eef7f1; color: #24603c; border-color: #cde7d7; }
.tag-allday { background: #f4eefb; color: #54397d; border-color: #e0d3f2; }
.tag-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.tag-bad { background: var(--bad-bg); color: var(--bad-ink); border-color: var(--bad-line); }
.ev-note { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; border-top: 1px dashed var(--line); padding-top: 6px; word-break: break-word; }
.ev-note b { color: var(--ink-2); font-weight: 600; }

/* ---------- details ---------- */
.details { padding: 0; }
.details > summary {
  list-style: none; cursor: pointer; padding: 13px 14px; font-weight: 600; font-size: 14.5px;
  display: flex; justify-content: space-between;
}
.details > summary::-webkit-details-marker { display: none; }
.details > summary::after { content: "▾"; color: var(--ink-3); }
.details[open] > summary::after { content: "▴"; }
.details > *:not(summary) { padding: 0 14px 14px; margin: 0; }

.skipped, .log { list-style: none; padding-left: 0 !important; }
.skipped li, .log li { font-size: 13.5px; color: var(--ink-2); padding: 6px 0; border-top: 1px solid var(--line); word-break: break-word; }
.skipped li:first-child, .log li:first-child { border-top: 0; }
.log li { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; color: var(--ink-3); }

.hint { font-size: 12.5px; color: var(--ink-3); margin-top: 8px; line-height: 1.5; }
.history { font-size: 13.5px; color: var(--ink-2); }
.history .h-item { padding: 7px 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; }
.history .h-item:first-child { border-top: 0; }
.history .h-when { color: var(--ink-3); font-size: 12.5px; flex: none; }

/* ---------- 设置面板 ---------- */
.sheet { position: fixed; inset: 0; z-index: 50; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(15, 22, 40, .45); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 92vh;
  background: var(--bg); border-radius: 18px 18px 0 0; display: flex; flex-direction: column;
  padding-bottom: var(--safe-b);
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 700;
}
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 16px 28px; }
.field-group { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 14px; }
.field-group-title { font-weight: 700; font-size: 14.5px; margin-bottom: 10px; }
.field { display: block; margin-bottom: 10px; }
.field > span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }
.field input, .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px;
  font: inherit; font-size: 15px; background: #fcfdff; color: var(--ink);
}
.field input:focus, .field select:focus { outline: 2px solid #c3d3f7; border-color: #b9cbf3; }

/* 预设下面那句"要不要花钱"的提示：免费用绿、计费用橙，一眼能分开 */
.cost-free { color: var(--ok-ink); font-weight: 600; }
.cost-paid { color: var(--warn-ink); font-weight: 600; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--safe-b) + 24px); transform: translateX(-50%);
  background: rgba(24, 30, 44, .94); color: #fff; padding: 11px 18px; border-radius: 30px;
  font-size: 14px; z-index: 90; max-width: 88vw; text-align: center; line-height: 1.45;
}
