:root {
  --ink: #132c3a;
  --muted: #6f818b;
  --teal: #087f8c;
  --teal-dark: #056a75;
  --teal-soft: #e8f7f9;
  --line: #dfe7ea;
  --surface: #ffffff;
  --danger: #b94747;
  --success: #138352;
  --shadow: 0 18px 50px rgba(19, 44, 58, .08);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --sidebar: 294px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: #fff; }
body { min-height: 100%; margin: 0; color: var(--ink); background: #fff; font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--teal); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(8, 127, 140, .22); outline-offset: 2px; }

.topbar, .auth-header { height: 102px; display: flex; align-items: center; justify-content: space-between; padding: 0 46px; border-bottom: 1px solid var(--line); background: #fff; position: relative; z-index: 20; }
.brand { display: inline-flex; align-items: center; gap: 14px; color: var(--ink); font-size: 21px; font-weight: 660; letter-spacing: .01em; }
.brand strong { font-size: 25px; letter-spacing: .04em; }
.brand-mark { width: 48px; height: 48px; fill: var(--teal); }
.brand-mark .brand-eye { fill: #fff; }
.brand-mark .brand-wave { fill: none; stroke: var(--teal); stroke-width: 2.4; stroke-linecap: round; }
.brand-divider { width: 1px; height: 32px; background: var(--line); margin: 0 7px; }
.topbar-actions { display: flex; align-items: center; gap: 28px; }
.user-chip { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; }
.avatar { display: inline-grid; place-items: center; width: 43px; height: 43px; border-radius: 50%; color: #fff; background: var(--avatar, var(--teal)); box-shadow: inset 0 0 0 5px rgba(255,255,255,.7), 0 0 0 1px var(--line); font-weight: 700; }
.avatar.large { width: 72px; height: 72px; font-size: 25px; }
.avatar.small { width: 42px; height: 42px; }
.portal-link { display: inline-flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 650; }
.portal-link svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app-shell { min-height: calc(100vh - 102px); display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar { position: relative; min-height: calc(100vh - 102px); padding: 40px 24px 210px; border-right: 1px solid var(--line); background: #fff; overflow: hidden; }
.sidebar nav { display: grid; gap: 8px; }
.nav-link { height: 54px; display: flex; align-items: center; gap: 17px; padding: 0 18px; border-radius: var(--radius-sm); color: var(--ink); font-size: 17px; font-weight: 570; transition: background .18s ease, color .18s ease, transform .18s ease; }
.nav-link:hover { background: #f5fafb; color: var(--teal); transform: translateX(2px); }
.nav-link.active { color: var(--teal); background: #e5f5f7; }
.nav-link svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-logout { margin: 18px; }
.text-button { border: 0; background: none; color: var(--muted); padding: 8px 0; cursor: pointer; font-size: 14px; }
.sidebar-island { position: absolute; left: 20px; right: 20px; bottom: 18px; height: 170px; opacity: .75; }
.sidebar-island svg { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; fill: none; stroke: #bce8ed; stroke-width: 5; stroke-linecap: round; }
.island-land { position: absolute; width: 150px; height: 66px; left: 42px; bottom: 44px; border-radius: 80% 55% 40% 45%; background: #d9f3f5; transform: rotate(-3deg); }
.island-sun { position: absolute; width: 34px; height: 17px; border-radius: 34px 34px 0 0; background: #ecf8f9; right: 24px; bottom: 102px; }
.island-palm { position: absolute; z-index: 2; width: 4px; height: 62px; background: #89d0d8; border-radius: 4px; bottom: 68px; left: 78px; transform: rotate(8deg); transform-origin: bottom; }
.island-palm::before { content: ""; position: absolute; width: 48px; height: 24px; left: -21px; top: -8px; border-radius: 50%; border-top: 7px solid #89d0d8; border-left: 6px solid transparent; border-right: 6px solid transparent; }
.island-palm.p2 { height: 49px; left: 120px; bottom: 62px; transform: rotate(-5deg) scale(.85); }

.main-content { min-width: 0; padding: 42px 62px 64px; }
.dashboard-head { min-height: 92px; display: flex; align-items: flex-start; justify-content: space-between; overflow: hidden; }
.dashboard-head h1, .page-title h1 { margin: 0; color: #102731; font-size: clamp(30px, 3vw, 42px); line-height: 1.18; letter-spacing: -.025em; }
.wave-stroke { display: block; width: 43px; height: 11px; margin-top: 17px; border-top: 4px solid #12a9b3; border-radius: 50%; transform: rotate(-7deg); }
.coast-silhouette { position: relative; width: 365px; height: 90px; align-self: flex-end; opacity: .8; }
.coast-hill { position: absolute; right: 26px; bottom: 0; width: 250px; height: 52px; background: #d9f3f5; border-radius: 80% 50% 0 0; clip-path: polygon(0 100%, 15% 70%, 32% 74%, 48% 20%, 65% 63%, 78% 45%, 100% 100%); }
.coast-lighthouse { position: absolute; right: 76px; bottom: 25px; width: 12px; height: 46px; background: #95d4db; clip-path: polygon(30% 0,70% 0,86% 100%,14% 100%); }
.coast-lighthouse::before { content:""; position:absolute; width:18px; height:8px; left:-3px; top:-5px; background:#73c5ce; border-radius:6px 6px 2px 2px; }
.coast-cloud { position:absolute; width:48px; height:14px; border-radius:30px; background:#edf8f9; right:35px; top:19px; }
.coast-cloud.c2 { width:62px; right:130px; top:36px; }

.wallet-hero { min-height: 137px; margin: 6px 0 25px; padding: 27px 36px; display: flex; align-items: center; justify-content: space-between; border: 1.5px solid var(--teal); border-radius: var(--radius-sm); color: var(--ink); transition: box-shadow .2s ease, transform .2s ease; }
.wallet-hero:hover { box-shadow: 0 10px 28px rgba(8,127,140,.11); transform: translateY(-1px); }
.wallet-hero small { display: block; margin-bottom: 8px; font-size: 17px; font-weight: 650; }
.wallet-hero strong { display: flex; align-items: center; gap: 14px; color: var(--teal); font-size: 54px; line-height: 1; }
.bean-symbol { width: 42px; height: 42px; display: inline-grid; place-items:center; border: 3px solid var(--teal); border-radius: 50%; font-size: 22px; }
.wallet-link { color: var(--teal); font-weight: 650; }
.wallet-link b { font-size: 28px; margin-left: 12px; vertical-align: -2px; }

.content-section { margin-top: 24px; }
.content-section h2 { margin: 0 0 11px; font-size: 19px; letter-spacing: -.01em; }
.open-list { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.list-row { min-height: 66px; display: flex; align-items: center; gap: 16px; padding: 9px 22px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.row-icon, .app-icon { flex: 0 0 auto; width: 44px; height: 44px; display: grid; place-items: center; color: var(--teal); background: var(--teal-soft); border-radius: var(--radius-sm); font-size: 20px; font-weight: 800; }
.app-icon { color: #fff; background: var(--teal); }
.row-main { min-width: 0; display: flex; flex: 1; flex-direction: column; gap: 4px; }
.row-main strong { font-size: 15px; font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main small, .settings-panel small, .profile-avatar small { display: block; color: var(--muted); font-size: 13px; line-height: 1.45; }
.amount { margin-left: auto; font-size: 19px; }
.amount.positive, .connected { color: var(--success); }
.connected { min-width: 105px; font-weight: 600; font-size: 14px; }
.outline-button, .primary-button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--teal); border-radius: 8px; padding: 0 20px; background: #fff; color: var(--teal); font-size: 14px; font-weight: 650; cursor: pointer; transition: background .18s ease, color .18s ease, transform .18s ease; }
.outline-button:hover { background: var(--teal-soft); transform: translateY(-1px); }
.primary-button { border-color: var(--teal); background: var(--teal); color: #fff; }
.primary-button:hover { background: var(--teal-dark); transform: translateY(-1px); }
.primary-button.full { width: 100%; min-height: 56px; font-size: 17px; }
button:disabled { opacity: .65; cursor: wait; transform: none !important; }
.empty-row { padding: 26px; color: var(--muted); text-align: center; }
.security-rail { min-height: 96px; display: grid; grid-template-columns: 1fr 1px 1fr; align-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.security-rail a { display: flex; align-items: center; gap: 18px; padding: 18px 30px; color: var(--ink); }
.security-rail a > span:last-child { display:flex; flex-direction:column; gap:5px; }
.security-rail small { color: var(--muted); }
.round-icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 50%; color: var(--teal); background: var(--teal-soft); font-size: 22px; }
.rail-divider { height: 48px; background: var(--line); }

.page-title { margin-bottom: 34px; }
.page-title h1 { font-size: 36px; }
.page-title p { margin: 10px 0 0; color: var(--muted); font-size: 16px; }
.wallet-summary { min-height: 144px; display: grid; grid-template-columns: repeat(3,1fr); align-items: center; margin-bottom: 28px; border: 1.5px solid var(--teal); border-radius: var(--radius-md); }
.wallet-summary > span { padding: 20px 35px; border-right: 1px solid var(--line); }
.wallet-summary > span:last-child { border-right: 0; }
.wallet-summary small { display:block; color: var(--muted); margin-bottom:8px; }
.wallet-summary strong { color: var(--teal); font-size: 38px; }
.wallet-summary .unit { font-size: 25px; }
.wide .list-row { min-height: 74px; }
.balance-after { min-width: 92px; color: var(--muted); text-align:right; }

.settings-panel { max-width: 900px; padding: 34px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; }
.profile-avatar { display:flex; align-items:center; gap:18px; padding-bottom:28px; margin-bottom:28px; border-bottom:1px solid var(--line); }
.profile-avatar > div { display:flex; flex-direction:column; gap:5px; }
.profile-avatar strong { font-size:22px; }
.form-stack { display: grid; gap: 20px; }
.form-stack.narrow { max-width: 560px; }
.form-stack label { display:grid; gap:9px; font-size:14px; font-weight:650; }
input, select, textarea { width: 100%; min-height: 48px; border: 1px solid #cfdadd; border-radius: 8px; padding: 0 14px; background:#fff; font-size:15px; font-weight:450; transition:border .18s ease, box-shadow .18s ease; }
textarea { min-height: 92px; padding-top: 12px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color:#aebfc4; }
input:focus, select:focus, textarea:focus { border-color:var(--teal); box-shadow:0 0 0 3px rgba(8,127,140,.09); outline:0; }
input:disabled { background:#f5f8f9; color:#87969c; }
.alert { margin-bottom:22px; border-radius:8px; padding:12px 14px; font-size:14px; }
.alert.error { color:#873636; background:#fff1f1; border:1px solid #f2cece; }
.alert.success { color:#176541; background:#edf9f3; border:1px solid #cbead9; }
.danger-zone { display:flex; align-items:center; justify-content:space-between; gap:20px; margin-top:30px; padding-top:25px; border-top:1px solid var(--line); }
.danger-zone > div { display:flex; flex-direction:column; gap:5px; }
.outline-button.danger { border-color:#d8a3a3; color:var(--danger); }
.large-rows .list-row { min-height:88px; }

.auth-body { overflow:hidden; }
.auth-header { height:96px; padding:0 40px; }
.auth-layout { min-height:calc(100vh - 96px); display:grid; grid-template-columns: minmax(420px,1fr) minmax(520px,1fr); }
.auth-art { min-height:calc(100vh - 96px); background:#79c9df url("/static/lighthouse-island.png") center center/cover no-repeat; }
.auth-panel { display:grid; place-items:center; padding:50px 70px; background:#fff; }
.auth-card { width:min(100%,620px); padding:70px 74px 58px; border:1px solid var(--line); border-radius:var(--radius-lg); box-shadow:var(--shadow); }
.auth-card h1 { margin:0; text-align:center; font-size:38px; letter-spacing:.02em; }
.auth-subtitle { margin:12px 0 42px; color:var(--muted); text-align:center; font-size:16px; }
.auth-card .form-stack { gap:23px; }
.password-wrap { position:relative; display:block; }
.password-wrap input { padding-right:54px; }
.password-toggle { position:absolute; right:6px; top:50%; width:42px; height:42px; transform:translateY(-50%); display:grid; place-items:center; border:0; background:transparent; color:#87969c; cursor:pointer; }
.password-toggle svg { width:22px; fill:none; stroke:currentColor; stroke-width:1.7; }
.auth-switch { margin:24px 0 42px; text-align:center; color:#546a74; }
.auth-switch a { font-weight:650; }
.security-note { display:flex; align-items:center; justify-content:center; gap:9px; margin:0; padding-top:28px; border-top:1px solid var(--line); color:#7c898f; font-size:13px; }
.security-note svg { width:20px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }

.admin-layout { margin:-42px -62px -64px; min-height:calc(100vh - 102px); display:grid; grid-template-columns:minmax(0,1fr); }
.admin-layout.with-drawer { grid-template-columns:minmax(0,1fr) 370px; }
.admin-main { padding:42px 38px 64px; min-width:0; }
.admin-title { display:flex; align-items:flex-start; justify-content:space-between; }
.admin-title a { margin-top:11px; font-weight:600; }
.search-form { width:480px; max-width:100%; position:relative; display:flex; gap:10px; margin-bottom:24px; }
.search-form svg { position:absolute; left:14px; top:14px; width:20px; fill:none; stroke:#7e8d94; stroke-width:1.8; }
.search-form input { padding-left:44px; }
.admin-table-wrap { overflow:auto; border:1px solid var(--line); border-radius:var(--radius-sm); }
.admin-table { width:100%; border-collapse:collapse; font-size:14px; }
.admin-table th { height:52px; padding:0 16px; text-align:left; white-space:nowrap; font-weight:650; background:#fbfdfd; border-bottom:1px solid var(--line); }
.admin-table td { height:79px; padding:10px 16px; border-bottom:1px solid var(--line); white-space:nowrap; }
.admin-table tr:last-child td { border-bottom:0; }
.admin-table tr.selected td { background:#eaf7f8; }
.table-user { display:flex; align-items:center; gap:11px; }
.table-user > span:last-child { display:flex; flex-direction:column; gap:3px; }
.table-user small { color:var(--muted); }
.status-dot { display:inline-block; width:8px; height:8px; margin-right:8px; border-radius:50%; background:#96a4a9; }
.status-dot.active { background:#14a066; }
.status-dot.disabled { background:#b8c0c4; }
.status-dot.pending_delete { background:#d49535; }
.admin-drawer { position:relative; padding:54px 28px 35px; border-left:1px solid var(--line); background:#fff; box-shadow:-12px 0 35px rgba(19,44,58,.05); }
.drawer-close { position:absolute; right:24px; top:18px; color:var(--ink); font-size:35px; font-weight:300; }
.drawer-user { display:flex; align-items:center; gap:16px; padding-bottom:25px; border-bottom:1px solid var(--line); }
.drawer-user h2 { margin:0 0 5px; font-size:24px; }
.drawer-user small { color:var(--muted); word-break:break-all; }
.admin-drawer section { padding:23px 0; border-bottom:1px solid var(--line); }
.admin-drawer section:last-child { border-bottom:0; }
.admin-drawer h3 { margin:0 0 15px; font-size:15px; }
.admin-drawer section > form:not(.form-stack) { display:flex; gap:10px; }
.current-balance { display:flex; justify-content:space-between; color:var(--muted); font-size:14px; }
.current-balance strong { color:var(--teal); }

@media (max-width: 1050px) {
  :root { --sidebar: 230px; }
  .topbar { padding:0 25px; }
  .main-content { padding:36px 32px 55px; }
  .coast-silhouette { width:260px; }
  .auth-layout { grid-template-columns: 42% 58%; }
  .auth-art { background-position:40% 42%; }
  .auth-panel { padding:40px; }
  .auth-card { padding:48px 45px; }
  .admin-layout { margin:-36px -32px -55px; }
  .admin-layout.with-drawer { grid-template-columns:minmax(0,1fr) 340px; }
}

@media (max-width: 760px) {
  .topbar, .auth-header { height:76px; padding:0 16px; }
  .brand { gap:8px; font-size:15px; }
  .brand strong { font-size:18px; }
  .brand-mark { width:38px; height:38px; }
  .brand-divider { height:24px; margin:0 3px; }
  .topbar-actions { gap:12px; }
  .portal-link { font-size:0; }
  .portal-link svg { width:23px; }
  .user-chip > span:last-child { display:none; }
  .app-shell { min-height:calc(100vh - 76px); display:block; }
  .sidebar { position:fixed; z-index:30; left:0; right:0; bottom:0; min-height:0; height:72px; padding:8px 10px max(8px,env(safe-area-inset-bottom)); border:0; border-top:1px solid var(--line); overflow:visible; }
  .sidebar nav { display:grid; grid-template-columns:repeat(6,1fr); gap:2px; }
  .nav-link { height:54px; display:flex; flex-direction:column; justify-content:center; gap:3px; padding:0; font-size:10px; border-radius:8px; }
  .nav-link svg { width:22px; height:22px; }
  .nav-link:nth-child(n+7), .sidebar-logout, .sidebar-island { display:none; }
  .main-content { padding:28px 16px 105px; }
  .dashboard-head { min-height:74px; }
  .dashboard-head h1, .page-title h1 { font-size:28px; }
  .coast-silhouette { display:none; }
  .wallet-hero { min-height:118px; padding:22px; }
  .wallet-hero strong { font-size:43px; }
  .wallet-link { font-size:13px; }
  .list-row { padding:10px 13px; gap:10px; }
  .row-icon, .app-icon { width:39px; height:39px; }
  .connected { display:none; }
  .outline-button { padding:0 12px; }
  .security-rail { grid-template-columns:1fr; }
  .rail-divider { width:auto; height:1px; }
  .security-rail a { padding:17px; }
  .wallet-summary { grid-template-columns:1fr 1fr; }
  .wallet-summary > span { padding:18px; }
  .wallet-summary > span:nth-child(2) { border-right:0; }
  .wallet-summary > span:last-child { grid-column:1/-1; border-top:1px solid var(--line); }
  .settings-panel { padding:22px 18px; }
  .auth-body { overflow:auto; }
  .auth-header .brand-divider, .auth-header .brand span:last-child { display:none; }
  .auth-layout { min-height:calc(100vh - 76px); display:block; }
  .auth-art {
    min-height:180px;
    height:clamp(180px,26vh,240px);
    background-position:38% 29%;
  }
  .auth-panel { padding:24px 16px 45px; }
  .auth-card { padding:32px 22px 28px; box-shadow:none; }
  .auth-card h1 { font-size:29px; }
  .auth-subtitle { margin-bottom:30px; }
  .admin-layout, .admin-layout.with-drawer { margin:-28px -16px -105px; display:block; }
  .admin-main { padding:28px 16px 100px; }
  .admin-title a { display:none; }
  .admin-drawer { position:fixed; z-index:40; inset:76px 0 0; overflow:auto; border:0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior:auto !important; animation-duration:.001ms !important; transition-duration:.001ms !important; }
}
