:root {
  --brand: #52bebc;
  --remain: #82d0cf;
  --bg: #f5f5f9;
  --line: #f3f3f3;
  --text: #333;
  --muted: #757676;
  --danger: #f4333c;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: #e8ecef;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  color: var(--text);
}
.phone {
  max-width: 420px; min-height: 100vh; margin: 0 auto;
  background: var(--bg); display: flex; flex-direction: column;
}
.nav {
  display: grid; grid-template-columns: 52px 1fr 64px; align-items: center;
  height: 44px; background: #fff; border-bottom: 1px solid #eee;
  position: sticky; top: 0; z-index: 10;
}
.nav h1 { margin: 0; font-size: 17px; font-weight: 600; text-align: center; }
.nav-back, .nav-link {
  border: 0; background: transparent; color: var(--brand); cursor: pointer;
}
.nav-back { font-size: 28px; line-height: 1; }
.nav-link { font-size: 13px; justify-self: end; padding-right: 8px; min-height: 32px; }

.view.hidden, .hidden { display: none !important; }
.view { display: block; }

.hero {
  margin: 16px 12px 8px; padding: 18px 16px; border-radius: 10px;
  background: linear-gradient(135deg, #52bebc, #3aa8a6); color: #fff; font-size: 16px; font-weight: 600;
}
.menu { margin: 0 12px; display: grid; gap: 10px; }
.menu-item {
  border: 0; background: #fff; border-radius: 10px; padding: 18px 16px;
  text-align: left; font-size: 16px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.note { margin: 14px 16px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.linkish {
  margin: 0 16px 8px; border: 0; background: transparent; color: var(--brand);
  font-size: 13px; cursor: pointer; display: inline-block;
}
.linkish.danger { color: var(--danger); }

.user-bar {
  margin: 0 12px 10px; padding: 10px 12px; background: #fff; border-radius: 8px;
  font-size: 13px; color: var(--muted); line-height: 1.5;
}
.user-bar strong { color: var(--text); }

/* login */
.login-hero {
  margin: 16px 12px 8px; padding: 20px 16px; border-radius: 10px;
  background: linear-gradient(145deg, #1f6f6d, #52bebc); color: #fff;
}
.login-brand { font-size: 22px; font-weight: 700; letter-spacing: .02em; }
.login-sub { margin-top: 6px; font-size: 13px; opacity: .9; }
.login-tabs {
  display: grid; grid-template-columns: repeat(3, 1fr);
  margin: 0 12px; background: #fff; border-radius: 8px; overflow: hidden;
  border: 1px solid #eee;
}
.login-tab {
  border: 0; background: #fff; padding: 12px 4px; font-size: 12px;
  color: var(--muted); cursor: pointer;
}
.login-tab.active {
  color: var(--brand); font-weight: 600;
  box-shadow: inset 0 -2px 0 var(--brand); background: #f7fffe;
}
.login-panel { margin: 12px; padding: 12px; background: #fff; border-radius: 8px; }
.login-tip { margin: 0 0 10px; font-size: 12px; color: var(--muted); line-height: 1.55; }
.login-tip code { font-size: 11px; background: #f3f3f3; padding: 1px 4px; border-radius: 3px; }
.login-tip.muted { opacity: .85; }
.login-steps { margin: 0 0 12px; padding-left: 18px; font-size: 13px; color: #555; line-height: 1.7; }
.login-panel-ding { padding: 16px 12px 12px; background: linear-gradient(180deg, #f3fbfb 0%, #fff 48%); }
.ding-card {
  max-width: 280px; margin: 0 auto 12px; padding: 18px 16px 14px;
  background: #fff; border-radius: 14px; border: 1px solid #e6f2f1;
  box-shadow: 0 8px 28px rgba(31, 111, 109, .08);
  text-align: center;
}
.ding-card-title { font-size: 16px; font-weight: 650; color: #1f3d3c; }
.ding-card-sub { margin-top: 4px; font-size: 12px; color: var(--muted); }
.ding-frame-wrap {
  position: relative; width: 200px; height: 300px; margin: 14px auto 10px;
  border: 1px solid #e8e8e8; border-radius: 10px; overflow: hidden; background: #fafafa;
}
.ding-frame { width: 200px; height: 300px; border: 0; display: block; }
.ding-refresh-mask {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.88); font-size: 13px; color: var(--brand); font-weight: 600;
}
.ding-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; color: var(--muted);
}
.ding-countdown { flex: 1; text-align: left; }
.btn-text {
  border: 0; background: transparent; color: var(--brand); font-size: 12px;
  font-weight: 600; cursor: pointer; padding: 4px 0; white-space: nowrap;
}
.btn-block { width: 100%; margin-top: 8px; }
.login-fallback {
  margin-top: 14px; padding-top: 10px; border-top: 1px dashed #e8e8e8;
  font-size: 12px; color: var(--muted);
}
.login-fallback summary { cursor: pointer; color: #666; margin-bottom: 8px; }
.bookmarklet {
  display: inline-block; margin: 0 0 10px; padding: 8px 12px;
  border-radius: 8px; background: #eef9f8; color: var(--brand);
  text-decoration: none; font-weight: 600; border: 1px dashed #9ad9d7;
}
#pasteToken {
  width: 100%; border: 1px solid #e5e5e5; border-radius: 8px; padding: 10px;
  font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  margin-bottom: 10px; resize: vertical; min-height: 140px;
}
.login-panel .btn-outline { margin-top: 8px; }

.toolbar {
  display: flex; gap: 8px; padding: 10px 12px; background: #fff;
  border-bottom: 1px solid #eee; font-size: 12px; color: var(--muted); align-items: center;
}
.toolbar .hint { flex: 1; }
.toolbar button {
  font-size: 12px; padding: 6px 8px; border-radius: 6px;
  border: 1px solid var(--brand); background: #fff; color: var(--brand); cursor: pointer;
}

.leave-list { list-style: none; margin: 0; padding: 0; background: #fff; }
.leave-list li {
  min-height: 60px; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer;
  font-size: 15px; color: var(--muted);
}
.leave-list .extra { display: flex; align-items: center; gap: 4px; font-size: 13px; }
.leave-list .remain { color: var(--remain); }
.leave-list .tip { border: 0; background: transparent; color: #bbb; cursor: pointer; font-size: 16px; }

.form-card {
  margin: 12px; padding: 12px 14px 16px; background: #fff; border-radius: 8px;
}
.field {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px;
  font-size: 13px; color: var(--muted);
}
.field input, .field textarea, .field select {
  border: 1px solid #e5e5e5; border-radius: 6px; padding: 10px 12px;
  font-size: 15px; color: var(--text); font-family: inherit; background: #fff;
}
.field input[readonly] { background: #f7f8fa; color: var(--muted); }
.comp-list { display: grid; gap: 8px; }
.comp-item {
  display: flex; gap: 8px; align-items: center; padding: 8px 10px;
  border: 1px solid #eee; border-radius: 6px; font-size: 13px; color: var(--text);
}

.btn-primary {
  width: 100%; border: 0; background: var(--brand); color: #fff;
  padding: 12px; border-radius: 8px; font-size: 16px; cursor: pointer;
}
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-outline, .btn-revoke, .btn-ghost, .btn-danger {
  border-radius: 8px; padding: 10px 12px; font-size: 14px; cursor: pointer;
}
.btn-outline { border: 1px solid var(--brand); background: #fff; color: var(--brand); width: 100%; }
.btn-revoke { border: 1px solid var(--danger); background: #fff; color: var(--danger); width: 100%; }
.btn-ghost { border: 0; background: #f2f2f2; color: #666; }
.btn-danger { border: 0; background: var(--danger); color: #fff; }

.tabs {
  display: grid; grid-template-columns: 1fr 1fr; background: #fff; border-bottom: 1px solid #eee;
}
.tab {
  border: 0; background: transparent; padding: 12px; font-size: 14px; color: var(--muted); cursor: pointer;
}
.tab.active { color: var(--brand); box-shadow: inset 0 -2px 0 var(--brand); font-weight: 600; }

.empty { text-align: center; padding: 40px 16px; color: #999; font-size: 14px; }
.record-list { list-style: none; margin: 0; padding: 8px 12px 80px; }
.records-tip {
  margin: 8px 12px 0; font-size: 12px; color: var(--muted); line-height: 1.5;
}
.record-card .tag {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 4px;
  font-size: 10px; font-weight: 600; vertical-align: middle;
  background: #e8f7f6; color: var(--brand);
}
.record-card .tag.local { background: #f3f3f3; color: #888; }
small.tag {
  font-size: 11px; font-weight: 600; color: var(--brand);
  background: #e8f7f6; padding: 2px 6px; border-radius: 4px;
}
.record-card {
  background: #fff; border-radius: 8px; padding: 12px 14px; margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04); cursor: pointer;
}
.record-card .top { display: flex; justify-content: space-between; margin-bottom: 6px; }
.record-card .type { font-weight: 600; font-size: 15px; }
.record-card .state { font-size: 13px; color: var(--muted); }
.record-card .state.ok { color: var(--brand); }
.record-card .state.bad { color: #999; }
.record-card .meta { font-size: 12px; color: var(--muted); line-height: 1.6; }

.fab-wrap { position: sticky; bottom: 0; padding: 10px 12px 16px; background: linear-gradient(transparent, var(--bg) 30%); }

.detail-actions { margin: 0 12px 16px; display: grid; gap: 8px; }
.detail-kv { display: grid; gap: 8px; font-size: 13px; }
.detail-kv div {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 6px 0; border-bottom: 1px solid #f3f3f3;
}
.detail-kv span:first-child { color: var(--muted); flex-shrink: 0; }
.detail-kv span:last-child { text-align: right; color: #333; }

.loading {
  text-align: center; padding: 12px; color: var(--brand); background: rgba(255,255,255,.92);
}
.toast {
  position: fixed; left: 50%; bottom: 22%; transform: translateX(-50%);
  background: rgba(0,0,0,.78); color: #fff; padding: 10px 16px; border-radius: 8px;
  font-size: 14px; z-index: 60; max-width: 80%;
}

.panel {
  margin-top: auto; padding: 12px; background: #fff; border-top: 1px solid #eee; font-size: 12px;
}
.panel h2 { margin: 0 0 6px; font-size: 13px; color: #666; }
.panel pre {
  margin: 0; padding: 8px; background: #f7f8fa; border-radius: 6px;
  max-height: 120px; overflow: auto; white-space: pre-wrap; word-break: break-all;
}

dialog {
  border: 0; border-radius: 12px; padding: 16px; width: min(340px, 92vw);
}
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog h3 { margin: 0 0 8px; font-size: 16px; }
.muted { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
.approver-list { list-style: none; margin: 0 0 12px; padding: 0; }
.approver-list li {
  padding: 8px 0; border-bottom: 1px solid #f0f0f0; font-size: 13px;
  display: flex; justify-content: space-between; gap: 8px;
}
.dialog-actions { display: flex; gap: 8px; }
.dialog-actions button { flex: 1; padding: 10px; border-radius: 8px; font-size: 15px; }
#descDialog button {
  width: 100%; margin-top: 12px; border: 0; background: var(--brand);
  color: #fff; padding: 10px; border-radius: 8px;
}
#descBody { font-size: 13px; color: #555; line-height: 1.5; }
