/* ==========================================================================
   合寓 · 深港豪苑公寓管理系统
   设计语言：Editorial Warm-Luxe（骨米底 / 墨黑字 / 深玉绿 / 铜金点缀）
   ========================================================================== */

:root {
  --bg: #F2EFE7;
  --bg-2: #EAE5DA;
  --card: #FFFFFF;
  --card-2: #FBF9F4;
  --ink: #15140F;
  --ink-2: #3E3B33;
  --ink-3: #6E6A5C;
  --line: #E3DDD0;
  --line-2: #EFEAE0;

  --jade: #0F5F4A;
  --jade-2: #14795E;
  --jade-soft: #E6F0EB;
  --gold: #B0803C;
  --gold-soft: #F6EDDC;
  --violet: #5558B8;
  --violet-soft: #EAEAF8;
  --plum: #7A5AA8;
  --plum-soft: #F0EAF8;
  --rose: #AE4F38;
  --rose-soft: #F8E9E4;

  --shadow-1: 0 1px 2px rgba(21, 20, 15, .04), 0 8px 24px -12px rgba(21, 20, 15, .10);
  --shadow-2: 0 2px 4px rgba(21, 20, 15, .05), 0 24px 60px -24px rgba(21, 20, 15, .22);
  --shadow-pop: 0 24px 70px -20px rgba(21, 20, 15, .35);

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;

  --rail-w: 252px;
  --ease: cubic-bezier(.22, .68, .24, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", -apple-system, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --font-display: "Segoe UI Variable Display", "Inter", -apple-system, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", sans-serif;
  --font-num: "SF Mono", "Cascadia Mono", "Consolas", "Segoe UI", var(--font);
}

html[data-theme="dark"] {
  --bg: #0B0C0A;
  --bg-2: #101210;
  --card: #141613;
  --card-2: #191B17;
  --ink: #F3F1E9;
  --ink-2: #C7C4B8;
  --ink-3: #9C9889;
  --line: #272A24;
  --line-2: #1E211C;

  --jade: #56D3A4;
  --jade-2: #74E2B7;
  --jade-soft: rgba(86, 211, 164, .12);
  --gold: #D9B268;
  --gold-soft: rgba(217, 178, 104, .13);
  --violet: #9EA2F2;
  --violet-soft: rgba(158, 162, 242, .13);
  --plum: #B79CF0;
  --plum-soft: rgba(183, 156, 240, .14);
  --rose: #E0846C;
  --rose-soft: rgba(224, 132, 108, .13);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 30px -16px rgba(0, 0, 0, .8);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .5), 0 28px 70px -28px rgba(0, 0, 0, .9);
  --shadow-pop: 0 30px 80px -20px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background-image:
    radial-gradient(1100px 620px at 88% -12%, rgba(15, 95, 74, .07), transparent 62%),
    radial-gradient(900px 520px at -8% 4%, rgba(176, 128, 60, .08), transparent 60%);
  background-attachment: fixed;
}

html[data-theme="dark"] body {
  background-image:
    radial-gradient(1100px 620px at 88% -12%, rgba(86, 211, 164, .09), transparent 62%),
    radial-gradient(900px 520px at -8% 4%, rgba(217, 178, 104, .07), transparent 60%);
}

h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -.025em; color: var(--ink); }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; color: var(--ink); }
::selection { background: var(--jade); color: #fff; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.muted-sm { color: var(--ink-3); font-size: 12.5px; }
.hidden { display: none !important; }

:focus-visible { outline: 2px solid var(--jade); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------- 布局骨架 ------------------------------- */
.app { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100vh; }

/* -------------------------------- 侧边栏 -------------------------------- */
.rail {
  position: sticky; top: 0; align-self: start;
  height: 100vh; padding: 26px 18px 20px;
  display: flex; flex-direction: column; gap: 22px;
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(18px) saturate(1.1);
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 2px 8px; }
.brandmark {
  width: 40px; height: 40px; border-radius: 13px;
  display: grid; place-items: center;
  color: #F6F1E3;
  background: linear-gradient(150deg, var(--jade-2), var(--jade) 55%, #0A3F31);
  box-shadow: 0 6px 18px -8px rgba(15, 95, 74, .8), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.brandmark svg { width: 24px; height: 24px; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.25; }
.brand-txt b { font-family: var(--font-display); font-size: 16.5px; letter-spacing: .04em; }
.brand-txt span { font-size: 11.5px; color: var(--ink-3); letter-spacing: .06em; }

.rail-label {
  font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-3); padding: 0 12px; margin-bottom: -8px;
}

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border-radius: 13px;
  color: var(--ink-2); font-size: 14px; font-weight: 500;
  transition: background .22s var(--ease), color .22s var(--ease), transform .22s var(--ease);
}
.nav-item .ic { color: var(--ink-3); transition: color .22s var(--ease), transform .3s var(--ease); }
.nav-item:hover { background: var(--card); color: var(--ink); transform: translateX(2px); }
.nav-item:hover .ic { color: var(--ink-2); }
.nav-item.active {
  background: var(--card); color: var(--ink); font-weight: 600;
  box-shadow: var(--shadow-1), inset 0 0 0 1px var(--line-2);
}
.nav-item.active .ic { color: var(--jade); }
.nav-item.active::before {
  content: ""; position: absolute; left: -18px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0;
  background: var(--jade);
}

.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.db-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 13px; border-radius: 14px;
  background: var(--card-2); border: 1px solid var(--line-2);
}
.db-chip .ic { color: var(--jade); }
.db-chip > div { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.db-chip b { font-size: 12.5px; font-weight: 600; }
.db-chip span { font-size: 11.5px; color: var(--ink-3); }

.theme-btn {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 13px; border-radius: 13px;
  font-size: 13px; color: var(--ink-2); font-weight: 500;
  border: 1px solid var(--line-2); background: var(--card-2);
  transition: background .2s var(--ease), color .2s var(--ease);
}
.theme-btn:hover { background: var(--card); color: var(--ink); }
.theme-btn .sun { display: none; }
.theme-btn .moon { display: block; }
html[data-theme="dark"] .theme-btn .sun { display: block; }
html[data-theme="dark"] .theme-btn .moon { display: none; }

/* -------------------------------- 主区域 -------------------------------- */
.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 20px 34px 16px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(16px) saturate(1.15);
  border-bottom: 1px solid transparent;
  transition: border-color .25s var(--ease);
}
.topbar.stuck { border-bottom-color: var(--line); }
.crumb { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-3); letter-spacing: .04em; }
.crumb i { font-style: normal; opacity: .55; }
.page-title { font-size: 25px; line-height: 1.2; margin-top: 3px; }

.topbar-r { display: flex; align-items: center; gap: 10px; }
.global-search {
  display: flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 12px; min-width: 260px;
  border-radius: 13px; border: 1px solid var(--line);
  background: var(--card); box-shadow: var(--shadow-1);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.global-search:focus-within { border-color: var(--jade); box-shadow: 0 0 0 3px var(--jade-soft); }
.global-search .ic { color: var(--ink-3); }
.global-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; }
.global-search kbd {
  font-family: var(--font-num); font-size: 10.5px; color: var(--ink-3);
  padding: 2px 5px; border-radius: 6px; border: 1px solid var(--line); background: var(--card-2);
}

.content { padding: 6px 34px 46px; display: flex; flex-direction: column; gap: 18px; }
.page { display: flex; flex-direction: column; gap: 18px; }

/* -------------------------------- 按钮 -------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 16px; border-radius: 12px;
  font-size: 13.5px; font-weight: 550; white-space: nowrap;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  transition: transform .18s var(--ease), box-shadow .22s var(--ease), background .22s var(--ease), border-color .22s var(--ease), color .22s var(--ease);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-1); border-color: var(--line); }
.btn:active { transform: translateY(0) scale(.985); }
.btn .ic { width: 17px; height: 17px; }
.btn-primary {
  border-color: transparent; color: #F7F3E7;
  background: linear-gradient(160deg, var(--jade-2), var(--jade) 68%, #0A4132);
  box-shadow: 0 8px 22px -12px rgba(15, 95, 74, .95), inset 0 1px 0 rgba(255, 255, 255, .18);
}
html[data-theme="dark"] .btn-primary { color: #08130F; }
.btn-primary:hover { box-shadow: 0 12px 28px -12px rgba(15, 95, 74, .95); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { background: var(--card); color: var(--ink); }
.btn-danger { background: var(--rose); color: #fff; border-color: transparent; }
.btn-ghost.danger { color: var(--rose); border-color: color-mix(in srgb, var(--rose) 30%, var(--line)); }
.btn-ghost.danger:hover { background: var(--rose-soft); }
.btn-sm { height: 34px; padding: 0 13px; font-size: 13px; border-radius: 10px; }

.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  color: var(--ink-2); border: 1px solid transparent;
  transition: background .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.icon-btn:hover { background: var(--card); color: var(--ink); border-color: var(--line-2); }
.only-mobile { display: none; }

/* -------------------------------- 卡片 -------------------------------- */
.card {
  background: var(--card); border: 1px solid var(--line-2);
  border-radius: var(--r-lg); padding: 22px 24px;
  box-shadow: var(--shadow-1);
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.card-head h3 { font-size: 15.5px; }
.card-head p { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.card-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; font-weight: 550; color: var(--jade);
  padding: 5px 9px; border-radius: 9px;
  transition: background .2s var(--ease), gap .2s var(--ease);
}
.card-link:hover { background: var(--jade-soft); gap: 8px; }
.card-link .ic { width: 14px; height: 14px; }

.eyebrow { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }

/* ------------------------------- 表单控件 ------------------------------- */
.field-search {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px;
  border-radius: 11px; border: 1px solid var(--line); background: var(--card-2);
  min-width: 240px; transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
}
.field-search:focus-within { border-color: var(--jade); background: var(--card); box-shadow: 0 0 0 3px var(--jade-soft); }
.field-search .ic { color: var(--ink-3); }
.field-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; }

.select, .input {
  height: 38px; padding: 0 12px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--card-2); color: var(--ink);
  outline: none; transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease);
  appearance: none;
}
.select {
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23837D6D' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.select:hover, .input:hover { background: var(--card); }
.select:focus, .input:focus, textarea:focus { border-color: var(--jade); background: var(--card); box-shadow: 0 0 0 3px var(--jade-soft); }
.select-sm, .input-sm { height: 34px; font-size: 13px; border-radius: 10px; }

.seg {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px;
  background: var(--card-2); border: 1px solid var(--line);
}
.seg-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border-radius: 9px; font-size: 12.5px; font-weight: 550; color: var(--ink-3);
  transition: background .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease);
}
.seg-btn .ic { width: 15px; height: 15px; }
.seg-btn.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-1); }

/* -------------------------------- 状态标签 ------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 25px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: .01em; white-space: nowrap;
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill.s-已租 { color: var(--jade); background: var(--jade-soft); }
.pill.s-空置 { color: var(--gold); background: var(--gold-soft); }
.pill.s-预定 { color: var(--violet); background: var(--violet-soft); }
.pill.s-转租 { color: var(--violet); background: var(--violet-soft); }
.pill.s-待核实 { color: var(--ink-3); background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); }
.pill.s-转租 { color: var(--plum); background: var(--plum-soft); }

.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: 7px; font-size: 11.5px; font-weight: 550;
  color: var(--ink-2); background: var(--card-2); border: 1px solid var(--line-2);
}
.tag.accent { color: var(--gold); background: var(--gold-soft); border-color: transparent; }

/* -------------------------------- Toast -------------------------------- */
.toasts {
  position: fixed; right: 24px; bottom: 24px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 14px; font-size: 13.5px; font-weight: 500;
  background: var(--ink); color: var(--bg);
  box-shadow: var(--shadow-pop);
  animation: toastIn .34s var(--ease-out) both;
}
html[data-theme="dark"] .toast { background: #F3F1E9; color: #0B0C0A; }
.toast.out { animation: toastOut .26s var(--ease) both; }
.toast .ic { width: 16px; height: 16px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px) scale(.97); } }

/* ------------------------------- 骨架/载入 ------------------------------- */
.skeleton {
  border-radius: 10px;
  background: linear-gradient(100deg, var(--card-2) 30%, var(--line-2) 45%, var(--card-2) 60%);
  background-size: 220% 100%;
  animation: shimmer 1.5s var(--ease) infinite;
}
@keyframes shimmer { from { background-position: 130% 0; } to { background-position: -30% 0; } }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 54px 20px; text-align: center; color: var(--ink-3);
}
.empty .ic { width: 30px; height: 30px; opacity: .5; }
.empty b { color: var(--ink-2); font-size: 14px; font-weight: 600; }

/* ------------------------------- 响应式 ------------------------------- */
@media (max-width: 1180px) {
  .global-search { min-width: 190px; }
  .global-search kbd { display: none; }
}
@media (max-width: 980px) {
  :root { --rail-w: 76px; }
  .rail { padding: 22px 12px; align-items: center; }
  .brand-txt, .rail-label, .nav-item span, .db-chip > div, .theme-btn span { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .nav-item.active::before { left: -12px; }
  .db-chip, .theme-btn { justify-content: center; padding: 11px; }
  .topbar { padding: 16px 20px 12px; }
  .content { padding: 4px 20px 40px; }
}
@media (max-width: 720px) {
  .app { grid-template-columns: 1fr; }
  .rail {
    position: fixed; inset: 0 auto 0 0; width: 252px; height: 100vh;
    background: var(--card); transform: translateX(-100%);
    transition: transform .3s var(--ease-out); z-index: 90;
    align-items: stretch; padding: 22px 18px;
  }
  .rail.open { transform: none; box-shadow: var(--shadow-pop); }
  .rail.open .brand-txt, .rail.open .rail-label, .rail.open .nav-item span, .rail.open .db-chip > div, .rail.open .theme-btn span { display: block; }
  .rail.open .nav-item { justify-content: flex-start; padding: 11px 13px; }
  .only-mobile { display: grid; }
  .topbar { flex-wrap: wrap; }
  .global-search { display: none; }
  .page-title { font-size: 21px; }
  .content { padding: 4px 16px 40px; }
  .toasts { right: 12px; left: 12px; bottom: 12px; align-items: stretch; }
}
