/* =====================================================================
 * 超超的管家 · 样式 (style.css)
 * ---------------------------------------------------------------------
 * 依据《超超的管家 — 开发需求说明》：
 *   - 固定参考图配色（深灰底 #25272a、墨绿 #244438、暖金 #f3d087、米白文字）
 *   - 不做开灯/深浅色切换（已取消）
 *   - 修正下拉菜单配色：深色底 + 清晰浅色文字 + 明显选中态（尤其季度选择器）
 *   - 首页底部留白，预留后续模块
 * ===================================================================== */

:root {
  --bg: #25272a;
  --panel: #303335;
  --panel-2: #383b3d;
  --line: #494d4b;
  --line-2: #5a5f5d;
  --muted: #c3c4b9;
  --text: #f6efdf;
  --tint: #244438;
  --tint-2: #2a4d3e;
  --accent: #f3d087;
  --accent-strong: #ffdfa1;
  --on-accent: #243d31;
  --danger: #ffb3ad;
  --danger-bg: #3a2a2b;
  --ok: #b8dbc0;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #1b1d1f;
  color: var(--text);
  font: 15px/1.55 'Arial', 'Microsoft YaHei', 'PingFang SC', sans-serif;
}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

/* 手机式布局容器，桌面浏览器也居中显示，与草图视觉一致 */
#app {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
}

/* ---------------- 顶部栏 ---------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  min-height: 56px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.topbar .back {
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 8px;
}
.topbar .back:hover { background: var(--panel); }
.topbar h1 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  overflow-wrap: anywhere;
  flex: 1;
}
.topbar .spacer { flex: 1; }
.topbar .logout {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--muted);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 9px;
  cursor: pointer;
}
.topbar .logout:hover { color: var(--text); border-color: var(--text); }

/* ---------------- 内容区 ---------------- */
main {
  flex: 1;
  padding: 18px 18px 96px; /* 底部留白，预留后续模块 */
}

h2.section { font-size: 15px; color: var(--muted); margin: 22px 0 10px; }

/* ---------------- 按钮 ---------------- */
button { font: inherit; cursor: pointer; }
.btn {
  border: 1px solid var(--line-2);
  border-radius: 13px;
  padding: 12px 16px;
  min-height: 44px;
  color: var(--text);
  background: var(--panel);
  transition: filter .12s, background .12s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { filter: brightness(.94); }
.btn.primary { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.danger { background: var(--danger-bg); color: var(--danger); }
.btn.ghost { background: transparent; border: 1px solid var(--line-2); }
.btn.full { width: 100%; margin-top: 6px; }
.btn.small { padding: 8px 12px; min-height: 36px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; }
.row-btns .btn { flex: 1; }

/* ---------------- 列表行 ---------------- */
.row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  text-align: left;
  margin: 8px 0;
  padding: 15px 15px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--text);
  overflow-wrap: anywhere;
}
.row .main { min-width: 0; flex: 1; }
.row .sub { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.row .chev { color: var(--muted); font-size: 18px; flex-shrink: 0; }
.row:hover { border-color: var(--line-2); }

/* 待续费徽标 */
.badge {
  display: inline-block;
  font-size: 11px;
  color: var(--accent);
  background: var(--tint);
  padding: 3px 9px;
  border-radius: 9px;
  margin-left: 6px;
  vertical-align: middle;
  white-space: nowrap;
}
.badge.warn {
  color: var(--on-accent);
  background: var(--accent);
  font-weight: 600;
}

/* ---------------- 汇总卡片 ---------------- */
.summary {
  padding: 18px 20px;
  border-radius: 20px;
  background: var(--tint);
  margin-bottom: 16px;
  cursor: pointer;
  border: 1px solid var(--tint-2);
}
.summary .period {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.summary .title { font-size: 13px; color: var(--muted); margin-top: 12px; }
.summary .amount {
  display: block;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -1px;
  margin: 4px 0 2px;
  color: var(--accent-strong);
  font-variant-numeric: tabular-nums;
}
.summary .hint { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* 季度/月份选择器 —— 深底浅字，对比度清晰 */
.period select, .period input {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 14px;
  min-height: 36px;
  max-width: 190px;
  cursor: pointer;
}
.period select:focus, .period input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------------- 表单 ---------------- */
label { display: block; font-size: 13px; color: var(--muted); margin: 15px 0 6px; }
input, select, textarea {
  font: 16px/1.45 'Arial', 'Microsoft YaHei', sans-serif;
  width: 100%;
  min-width: 0;
  min-height: 45px;
  padding: 10px 12px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
}
select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%23c3c4b9' stroke-width='1.6' fill='none'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
  appearance: none;
  -webkit-appearance: none;
}
select option { background: var(--panel-2); color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { resize: vertical; min-height: 76px; }
input[type="date"] { color-scheme: dark; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.fields .wide { grid-column: 1 / -1; }
.fields label { font-size: 12px; }
.form-error { color: var(--danger); font-size: 13px; margin: 12px 0; }

/* ---------------- 记录卡片 ---------------- */
.record {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 15px 16px;
  margin: 10px 0;
}
.record .top { display: flex; justify-content: space-between; gap: 10px; }
.record .name { font-weight: 600; overflow-wrap: anywhere; }
.record .amt { color: var(--accent-strong); font-weight: 600; font-variant-numeric: tabular-nums; }
.record .meta { font-size: 12px; color: var(--muted); margin-top: 6px; overflow-wrap: anywhere; }
.record .detail { font-size: 13px; color: var(--text); margin-top: 4px; overflow-wrap: anywhere; }
.record .actions { display: flex; gap: 14px; margin-top: 12px; }

/* ---------------- 空态 / 提示 ---------------- */
.empty { padding: 30px 12px; color: var(--muted); text-align: center; font-size: 13px; }
.note { font-size: 12px; color: var(--muted); margin: 12px 0; line-height: 1.6; }

/* ---------------- 首页品牌区 ---------------- */
/* ---------------- 首页（对照参考图：管家居中、标题艺术金、按钮偏下、底部留白） ---------------- */
.home-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 22px;
  min-height: 0;
}
.home-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 4px 0;
  min-height: 44px;
}
.home-account { font-size: 12px; color: var(--muted); }
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: 3vh;
}
.brand-logo {
  width: auto;
  height: 138px;
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
}
.home-entries {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  padding: 0 18px 8vh;
}
.home-entries .entry {
  background: transparent;
  border: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  color: var(--text);
  padding: 0;
}
.entry-icon {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: var(--tint);
  border: 1px solid var(--tint-2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
.entry-icon svg { width: 42px; height: 42px; }
.entry-label { font-size: 16px; }
.entry:hover .entry-icon { background: var(--tint-2); }

/* ---------------- 底部留白（预留后续模块） ---------------- */
.home-footer-space { display: none; }

/* ---------------- 对话框 ---------------- */
.dialog-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, .55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 110px 18px 20px;
}
.dialog-mask[hidden] { display: none; }
.dialog {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 20px;
  padding: 22px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 12px 45px rgba(0, 0, 0, .4);
}
.dialog h3 { margin: 0 0 10px; font-size: 17px; }
.dialog p { font-size: 14px; margin: 12px 0 20px; color: var(--text); }
.dialog .btn { width: 100%; margin-top: 8px; }

/* ---------------- 登录页 ---------------- */
.auth-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 26px 30px 60px;
}
.auth-title { text-align: center; margin-bottom: 26px; }
.auth-title .appname { font-size: 26px; font-weight: 700; letter-spacing: 4px; color: var(--accent); }
.auth-title p { color: var(--muted); font-size: 13px; margin-top: 6px; }
.auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 22px; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs .tab {
  flex: 1;
  padding: 9px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
}
.tabs .tab.active { background: var(--tint); color: var(--accent-strong); border-color: var(--tint-2); }

/* ---------------- 工具类 ---------------- */
.flex { display: flex; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.amount-strong { color: var(--accent-strong); font-weight: 600; }
.rule { height: 1px; background: var(--line); margin: 20px 0; }
.center { text-align: center; }
.tag {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 8px;
  background: var(--tint); color: var(--accent-strong); margin-left: 6px;
}
.tag.gray { background: var(--panel-2); color: var(--muted); }


/* ---------------- 公司资料：开票信息展示 + 复制提示 ---------------- */
.info-block {
  margin-top: 8px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px dashed var(--line-2);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--text);
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 64px;
  transform: translateX(-50%) translateY(20px);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
  opacity: 0;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }


/* ---------------- 导入数据 ---------------- */
.home-top .mini-btn { margin-right: 10px; }
.mini-btn {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--muted);
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 9px;
  cursor: pointer;
}
.mini-btn:hover { color: var(--text); border-color: var(--text); }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}
.card p { margin: 0 0 8px; line-height: 1.7; color: var(--text); }
.card p:last-child { margin-bottom: 0; }
.card .dim { color: var(--muted); font-size: 13px; }
.import-result { margin-top: 16px; }
.import-result .ok {
  background: var(--tint);
  color: var(--accent);
  border-radius: 13px;
  padding: 14px 16px;
  line-height: 1.7;
  margin-bottom: 16px;
}


/* ---------------- 桌面端：自适应宽屏 + 导出按钮仅桌面显示 ---------------- */
@media (min-width: 768px) {
  #app { max-width: 1000px; }
}
@media (max-width: 767px) {
  [data-export] { display: none !important; }
}
