@import url('./fonts/fonts.css');

:root {
  --ink: #0a0a0a;
  --paper: #f5f5f1;
  --white: #ffffff;
  --muted: #777770;
  --line: #c9c9c1;
  --soft: #e9e9e3;
  --accent: #b8ff35;
  --danger: #d9483b;
  --mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
  --body: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --display: Michroma, var(--body);
}

* { box-sizing: border-box; }
html { color-scheme: light; background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font: 15px/1.55 var(--body); overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, .button {
  min-height: 44px; border: 1px solid var(--ink); border-radius: 0; background: var(--ink); color: var(--white);
  padding: 10px 16px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
button:hover, .button:hover { background: #272727; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
button.secondary, .button.secondary { background: transparent; color: var(--ink); }
button.secondary:hover { background: var(--soft); }
button.danger { border-color: var(--danger); color: var(--danger); background: transparent; }
button.small { min-height: 36px; padding: 6px 10px; font-size: 13px; }
button:disabled { opacity: .45; cursor: wait; }
input, select, textarea {
  width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 0; background: var(--white); color: var(--ink); padding: 10px 12px;
}
textarea { min-height: 110px; resize: vertical; }
label { display: grid; gap: 6px; font: 12px/1.3 var(--mono); letter-spacing: .04em; text-transform: uppercase; }

.topbar { height: 68px; border-bottom: 1px solid var(--ink); background: var(--paper); display: flex; align-items: center; padding: 0 28px; gap: 28px; position: sticky; top: 0; z-index: 50; }
.brand { font: 15px var(--display); letter-spacing: .08em; white-space: nowrap; }
.brand span { font: 11px var(--mono); color: var(--muted); margin-left: 9px; letter-spacing: .05em; }
.nav { display: flex; align-items: stretch; align-self: stretch; margin-left: auto; }
.nav a { min-width: 90px; padding: 0 16px; display: flex; align-items: center; justify-content: center; border-left: 1px solid var(--line); font: 12px var(--mono); }
.nav a[aria-current='page'] { box-shadow: inset 0 -5px 0 var(--accent); }
.profile { border-left: 1px solid var(--ink); align-self: stretch; display: flex; align-items: center; padding-left: 20px; font: 12px var(--mono); }

.shell { width: min(1440px, 100%); margin: 0 auto; padding: 32px; }
.eyebrow { margin: 0 0 8px; font: 11px var(--mono); text-transform: uppercase; letter-spacing: .13em; color: var(--muted); }
h1, h2, h3, p { margin-top: 0; }
h1 { font: clamp(30px, 5vw, 66px)/1.08 var(--display); letter-spacing: -.025em; margin-bottom: 22px; }
h2 { font: 22px/1.2 var(--display); letter-spacing: -.02em; }
h3 { font-size: 16px; }
.lede { font-size: 18px; max-width: 680px; color: #343430; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.rule { border-top: 1px solid var(--ink); }
.panel { border: 1px solid var(--ink); background: var(--white); padding: 22px; }
.panel.soft { background: var(--soft); }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.tag { display: inline-flex; min-height: 25px; align-items: center; padding: 2px 8px; border: 1px solid var(--ink); font: 10px var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.tag.accent { background: var(--accent); }
.tag.muted { border-color: var(--line); color: var(--muted); }
.notice { border-left: 5px solid var(--accent); background: var(--white); padding: 13px 16px; }
.error { border-left-color: var(--danger); color: #8f241c; }
.empty { min-height: 180px; display: grid; place-items: center; border: 1px dashed var(--line); color: var(--muted); text-align: center; padding: 24px; }
.hidden { display: none !important; }
.metric { border-top: 1px solid var(--ink); padding-top: 14px; }
.metric strong { display: block; font: 34px/1.1 var(--display); }
.metric span { font: 11px var(--mono); color: var(--muted); text-transform: uppercase; }

.auth-layout { min-height: 100vh; display: grid; grid-template-columns: 1.15fr .85fr; }
.auth-hero { background: var(--ink); color: var(--white); padding: clamp(30px, 7vw, 90px); display: flex; flex-direction: column; justify-content: space-between; }
.auth-hero .brand { font-size: 18px; }
.auth-hero h1 { max-width: 820px; }
.auth-hero .index { color: var(--accent); font: 12px var(--mono); }
.auth-card { padding: clamp(28px, 7vw, 80px); display: flex; align-items: center; }
.auth-card > div { width: min(440px, 100%); margin: auto; }
.tabs { display: flex; border-bottom: 1px solid var(--ink); margin-bottom: 26px; }
.tabs button { flex: 1; background: transparent; color: var(--muted); border: 0; border-bottom: 5px solid transparent; }
.tabs button.active { color: var(--ink); border-bottom-color: var(--accent); }

.map-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(330px, .7fr); border: 1px solid var(--ink); min-height: calc(100vh - 164px); }
.map-stage { position: relative; min-height: 650px; overflow: hidden; background-color: #111; background-image: linear-gradient(#282828 1px, transparent 1px), linear-gradient(90deg, #282828 1px, transparent 1px); background-size: 48px 48px; }
.map-stage::before { content: 'SHANGHAI / SPATIAL PREVIEW'; position: absolute; top: 16px; left: 18px; color: #777; font: 10px var(--mono); letter-spacing: .12em; }
.map-point { width: 18px; height: 18px; border: 2px solid var(--ink); background: var(--accent); position: absolute; transform: translate(-50%, -50%); cursor: pointer; z-index: 3; }
.map-point:hover, .map-point.active { width: 26px; height: 26px; }
.map-caption { position: absolute; bottom: 16px; left: 16px; right: 16px; color: #aaa; font: 11px var(--mono); }
.map-side { border-left: 1px solid var(--ink); background: var(--paper); display: flex; flex-direction: column; min-height: 0; }
.map-tools { padding: 16px; border-bottom: 1px solid var(--ink); }
.venue-list { overflow: auto; flex: 1; }
.venue-card { padding: 18px; border-bottom: 1px solid var(--line); cursor: pointer; }
.venue-card:hover, .venue-card.active { background: var(--white); box-shadow: inset 5px 0 0 var(--accent); }
.venue-card h3 { margin-bottom: 7px; }
.venue-card p { margin-bottom: 5px; }

.calendar-head { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 24px; margin-bottom: 28px; }
.day-rail { display: grid; grid-template-columns: repeat(7, minmax(90px,1fr)); border: 1px solid var(--ink); overflow-x: auto; }
.day { min-height: 92px; border-right: 1px solid var(--line); background: transparent; color: var(--ink); display: grid; justify-items: start; align-content: space-between; padding: 12px; }
.day:last-child { border-right: 0; }
.day.active { background: var(--ink); color: var(--white); box-shadow: inset 0 -6px 0 var(--accent); }
.day strong { font: 24px var(--display); }
.events { margin-top: 22px; border-top: 1px solid var(--ink); }
.event-card { display: grid; grid-template-columns: 150px 1fr 160px; gap: 18px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.event-card time { font: 13px var(--mono); }
.event-card h3 { margin-bottom: 5px; }

.admin-layout { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 68px); }
.admin-nav { border-right: 1px solid var(--ink); padding: 24px 14px; position: sticky; top: 68px; height: calc(100vh - 68px); }
.admin-nav button { width: 100%; justify-content: flex-start; background: transparent; color: var(--ink); border: 0; border-bottom: 1px solid var(--line); font: 12px var(--mono); }
.admin-nav button.active { background: var(--accent); }
.admin-main { min-width: 0; padding: 32px; }
.admin-main h1 { font-size: clamp(32px, 4.5vw, 58px); }
.review-card { border: 1px solid var(--ink); background: var(--white); padding: 18px; }
.review-card pre { overflow: auto; max-height: 260px; background: #111; color: #ddd; padding: 14px; font: 11px/1.55 var(--mono); }
.table-wrap { overflow-x: auto; border: 1px solid var(--ink); }
table { width: 100%; border-collapse: collapse; background: var(--white); font-size: 13px; }
th, td { border-bottom: 1px solid var(--line); text-align: left; padding: 11px; vertical-align: top; }
th { font: 10px var(--mono); text-transform: uppercase; background: var(--soft); white-space: nowrap; }
dialog { width: min(680px, calc(100% - 28px)); border: 1px solid var(--ink); border-radius: 0; padding: 0; background: var(--paper); }
dialog::backdrop { background: rgba(0,0,0,.72); }
.dialog-head { padding: 18px 22px; border-bottom: 1px solid var(--ink); display: flex; justify-content: space-between; align-items: center; }
.dialog-body { padding: 22px; max-height: 70vh; overflow: auto; }
.account-create { display: grid; grid-template-columns: minmax(220px, 1fr) 180px auto; gap: 12px; align-items: end; }
.account-list { display: grid; gap: 12px; margin-top: 20px; }
.account-card { border: 1px solid var(--ink); background: var(--white); padding: 18px; display: grid; grid-template-columns: minmax(180px, 1.2fr) repeat(3, minmax(110px, .7fr)); gap: 18px; align-items: center; }
.account-card .account-phone { font: 16px var(--mono); }
.account-card .account-meta { display: grid; gap: 3px; }
.account-card .account-meta span:first-child { color: var(--muted); font: 10px var(--mono); text-transform: uppercase; letter-spacing: .07em; }
.account-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.credential { border: 1px solid var(--ink); background: var(--white); padding: 16px; font: 18px var(--mono); overflow-wrap: anywhere; }
.place-search { display: grid; grid-template-columns: minmax(260px, 1fr) 160px auto; gap: 12px; align-items: end; margin-bottom: 20px; }
.place-results { display: grid; gap: 12px; }
.place-card { display: grid; grid-template-columns: 54px minmax(0,1fr) auto; gap: 18px; align-items: start; border: 1px solid var(--ink); background: var(--white); padding: 18px; }
.place-card h3 { margin: 0; }
.place-rank { font-size: 18px; color: var(--muted); }
.duplicate-list { display: grid; gap: 7px; margin-top: 12px; }
.duplicate-hit { border-left: 4px solid var(--accent); background: var(--soft); padding: 9px 11px; }
.duplicate-hit p, .duplicate-hit small { margin: 3px 0 0; color: var(--muted); }
.config-hint { grid-column: 1 / -1; margin: 0; font-family: var(--mono); }

@media (max-width: 1100px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-nav { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--ink); display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); padding: 0; }
  .admin-nav button { min-width: 0; min-height: 54px; justify-content: center; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
  .admin-nav button:nth-child(4n) { border-right: 0; }
}

@media (max-width: 900px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-hero { min-height: 42vh; }
  .map-layout { grid-template-columns: 1fr; }
  .map-stage { min-height: 430px; }
  .map-side { border-left: 0; border-top: 1px solid var(--ink); }
  .event-card { grid-template-columns: 110px 1fr; }
  .event-card > :last-child { grid-column: 2; }
  .grid.four, .grid.three { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 600px) {
  .topbar { padding: 0 14px; height: auto; min-height: 64px; flex-wrap: wrap; gap: 8px; }
  .topbar .brand { padding-top: 12px; }
  .nav { order: 3; width: 100%; margin: 0; border-top: 1px solid var(--line); }
  .nav a { flex: 1; min-width: 0; padding: 10px 6px; }
  .profile { border-left: 0; margin-left: auto; padding-left: 8px; }
  .shell, .admin-main { padding: 20px 14px; }
  .admin-nav { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .admin-nav button:nth-child(4n) { border-right: 1px solid var(--line); }
  .admin-nav button:nth-child(2n) { border-right: 0; }
  .account-create { grid-template-columns: 1fr; }
  .place-search, .place-card { grid-template-columns: 1fr; }
  .account-card { grid-template-columns: 1fr 1fr; gap: 14px; }
  .account-card .account-identity { grid-column: 1 / -1; }
  .grid.two, .grid.three, .grid.four { grid-template-columns: 1fr; }
  .calendar-head { grid-template-columns: 1fr; }
  .day-rail { grid-template-columns: repeat(7, 80px); }
  .event-card { grid-template-columns: 1fr; }
  .event-card > :last-child { grid-column: 1; }
  .auth-card, .auth-hero { padding: 28px 20px; }
}

@media (max-width: 420px) {
  .brand span { display: none; }
  .account-card { grid-template-columns: 1fr; }
  .account-card .account-identity { grid-column: 1; }
}

/* Pouch Operations：后台使用同一品牌语言，但保持高密度、低装饰。 */
body.operations {
  --ops-night: #07100d;
  --ops-surface: #ffffff;
  --ops-paper: #f1f4ef;
  --ops-line: #d6ddd7;
  --ops-muted: #627068;
  background: var(--ops-paper);
}
.operations .topbar {
  height: 68px;
  gap: 18px;
  padding: 0 clamp(16px, 2.4vw, 30px);
  border-bottom-color: rgba(211, 237, 221, .16);
  background: var(--ops-night);
  color: #f3f8f4;
}
.operations .brand { font-size: 14px; letter-spacing: .11em; }
.operations .brand span { color: #76d9ca; font-size: 9px; }
.operations .nav {
  align-self: auto;
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(211, 237, 221, .16);
  border-radius: 999px;
}
.operations .nav a {
  min-width: 68px;
  min-height: 44px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  color: #aab8af;
}
.operations .nav a:hover { color: #fff; background: rgba(255,255,255,.07); }
.operations .nav a[aria-current='page'] { color: #07100d; background: var(--accent); box-shadow: none; }
.operations .profile {
  min-height: 44px;
  max-width: 150px;
  align-self: auto;
  overflow: hidden;
  padding: 8px 12px;
  border: 1px solid rgba(211,237,221,.2);
  border-radius: 999px;
  color: #f3f8f4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.operations .profile:hover { background: rgba(255,255,255,.08); }

.operations .admin-layout { grid-template-columns: 244px minmax(0, 1fr); min-height: calc(100dvh - 68px); }
.operations .admin-nav {
  top: 68px;
  height: calc(100dvh - 68px);
  padding: 16px 12px 28px;
  overflow-y: auto;
  border: 0;
  background: #0d1512;
}
.admin-nav-label {
  display: block;
  margin: 16px 10px 6px;
  color: #74847a;
  font: 9px var(--mono);
  letter-spacing: .14em;
}
.admin-nav-label:first-child { margin-top: 4px; }
.operations .admin-nav button {
  min-height: 44px;
  margin: 2px 0;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  color: #bac5be;
  font-family: var(--body);
  font-size: 13px;
  letter-spacing: 0;
}
.operations .admin-nav button:hover { color: #fff; background: rgba(255,255,255,.07); }
.operations .admin-nav button.active { color: #0a120e; background: var(--accent); font-weight: 700; }

.operations .admin-main {
  width: min(1460px, 100%);
  margin: 0 auto;
  padding: clamp(24px, 3.2vw, 46px);
}
.operations .view { min-width: 0; }
.operations .view > .eyebrow { margin-bottom: 7px; color: #627068; }
.operations .admin-main h1 {
  margin-bottom: 18px;
  font-family: var(--body);
  font-size: clamp(34px, 3.7vw, 52px);
  font-weight: 760;
  line-height: 1.08;
  letter-spacing: -.045em;
}
.operations .admin-main h2 { font-family: var(--body); font-weight: 700; }
.operations .row.between { align-items: flex-end; margin-bottom: 18px; }
.operations .row.between h1 { margin-bottom: 0; }
.operations .lede { margin-bottom: 18px; color: #4d5951; font-size: 16px; line-height: 1.7; }

.operations button,
.operations .button { border-radius: 9px; font-weight: 650; }
.operations button:not(.secondary):not(.danger) { border-color: #0b120e; background: #0b120e; }
.operations button:not(.secondary):not(.danger):hover { background: #25312a; }
.operations button.secondary { border-color: #b9c3bc; background: #fff; }
.operations button.secondary:hover { background: #e9ede9; }
.operations button.danger { border-color: #dfb0aa; background: #fff7f6; color: #ad382e; }
.operations button.secondary.profile { border-color: rgba(211,237,221,.2); background: transparent; color: #f3f8f4; }
.operations button.secondary.profile:hover { background: rgba(255,255,255,.08); }
.operations .admin-nav button { background: transparent; color: #bac5be; }
.operations .admin-nav button:hover { color: #fff; background: rgba(255,255,255,.07); }
.operations .admin-nav button.active { color: #0a120e; background: var(--accent); }
.operations input,
.operations select,
.operations textarea { border-color: #cbd3cd; border-radius: 9px; background: #fbfcfa; }
.operations label { color: #5e6a62; text-transform: none; letter-spacing: .02em; }

.operations .panel,
.operations .review-card,
.operations .account-card,
.operations .place-card {
  border-color: var(--ops-line);
  border-radius: 14px;
  background: var(--ops-surface);
  box-shadow: 0 7px 22px rgba(23, 38, 29, .04);
}
.operations .panel { padding: 20px; }
.operations #metrics { gap: 12px; }
.operations .metric {
  min-height: 122px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 17px;
  border: 1px solid var(--ops-line);
  border-top: 4px solid #22bfa7;
  border-radius: 13px;
  background: #fff;
}
.operations .metric:nth-child(2) { border-top-color: var(--accent); }
.operations .metric strong { color: #152019; font: 34px/1 var(--display); }
.operations .metric span { color: var(--ops-muted); }
.admin-principle { margin-top: 18px; border-left: 4px solid var(--accent) !important; }
.admin-principle h2 { margin-bottom: 8px; }
.admin-principle p { margin-bottom: 0; max-width: 900px; color: #4d5951; }
.admin-help { margin: 10px 2px 0; }

.operations .notice { border-radius: 10px; border-left-width: 4px; box-shadow: 0 5px 16px rgba(23,38,29,.04); }
.operations .empty { min-height: 150px; border-color: #cbd4cd; border-radius: 14px; background: rgba(255,255,255,.55); }
.operations .tag { min-height: 24px; border-color: #aeb9b1; border-radius: 999px; }
.operations .tag.accent { border-color: #9ddc2f; }
.operations .review-card { padding: 18px; }
.operations .review-card pre { border-radius: 10px; background: #101713; }

.operations .table-wrap { border-color: var(--ops-line); border-radius: 14px; background: #fff; box-shadow: 0 7px 22px rgba(23,38,29,.04); }
.operations table { background: transparent; }
.operations th,
.operations td { padding: 13px 14px; border-bottom-color: #e1e6e2; }
.operations th { background: #e9eee9; color: #5d6961; }
.operations tbody tr:hover { background: #f5f8f5; }
.operations .account-list,
.operations .place-results { gap: 14px; }
.operations .account-card { padding: 18px 20px; }
.operations .account-actions { border-top-color: #dce2dd; }
.operations .place-search { margin-bottom: 18px; }
.operations .place-card { padding: 20px; }
.operations .place-rank { color: #159f8c; }
.operations .duplicate-hit { border-left-color: #22bfa7; border-radius: 0 9px 9px 0; background: #edf4ef; }
.operations dialog { overflow: hidden; border-color: var(--ops-line); border-radius: 16px; background: var(--ops-paper); }
.operations .dialog-head { border-bottom-color: var(--ops-line); background: #fff; }
.operations .credential { border-color: var(--ops-line); border-radius: 10px; }

@media (max-width: 1100px) {
  .operations .admin-layout { display: block; }
  .operations .admin-nav {
    position: sticky;
    z-index: 40;
    top: 68px;
    height: auto;
    display: flex;
    gap: 5px;
    padding: 8px 12px;
    overflow-x: auto;
    overflow-y: hidden;
    border: 0;
    border-bottom: 1px solid rgba(211,237,221,.16);
    background: #0d1512;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }
  .operations .admin-nav-label { display: none; }
  .operations .admin-nav button {
    flex: 0 0 auto;
    width: auto;
    min-width: max-content;
    min-height: 44px;
    margin: 0;
    padding: 9px 14px;
    border: 0;
  }
}

@media (max-width: 720px) {
  .operations .account-card { grid-template-columns: 1fr; }
  .operations .account-card .account-identity { grid-column: 1; }
  .operations .account-actions { grid-column: 1; }
  .operations .place-card { grid-template-columns: 1fr; }
  .operations .place-rank { display: none; }
}

@media (max-width: 600px) {
  .operations .topbar { padding: 0 12px; }
  .operations .topbar .brand { padding-top: 11px; }
  .operations .nav { order: 3; width: 100%; margin: 0; border-color: rgba(211,237,221,.16); }
  .operations .profile { max-width: 128px; margin-left: auto; }
  .operations .admin-nav { position: static; padding: 7px 10px; }
  .operations .admin-main { padding: 20px 13px 34px; }
  .operations .admin-main h1 { font-size: 34px; }
  .operations .row.between { align-items: flex-start; }
  .operations .row.between > button,
  .operations .row.between > select { min-width: 122px; }
  .operations #metrics { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .operations .metric { min-height: 106px; padding: 14px; }
  .operations .metric strong { font-size: 27px; }
  .operations .panel { padding: 16px; }
}

@media (max-width: 390px) {
  .operations #metrics { grid-template-columns: 1fr; }
  .operations .row.between > button,
  .operations .row.between > select { width: 100% !important; }
}
