:root {
  color: #141310;
  background: #f2f0e9;
  font-family: Inter, Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  --ink: #11100d;
  --paper: #f2f0e9;
  --panel: #fbfaf6;
  --line: #d8d4c8;
  --muted: #757168;
  --red: #a33c32;
  --green: #477b5a;
  --amber: #a8732f;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--paper); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.noise { position: fixed; inset: 0; pointer-events: none; opacity: .19; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.08'/%3E%3C/svg%3E"); }

.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-seal { width: 36px; height: 36px; display: grid; place-items: center; color: #fff; background: var(--ink); font: 500 18px/1 Georgia, "Songti SC", serif; }
.brand-lockup strong, .brand-lockup small { display: block; }
.brand-lockup strong { font: 500 20px/1.1 Georgia, "Songti SC", serif; letter-spacing: -.05em; }
.brand-lockup small { margin-top: 4px; color: var(--muted); font: 700 8px/1 monospace; letter-spacing: .13em; }
.eyebrow { color: var(--muted); font: 700 9px/1 monospace; letter-spacing: .17em; }

.login-shell { position: relative; z-index: 1; width: min(1060px, calc(100% - 32px)); min-height: 660px; margin: max(24px, 6vh) auto; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr); overflow: hidden; border: 1px solid #cbc6b8; border-radius: 30px; background: var(--panel); box-shadow: 0 28px 90px rgba(40, 35, 25, .1); }
.login-panel { display: flex; flex-direction: column; padding: 42px 50px 32px; }
.login-copy { margin: auto 0 35px; }
.login-copy h1 { margin: 18px 0 16px; font: 400 clamp(52px, 7vw, 86px)/.94 Georgia, "Songti SC", serif; letter-spacing: -.075em; }
.login-copy p { max-width: 420px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.75; }
.login-form { max-width: 430px; }
.login-form > label, .stack-form label, .modal-field label { display: grid; gap: 8px; color: #4f4b43; font-size: 10px; font-weight: 700; }
.password-field { display: flex; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.password-field:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(17, 16, 13, .05); }
.password-field input { min-width: 0; flex: 1; border: 0; outline: 0; padding: 14px 15px; color: var(--ink); background: transparent; }
.text-action { border: 0; padding: 0 14px; color: var(--muted); background: transparent; font-size: 10px; font-weight: 700; }
.form-error { min-height: 20px; margin: 10px 2px 0; color: var(--red); font-size: 10px; }
.login-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 28px; }
.login-foot span, .panel-tag { padding: 6px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font: 700 7px/1 monospace; letter-spacing: .08em; }
.login-art { position: relative; overflow: hidden; background: var(--ink); }
.login-art::before { content: ""; position: absolute; inset: 0; opacity: .3; background-image: linear-gradient(rgba(255,255,255,.09) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.09) 1px, transparent 1px); background-size: 42px 42px; mask-image: radial-gradient(circle at 58% 47%, #000, transparent 68%); }
.orb { position: absolute; left: 50%; top: 50%; border: 1px solid rgba(255,255,255,.32); border-radius: 50%; transform: translate(-50%,-50%); }
.orb-one { width: 330px; height: 330px; }
.orb-two { width: 420px; height: 145px; transform: translate(-50%,-50%) rotate(18deg); }
.orb-three { width: 145px; height: 420px; transform: translate(-50%,-50%) rotate(-18deg); }
.orb-one::after { content: ""; position: absolute; right: 36px; top: 52px; width: 11px; height: 11px; border-radius: 50%; background: #d28a62; box-shadow: -197px 156px 0 #67a47c, -105px 12px 0 #78a5bd; }
.art-label { position: absolute; right: 35px; bottom: 32px; color: #f7f3e9; text-align: right; font: 700 42px/.86 monospace; letter-spacing: -.08em; opacity: .92; }

.dashboard { position: relative; z-index: 1; width: min(1240px, calc(100% - 32px)); margin: 0 auto; padding-bottom: 36px; }
.topbar { min-height: 86px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.live-pill { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; border: 1px solid #bfd0c3; border-radius: 999px; color: var(--green); background: #edf3ee; font-size: 9px; font-weight: 700; }
.live-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(71,123,90,.11); }
.icon-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: transparent; font-size: 19px; }
.icon-button:hover { color: #fff; background: var(--ink); }
.button { border: 1px solid transparent; border-radius: 999px; padding: 11px 17px; font-size: 10px; font-weight: 700; transition: transform .15s, background .15s; }
.button:active { transform: translateY(1px); }
.button:disabled { cursor: wait; opacity: .45; }
.button-dark { color: #fff; background: var(--ink); }
.button-dark:hover { background: #34312b; }
.button-light { border-color: var(--line); color: var(--ink); background: #fff; }
.button-light:hover { border-color: var(--ink); }
.button.full { width: 100%; display: flex; align-items: center; justify-content: center; gap: 14px; padding-block: 14px; }
.button span { font-size: 15px; font-weight: 400; }

.hero-grid { min-height: 260px; display: grid; grid-template-columns: 1fr 270px; align-items: center; border-bottom: 1px solid var(--line); }
.hero-copy h1 { margin: 15px 0 12px; font: 400 clamp(54px, 7vw, 88px)/.95 Georgia, "Songti SC", serif; letter-spacing: -.075em; }
.hero-copy p { max-width: 520px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.hero-mark { position: relative; width: 190px; height: 190px; place-self: center; display: grid; place-items: center; border: 1px dotted #a8a397; border-radius: 50%; }
.hero-mark::before, .hero-mark::after { content: ""; position: absolute; inset: 31px -27px; border: 1px solid #c1bbae; border-radius: 50%; transform: rotate(23deg); }
.hero-mark::after { inset: -27px 56px; transform: rotate(-23deg); }
.hero-mark span { font: 500 58px/1 Georgia, serif; }
.hero-mark i { position: absolute; left: 25px; top: 61px; width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 112px 70px 0 var(--green); }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 20px 0 12px; }
.summary-card { min-height: 132px; padding: 20px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); }
.summary-card span { color: var(--muted); font: 700 8px/1 monospace; letter-spacing: .12em; }
.summary-card strong { display: block; margin-top: 24px; font: 400 34px/1 Georgia, serif; }
.summary-card small { display: block; margin-top: 8px; color: #8b867c; font-size: 9px; }
.summary-card.dark { color: #fff; background: var(--ink); border-color: var(--ink); }
.summary-card.dark span, .summary-card.dark small { color: #aaa69c; }

.workspace-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 12px; margin-bottom: 12px; }
.panel { padding: 22px; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.panel-head > div { display: flex; align-items: center; gap: 10px; }
.panel-head h2 { margin: 0; font-size: 16px; letter-spacing: -.025em; }
.section-index { color: #918c82; font: 700 9px/1 monospace; }
.panel-tag.green { border-color: #bfd0c3; color: var(--green); background: #edf3ee; }
.stack-form { display: grid; gap: 14px; }
.stack-form input, .stack-form select, .modal-field input, .modal-field select, .member-tools input, .member-tools select { width: 100%; border: 1px solid var(--line); border-radius: 12px; outline: 0; padding: 12px 13px; color: var(--ink); background: #fff; font-size: 11px; }
.stack-form input:focus, .stack-form select:focus, .modal-field input:focus, .modal-field select:focus, .member-tools input:focus, .member-tools select:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(17,16,13,.04); }
.form-pair { display: grid; grid-template-columns: 1fr 160px; gap: 10px; }
.usage-details { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.usage-stat { padding: 14px; border: 1px solid #dfdbd0; border-radius: 15px; background: #f6f4ee; }
.usage-stat strong, .usage-stat span { display: block; }
.usage-stat strong { font: 500 23px/1 Georgia, serif; }
.usage-stat span { margin-top: 7px; color: var(--muted); font-size: 8px; }
.billing-rule { margin-top: 14px; padding: 14px; border-radius: 15px; color: #d9d5cb; background: var(--ink); }
.billing-rule span { font: 700 8px/1 monospace; letter-spacing: .1em; }
.billing-rule p { margin: 9px 0 0; font-size: 9px; line-height: 1.7; }

.members-panel { min-height: 320px; }
.members-head { align-items: flex-end; }
.count-label { color: var(--muted); font-size: 9px; }
.member-tools { display: flex; align-items: center; gap: 8px; }
.search-field { position: relative; width: 230px; }
.search-field span { position: absolute; z-index: 1; left: 12px; top: 10px; color: var(--muted); font-size: 16px; }
.search-field input { padding-left: 34px; }
.member-tools select { width: 110px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 11px 12px; border-bottom: 1px solid var(--line); color: var(--muted); text-align: left; font: 700 8px/1 monospace; letter-spacing: .08em; }
td { padding: 15px 12px; border-bottom: 1px solid #e4e0d6; font-size: 10px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.member-cell strong, .member-cell span { display: block; }
.member-cell strong { font-size: 11px; }
.member-cell span { margin-top: 4px; color: var(--muted); font-size: 9px; }
.plan-chip, .status-chip { display: inline-flex; padding: 6px 8px; border-radius: 999px; font: 700 8px/1 monospace; }
.plan-chip { border: 1px solid #d4c7b4; color: #795a34; background: #f7f1e7; }
.plan-cell { min-width: 145px; }
.plan-expiry { display: block; margin-top: 6px; color: var(--muted); font-size: 8px; white-space: nowrap; }
.status-chip.active { color: var(--green); background: #eaf2ec; }
.status-chip.suspended { color: var(--red); background: #f5e9e7; }
.status-chip.payment-fulfilled { color: var(--green); background: #eaf2ec; }
.status-chip.payment-created, .status-chip.payment-pending { color: #795a34; background: #f7f1e7; }
.status-chip.payment-failed { color: var(--red); background: #f5e9e7; }
.credits-cell { font: 500 17px/1 Georgia, serif; }
.date-cell { color: var(--muted); white-space: nowrap; }
.row-actions { display: flex; justify-content: flex-end; gap: 5px; }
.row-action { border: 1px solid var(--line); border-radius: 999px; padding: 7px 9px; color: #4e4a43; background: #fff; font-size: 8px; font-weight: 700; white-space: nowrap; }
.row-action:hover { border-color: var(--ink); color: #fff; background: var(--ink); }
.row-action.danger:hover { border-color: var(--red); background: var(--red); }
.empty-state { padding: 52px 20px; color: var(--muted); text-align: center; font-size: 11px; }
.orders-panel { margin-top: 12px; }
.payment-summary { display: flex; align-items: center; justify-content: flex-end; gap: 8px; color: var(--muted); font-size: 9px; }
.payment-summary span { padding: 6px 8px; border-radius: 999px; color: var(--red); background: #f5e9e7; font: 700 8px/1 monospace; }
.payment-summary span.configured { color: var(--green); background: #eaf2ec; }
.payment-summary strong { color: var(--ink); font: 500 14px/1 Georgia, serif; }
.payment-summary small { font-size: 9px; }
.order-audit-note { margin: 16px 4px 0; color: var(--muted); font-size: 9px; line-height: 1.65; }
footer { display: flex; justify-content: space-between; padding: 22px 4px; color: var(--muted); font: 700 8px/1 monospace; letter-spacing: .09em; }

.modal { width: min(440px, calc(100% - 28px)); border: 1px solid #cfc9bb; border-radius: 24px; padding: 0; color: var(--ink); background: var(--panel); box-shadow: 0 30px 100px rgba(17,16,13,.24); }
.modal::backdrop { background: rgba(20,18,14,.52); backdrop-filter: blur(5px); }
.modal > form, .modal > div { position: relative; padding: 30px; }
.modal-close { position: absolute; right: 18px; top: 16px; width: 32px; height: 32px; border: 0; border-radius: 50%; color: var(--muted); background: #efede6; font-size: 19px; }
.modal h2 { margin: 15px 0 8px; font: 500 29px/1.05 Georgia, "Songti SC", serif; }
.modal-description { margin: 0 0 20px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.modal-field small { display: block; margin-top: 8px; color: var(--muted); font-size: 9px; line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.credential-card { margin: 18px 0; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.credential-card div { display: grid; grid-template-columns: 92px 1fr; padding: 13px 15px; border-bottom: 1px solid var(--line); }
.credential-card div:last-child { border-bottom: 0; }
.credential-card dt { color: var(--muted); font-size: 9px; }
.credential-card dd { margin: 0; font: 700 11px/1.3 monospace; overflow-wrap: anywhere; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 24px; min-width: 220px; max-width: calc(100% - 32px); padding: 13px 18px; border-radius: 999px; color: #fff; background: var(--ink); box-shadow: 0 12px 36px rgba(0,0,0,.2); text-align: center; font-size: 10px; opacity: 0; pointer-events: none; transform: translate(-50%, 18px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--red); }

@media (max-width: 820px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-panel { min-height: 650px; padding: 32px; }
  .hero-grid { grid-template-columns: 1fr; min-height: 260px; }
  .hero-mark { display: none; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .workspace-grid { grid-template-columns: 1fr; }
  .members-head { align-items: stretch; flex-direction: column; }
  .payment-summary { align-items: flex-start; justify-content: flex-start; flex-wrap: wrap; }
  .member-tools, .search-field { width: 100%; }
  .member-tools select { width: 120px; }
}

@media (max-width: 560px) {
  .dashboard { width: min(100% - 20px, 1240px); }
  .topbar { min-height: 74px; }
  .live-pill { display: none; }
  .hero-copy h1 { font-size: 52px; }
  .summary-grid { gap: 8px; }
  .summary-card { min-height: 112px; padding: 16px; }
  .summary-card strong { margin-top: 18px; font-size: 28px; }
  .panel { padding: 17px; border-radius: 18px; }
  .form-pair { grid-template-columns: 1fr; }
  .member-tools { align-items: stretch; flex-direction: column; }
  .member-tools select { width: 100%; }
  th:nth-child(2), td:nth-child(2), th:nth-child(5), td:nth-child(5) { display: none; }
  .row-actions { min-width: 145px; flex-wrap: wrap; }
  footer { gap: 14px; flex-direction: column; }
}
