:root {
  color-scheme: dark;
  --bg: #080d0b;
  --bg-soft: #0b120e;
  --panel: #0f1713;
  --panel-2: #121d17;
  --panel-3: #16231c;
  --border: #1f2d26;
  --border-strong: #2b4035;
  --text: #e8f1ec;
  --muted: #93a79d;
  --dim: #64776d;
  --green: #5ee08a;
  --green-strong: #3cc96f;
  --lime: #b6f36a;
  --green-ink: #06210f;
  --amber: #f0c45a;
  --red: #ff7373;
  --blue: #6cb8ff;
  --violet: #b69cff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px -24px rgba(0, 0, 0, 0.8);
  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: "SFMono-Regular", "Cascadia Mono", "Roboto Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  min-height: 100vh;
  background:
    radial-gradient(900px 600px at 8% -10%, rgba(94, 224, 138, 0.07), transparent 60%),
    radial-gradient(700px 500px at 100% 0%, rgba(108, 184, 255, 0.05), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
::selection { background: rgba(94, 224, 138, 0.28); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #25352c; border-radius: 20px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #345043; }

.icon { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: -3px; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
.mono { font-family: var(--mono); font-variant-ligatures: none; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.tiny { font-size: 12px; }
.small { font-size: 13px; }
.strong { font-weight: 650; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.col { display: flex; flex-direction: column; gap: 10px; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.hidden { display: none !important; }

/* ---------- boot ---------- */
.boot-screen {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--bg); transition: opacity .35s ease, visibility .35s ease;
}
.boot-screen.is-gone { opacity: 0; visibility: hidden; }
.boot-mark { color: var(--lime); filter: drop-shadow(0 0 18px rgba(182, 243, 106, .25)); }
.boot-word { font-weight: 700; letter-spacing: .34em; font-size: 13px; color: #cfe3d7; text-transform: uppercase; }
.boot-bar { width: 120px; height: 2px; background: #17221c; overflow: hidden; border-radius: 2px; }
.boot-bar span { display: block; width: 40%; height: 100%; background: linear-gradient(90deg, transparent, var(--lime), transparent); animation: boot-slide 1.2s ease-in-out infinite; }
@keyframes boot-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }

/* ---------- auth ---------- */
.auth-shell {
  min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(420px, .92fr);
}
.auth-visual {
  position: relative; overflow: hidden; padding: 56px clamp(36px, 6vw, 96px);
  display: flex; flex-direction: column; justify-content: space-between;
  border-right: 1px solid var(--border);
  background:
    radial-gradient(600px 500px at 12% 8%, rgba(94, 224, 138, .12), transparent 60%),
    radial-gradient(700px 600px at 80% 100%, rgba(108, 184, 255, .08), transparent 60%),
    #0a110d;
}
.auth-visual::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(94, 224, 138, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(94, 224, 138, .045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(700px 600px at 30% 20%, #000 20%, transparent 75%);
}
.auth-brand { position: relative; display: flex; align-items: center; gap: 11px; }
.auth-brand .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
.auth-brand-word { font-weight: 750; letter-spacing: .02em; font-size: 17px; }
.auth-brand-word span { color: var(--green); }
.auth-hero { position: relative; max-width: 560px; margin-top: 40px; }
.auth-eyebrow { color: var(--lime); font-size: 12px; font-weight: 650; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 18px; }
.auth-hero h1 { font-size: clamp(34px, 4.3vw, 58px); line-height: 1.08; letter-spacing: -.035em; margin: 0 0 20px; font-weight: 720; }
.auth-hero h1 em { font-style: normal; color: var(--lime); }
.auth-hero p { color: var(--muted); font-size: 15px; line-height: 1.75; max-width: 500px; margin: 0; }
.auth-features { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; margin-top: 42px; max-width: 540px; }
.auth-feature { display: flex; align-items: center; gap: 9px; color: #bfd0c6; font-size: 13px; }
.auth-feature .icon { color: var(--green); }
.auth-foot { position: relative; color: var(--dim); font-size: 12px; display: flex; gap: 18px; flex-wrap: wrap; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 26px; background: rgba(8, 13, 11, .55); }
.auth-card { width: min(420px, 100%); }
.auth-card h2 { font-size: 27px; letter-spacing: -.02em; margin: 0 0 8px; font-weight: 700; }
.auth-card .auth-sub { color: var(--muted); margin: 0 0 28px; font-size: 14px; }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-switch { margin-top: 22px; color: var(--muted); font-size: 13px; text-align: center; }
.auth-switch a { color: var(--green); font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }
.auth-alert { padding: 11px 13px; border: 1px solid rgba(240, 196, 90, .3); background: rgba(240, 196, 90, .08); color: #f4d58e; border-radius: 10px; font-size: 13px; }
.term {
  position: relative; margin-top: 34px; max-width: 540px; border: 1px solid var(--border); border-radius: 12px;
  background: rgba(6, 10, 8, .75); overflow: hidden; box-shadow: var(--shadow);
}
.term-head { display: flex; align-items: center; gap: 6px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.term-dot { width: 7px; height: 7px; border-radius: 50%; background: #2a3a31; }
.term-title { margin-left: 6px; color: var(--dim); font-size: 11px; font-family: var(--mono); }
.term-body { padding: 14px 16px; font-family: var(--mono); font-size: 12px; line-height: 1.75; color: #a9c6b5; overflow-x: auto; }
.term-body .cmd { color: var(--lime); }
.term-body .ok { color: var(--green); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--border);
  background: rgba(10, 16, 13, .92); backdrop-filter: blur(12px); z-index: 30;
}
.sidebar-inner { height: 100%; display: flex; flex-direction: column; padding: 18px 14px 14px; gap: 16px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 0; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(145deg, #1b2b22, #0e1712); border: 1px solid #2a4034; color: var(--lime);
  box-shadow: inset 0 0 0 1px rgba(182, 243, 106, .05), 0 8px 22px -12px rgba(0, 0, 0, .9);
}
.brand-word { font-weight: 750; font-size: 16px; letter-spacing: .01em; line-height: 1.1; }
.brand-word span { color: var(--green); }
.brand-sub { color: var(--dim); font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase; margin-top: 2px; }
.farm-switch { position: relative; }
.farm-switch-btn {
  width: 100%; display: flex; align-items: center; gap: 9px; padding: 10px 10px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--panel); text-align: left; transition: border-color .15s, background .15s;
}
.farm-switch-btn:hover { border-color: var(--border-strong); background: var(--panel-2); }
.farm-switch-btn .farm-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: rgba(94, 224, 138, .09); color: var(--green); flex: none; }
.farm-switch-meta { min-width: 0; flex: 1; }
.farm-switch-name { font-size: 12.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.farm-switch-role { color: var(--dim); font-size: 10.5px; margin-top: 1px; }
.farm-switch-btn .chev { color: var(--dim); transition: transform .15s; }
.farm-switch.open .chev { transform: rotate(180deg); }
.farm-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40; padding: 5px; border-radius: 11px;
  border: 1px solid var(--border-strong); background: #0d1511; box-shadow: var(--shadow); max-height: 320px; overflow-y: auto;
}
.farm-menu-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 9px; border: 0; background: transparent; border-radius: 7px; text-align: left; color: var(--muted); font-size: 12.5px; }
.farm-menu-item:hover, .farm-menu-item.active { background: var(--panel-2); color: var(--text); }
.farm-menu-item .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex: none; }
.farm-menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { color: #52645a; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; padding: 7px 9px 4px; font-weight: 650; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 9px; border-radius: 8px; color: #93a79d;
  font-size: 12.8px; border: 1px solid transparent; transition: .14s; position: relative;
}
.nav-item .icon { width: 16px; height: 16px; color: #6f8579; }
.nav-item:hover { background: rgba(255, 255, 255, .025); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(94, 224, 138, .12), rgba(94, 224, 138, .03)); color: #dff6e6; border-color: rgba(94, 224, 138, .14); }
.nav-item.active .icon { color: var(--green); }
.nav-item.active::before { content: ""; position: absolute; left: -14px; top: 7px; bottom: 7px; width: 2px; background: var(--green); border-radius: 0 2px 2px 0; box-shadow: 0 0 12px var(--green); }
.nav-badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; display: grid; place-items: center; border-radius: 20px; font-size: 10px; font-weight: 700; color: var(--green-ink); background: var(--lime); }
.nav-badge.muted-badge { background: #23342b; color: var(--muted); }
.sidebar-spacer { flex: 1; }
.sidebar-foot { border-top: 1px solid var(--border); padding-top: 12px; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 9px; }
.user-chip:hover { background: rgba(255, 255, 255, .03); }
.avatar { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(145deg, #28412f, #17251c); border: 1px solid #33493a; display: grid; place-items: center; font-weight: 700; font-size: 11px; color: #c8f5d6; flex: none; }
.user-meta { min-width: 0; flex: 1; }
.user-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.user-email { color: var(--dim); font-size: 10px; overflow: hidden; text-overflow: ellipsis; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: 62px; display: flex; align-items: center; gap: 14px;
  padding: 0 28px; border-bottom: 1px solid var(--border); background: rgba(8, 13, 11, .82); backdrop-filter: blur(14px);
}
.mobile-menu-btn { display: none; }
.crumb { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--dim); font-size: 12.5px; }
.crumb .sep { color: #3c4f44; }
.crumb .here { color: var(--text); font-weight: 600; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar .btn { height: 32px; }
.page { padding: 28px 30px 70px; width: 100%; max-width: 1560px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.eyebrow { color: var(--green); font-size: 10.5px; font-weight: 700; letter-spacing: .17em; text-transform: uppercase; margin-bottom: 8px; }
.page-title { margin: 0; font-size: 26px; letter-spacing: -.025em; font-weight: 720; line-height: 1.2; }
.page-sub { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 13px;
  border-radius: 9px; border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--text);
  font-size: 12.8px; font-weight: 600; white-space: nowrap; transition: .14s; user-select: none;
}
.btn:hover { background: var(--panel-3); border-color: #385144; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn .icon { width: 15px; height: 15px; }
.btn-primary { background: linear-gradient(180deg, #7ceb9f, var(--green)); border-color: #6ee394; color: var(--green-ink); box-shadow: 0 8px 20px -12px rgba(94, 224, 138, .8); }
.btn-primary:hover { background: linear-gradient(180deg, #8bf3ae, #65e691); border-color: #8bf3ae; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: rgba(255, 255, 255, .04); color: var(--text); }
.btn-danger { background: rgba(255, 115, 115, .08); border-color: rgba(255, 115, 115, .25); color: #ff9a9a; }
.btn-danger:hover { background: rgba(255, 115, 115, .14); border-color: rgba(255, 115, 115, .4); }
.btn-sm { height: 29px; padding: 0 10px; font-size: 11.8px; border-radius: 7px; }
.btn-sm .icon { width: 13px; height: 13px; }
.btn-lg { height: 43px; padding: 0 18px; font-size: 13.5px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; height: 34px; padding: 0; }
.btn-icon.btn-sm { width: 29px; height: 29px; }
.btn-group { display: flex; gap: 7px; flex-wrap: wrap; }
.link { color: var(--green); font-weight: 600; }
.link:hover { text-decoration: underline; }
.link-muted { color: var(--muted); }
.link-muted:hover { color: var(--text); }

/* ---------- stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card {
  position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(18, 29, 23, .9), rgba(13, 21, 16, .9)); padding: 15px 16px 14px;
}
.stat-card::after { content: ""; position: absolute; inset: 0 0 auto; height: 1px; background: linear-gradient(90deg, transparent, rgba(94, 224, 138, .25), transparent); opacity: .5; }
.stat-label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11.5px; margin-bottom: 8px; }
.stat-label .icon { width: 13px; height: 13px; color: #6f8b7b; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; font-family: var(--mono); }
.stat-value .unit { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 4px; letter-spacing: 0; }
.stat-foot { margin-top: 8px; display: flex; align-items: center; gap: 6px; color: var(--dim); font-size: 11px; }
.stat-foot .up { color: var(--green); }
.stat-foot .down { color: var(--red); }
.stat-spark { position: absolute; right: 10px; bottom: 8px; opacity: .5; }

/* ---------- panels ---------- */
.panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); box-shadow: 0 1px 0 rgba(255,255,255,.015) inset; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.panel-title { font-size: 13.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.panel-title .icon { color: #7d9a89; width: 16px; height: 16px; }
.panel-sub { color: var(--dim); font-size: 11.5px; margin-top: 2px; }
.panel-actions { display: flex; align-items: center; gap: 7px; }
.panel-body { padding: 16px; }
.panel-flush { padding: 0; }
.panel + .panel { margin-top: 14px; }
.split { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, .8fr); gap: 14px; }
.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ---------- farm cards ---------- */
.farm-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.farm-card {
  position: relative; border: 1px solid var(--border); border-radius: var(--radius); padding: 17px; background: var(--panel);
  display: flex; flex-direction: column; gap: 15px; transition: .16s; overflow: hidden;
}
.farm-card:hover { border-color: #33503f; transform: translateY(-1px); box-shadow: var(--shadow); }
.farm-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--green); opacity: .5; }
.farm-card-head { display: flex; align-items: flex-start; gap: 10px; }
.farm-card-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(94, 224, 138, .08); color: var(--green); border: 1px solid rgba(94, 224, 138, .1); }
.farm-card-name { font-size: 14.5px; font-weight: 650; line-height: 1.3; }
.farm-card-owner { color: var(--dim); font-size: 11px; margin-top: 2px; }
.farm-card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding-top: 2px; }
.mini-stat .k { color: var(--dim); font-size: 10px; margin-bottom: 2px; }
.mini-stat .v { font-family: var(--mono); font-size: 15px; font-weight: 650; }
.farm-card-foot { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 11px; margin-top: auto; }
.farm-card-foot .arrow { color: var(--dim); transition: .15s; }
.farm-card:hover .farm-card-foot .arrow { color: var(--green); transform: translateX(2px); }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 12.7px; }
.table th {
  text-align: left; padding: 10px 12px; color: var(--dim); font-size: 10.5px; font-weight: 650;
  letter-spacing: .08em; text-transform: uppercase; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 11px 12px; border-bottom: 1px solid rgba(31, 45, 38, .55); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: rgba(255, 255, 255, .018); }
.table-click tbody tr { cursor: pointer; }
.table .actions { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }
.table .checkbox-cell { width: 34px; }
.table-empty { padding: 42px 20px; text-align: center; color: var(--muted); }
.rig-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rig-avatar { width: 30px; height: 30px; border-radius: 8px; background: #142019; border: 1px solid #24362c; display: grid; place-items: center; color: #8fb8a2; flex: none; }
.rig-name { font-weight: 600; font-size: 12.8px; }
.rig-meta { color: var(--dim); font-size: 10.5px; margin-top: 1px; }
.gpu-tag { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 11px; }

/* status */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.status .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); }
.status.online { color: #8be6ab; } .status.online .dot { background: var(--green); box-shadow: 0 0 0 3px rgba(94, 224, 138, .12); animation: pulse 2.4s infinite; }
.status.offline { color: #ff9c9c; } .status.offline .dot { background: var(--red); }
.status.never { color: var(--dim); } .status.never .dot { background: #4c5f53; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 2px rgba(94, 224, 138, .16); } 50% { box-shadow: 0 0 0 5px rgba(94, 224, 138, .02); } }
.badge { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 6px; background: #1b2a21; color: var(--muted); font-size: 10.5px; font-weight: 600; white-space: nowrap; }
.badge.green { background: rgba(94, 224, 138, .1); color: #8be6ab; }
.badge.amber { background: rgba(240, 196, 90, .1); color: #f5d68c; }
.badge.red { background: rgba(255, 115, 115, .1); color: #ff9f9f; }
.badge.blue { background: rgba(108, 184, 255, .1); color: #a6d4ff; }
.badge.violet { background: rgba(182, 156, 255, .1); color: #d2c1ff; }
.role { display: inline-flex; align-items: center; height: 19px; padding: 0 7px; border-radius: 5px; font-size: 10px; font-weight: 650; border: 1px solid transparent; }
.role.owner { color: #ffe0a3; background: rgba(240, 196, 90, .09); border-color: rgba(240, 196, 90, .18); }
.role.admin { color: #d2c1ff; background: rgba(182, 156, 255, .09); border-color: rgba(182, 156, 255, .18); }
.role.operator { color: #a6d4ff; background: rgba(108, 184, 255, .09); border-color: rgba(108, 184, 255, .18); }
.role.viewer { color: var(--muted); background: #17221c; border-color: #26362c; }

/* chart */
.chart-box { position: relative; width: 100%; height: 210px; }
.chart-box canvas { display: block; width: 100%; height: 100%; }
.chart-legend { display: flex; align-items: center; gap: 16px; color: var(--dim); font-size: 11px; }
.chart-legend .key { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend .swatch { width: 14px; height: 2px; border-radius: 2px; background: var(--green); }
.chart-tip { position: absolute; pointer-events: none; padding: 6px 8px; border-radius: 7px; background: #0b120e; border: 1px solid var(--border-strong); font-size: 11px; box-shadow: var(--shadow); transform: translate(-50%, -120%); white-space: nowrap; opacity: 0; transition: opacity .1s; }
.chart-tip.show { opacity: 1; }

/* alerts */
.alert-list { display: flex; flex-direction: column; gap: 6px; }
.alert-item { display: flex; align-items: flex-start; gap: 9px; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--border); background: rgba(255, 255, 255, .015); font-size: 12px; }
.alert-item .icon { margin-top: 1px; width: 14px; height: 14px; }
.alert-item.critical { border-color: rgba(255, 115, 115, .18); background: rgba(255, 115, 115, .045); }
.alert-item.critical .icon { color: var(--red); }
.alert-item.warning { border-color: rgba(240, 196, 90, .18); background: rgba(240, 196, 90, .04); }
.alert-item.warning .icon { color: var(--amber); }
.alert-item.info .icon { color: var(--blue); }
.alert-item .alert-msg { color: #c9d8cf; }
.alert-item .alert-rig { color: var(--dim); font-size: 10.5px; margin-top: 1px; }

/* forms */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { color: #b9cbc0; font-size: 11.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.field label .req { color: var(--green); }
.input, select.input, textarea.input {
  width: 100%; min-height: 36px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-strong);
  background: #0b130f; color: var(--text); outline: none; transition: border-color .14s, box-shadow .14s; font-size: 12.8px;
}
.input::placeholder { color: #52645a; }
.input:focus, select.input:focus, textarea.input:focus { border-color: rgba(94, 224, 138, .55); box-shadow: 0 0 0 3px rgba(94, 224, 138, .08); }
.input:disabled { opacity: .55; }
textarea.input { min-height: 92px; resize: vertical; line-height: 1.6; font-family: var(--mono); font-size: 12px; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #789085 50%), linear-gradient(135deg, #789085 50%, transparent 50%); background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.field .help { color: var(--dim); font-size: 10.8px; line-height: 1.5; }
.field .help code, code.inline { font-family: var(--mono); color: #b9dc9a; background: rgba(182, 243, 106, .07); padding: 1px 4px; border-radius: 4px; font-size: 10.5px; }
.field-error { color: #ff9c9c; font-size: 11px; }
.form-error { padding: 9px 11px; border-radius: 8px; border: 1px solid rgba(255, 115, 115, .22); background: rgba(255, 115, 115, .06); color: #ffb1b1; font-size: 12px; }
.form-ok { padding: 9px 11px; border-radius: 8px; border: 1px solid rgba(94, 224, 138, .2); background: rgba(94, 224, 138, .05); color: #a4efbe; font-size: 12px; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 4px; flex-wrap: wrap; }
.input-group { display: flex; gap: 6px; }
.input-group .input { flex: 1; }
.checkbox { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; cursor: pointer; user-select: none; }
.checkbox input { width: 14px; height: 14px; accent-color: var(--green); }
.switch { position: relative; width: 34px; height: 19px; border-radius: 20px; background: #24342b; border: 1px solid #2f4539; transition: .15s; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: #8ba095; transition: .15s; }
.switch.on { background: rgba(94, 224, 138, .22); border-color: rgba(94, 224, 138, .4); }
.switch.on::after { left: 17px; background: var(--green); }
.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: #0b130f; gap: 2px; }
.segment { border: 0; background: transparent; color: var(--muted); height: 26px; padding: 0 10px; border-radius: 6px; font-size: 11.5px; font-weight: 600; }
.segment.active { background: var(--panel-3); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.04) inset; }
.segmented.small .segment { height: 23px; font-size: 11px; }
.form-card { padding: 20px; }

/* toolbar */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.search { position: relative; flex: 1; min-width: 180px; max-width: 320px; }
.search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--dim); width: 14px; height: 14px; }
.search .input { padding-left: 31px; height: 32px; min-height: 32px; background: #0a110d; }
.toolbar .spacer { flex: 1; }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { position: relative; padding: 10px 12px; border: 0; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab.active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; background: var(--green); border-radius: 2px 2px 0 0; }
.tab .count { display: inline-grid; place-items: center; min-width: 16px; height: 16px; margin-left: 5px; border-radius: 5px; background: #223329; font-size: 9.5px; color: var(--muted); padding: 0 4px; }

/* empty / loading */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 20px; text-align: center; gap: 7px; }
.empty-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: #111c16; border: 1px solid var(--border); color: #6a8978; margin-bottom: 5px; }
.empty h3 { margin: 0; font-size: 14px; font-weight: 650; }
.empty p { margin: 0 0 8px; color: var(--dim); font-size: 12px; max-width: 380px; line-height: 1.6; }
.skeleton { border-radius: 8px; background: linear-gradient(90deg, #121d17 25%, #19261e 37%, #121d17 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.loading-line { height: 12px; margin: 9px 0; }

/* code */
.code-block { position: relative; border: 1px solid var(--border); border-radius: 9px; background: #080f0b; padding: 12px 13px; font-family: var(--mono); font-size: 11.5px; line-height: 1.7; color: #b6d3c3; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.code-block .c { color: #6f8579; }
.copy-row { display: flex; align-items: stretch; gap: 6px; }
.copy-row .code-block { flex: 1; min-width: 0; }
.copy-row .btn { flex: none; }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 12px; font-size: 12px; }
.kv dt { color: var(--dim); }
.kv dd { margin: 0; color: #c9d8cf; overflow-wrap: anywhere; }

/* gpu */
.gpu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 9px; }
.gpu-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: #0c1510; }
.gpu-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 9px; }
.gpu-index { width: 22px; height: 22px; border-radius: 6px; background: #19271f; color: #a4c7b1; display: grid; place-items: center; font-family: var(--mono); font-size: 10px; }
.gpu-name { font-size: 11.5px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gpu-temp { font-family: var(--mono); font-size: 12px; color: #a9e7bd; }
.gpu-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.gpu-metric .k { color: var(--dim); font-size: 9px; }
.gpu-metric .v { font-family: var(--mono); font-size: 11px; color: #bdd4c7; }

/* members */
.member-list { display: flex; flex-direction: column; }
.member-row { display: flex; align-items: center; gap: 11px; padding: 12px 16px; border-bottom: 1px solid rgba(31, 45, 38, .55); }
.member-row:last-child { border-bottom: 0; }
.member-main { flex: 1; min-width: 0; }
.member-name { font-size: 12.8px; font-weight: 600; }
.member-email { color: var(--dim); font-size: 10.8px; }
.member-actions { display: flex; align-items: center; gap: 6px; }

/* modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(3, 6, 4, .72); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade-in .14s ease; }
.modal {
  width: min(520px, 100%); max-height: min(86vh, 900px); display: flex; flex-direction: column;
  border: 1px solid var(--border-strong); border-radius: 14px; background: #0d1511; box-shadow: 0 30px 90px -20px #000;
  animation: modal-in .18s cubic-bezier(.2, .8, .3, 1); overflow: hidden;
}
.modal.modal-lg { width: min(760px, 100%); }
.modal.modal-xl { width: min(960px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 15px 17px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 14px; font-weight: 650; }
.modal-sub { color: var(--dim); font-size: 11px; margin-top: 1px; }
.modal-close { margin-left: auto; }
.modal-body { padding: 17px; overflow-y: auto; }
.modal-foot { padding: 12px 17px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }

/* toast */
.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast {
  display: flex; align-items: flex-start; gap: 9px; padding: 11px 13px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: #0e1813; box-shadow: var(--shadow); font-size: 12.3px;
  animation: toast-in .2s ease; color: #d8e8de;
}
.toast .icon { width: 15px; height: 15px; margin-top: 1px; color: var(--green); }
.toast.error { border-color: rgba(255, 115, 115, .3); } .toast.error .icon { color: var(--red); }
.toast.info .icon { color: var(--blue); }
.toast.out { animation: toast-out .18s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(4px); } }

/* misc */
.avatar-lg { width: 42px; height: 42px; border-radius: 12px; font-size: 15px; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.list { display: flex; flex-direction: column; gap: 6px; }
.list-row { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 8px; background: #0c1510; border: 1px solid var(--border); font-size: 12px; }
.list-row .grow { flex: 1; min-width: 0; }
.callout { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: #0b130f; color: var(--muted); font-size: 11.8px; line-height: 1.65; }
.callout strong { color: var(--text); }
.callout.warn { border-color: rgba(240, 196, 90, .25); background: rgba(240, 196, 90, .04); }
.callout.danger { border-color: rgba(255, 115, 115, .25); background: rgba(255, 115, 115, .04); }
.dot-sep { color: #3b4d42; }
.meter { height: 4px; border-radius: 3px; background: #1a2921; overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 3px; background: var(--green); }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.hash { font-family: var(--mono); font-size: 11px; color: #a7c2b2; }
.hash.masked { letter-spacing: .08em; }
.dropdown { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 5px); min-width: 170px; z-index: 50; padding: 5px;
  border: 1px solid var(--border-strong); border-radius: 9px; background: #0d1511; box-shadow: var(--shadow);
}
.menu button, .menu a { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 8px; border: 0; background: transparent; border-radius: 6px; color: var(--muted); font-size: 12px; text-align: left; }
.menu button:hover, .menu a:hover { background: var(--panel-2); color: var(--text); }
.menu .danger { color: #ff9a9a; }
.check-list { display: flex; flex-direction: column; gap: 4px; max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 7px; }
.check-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; font-size: 12px; }
.check-row:hover { background: rgba(255, 255, 255, .025); }
.check-row .meta { margin-left: auto; color: var(--dim); font-size: 10px; }

/* responsive */
@media (max-width: 1180px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .farm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-panel { min-height: 100vh; padding: 30px 20px; background: radial-gradient(700px 500px at 50% -10%, rgba(94, 224, 138, .07), transparent 60%), var(--bg); }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 264px; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 20px 0 60px -20px #000; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .55); }
  .mobile-menu-btn { display: inline-flex; }
  .topbar { padding: 0 16px; height: 56px; }
  .page { padding: 20px 16px 60px; }
  .page-title { font-size: 22px; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .split-2 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-value { font-size: 21px; }
  .farm-grid { grid-template-columns: 1fr; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .toolbar { padding: 10px; }
  .search { max-width: none; }
  .table th, .table td { padding: 9px 10px; }
  .table .hide-sm { display: none; }
  .modal-backdrop { padding: 10px; align-items: flex-end; }
  .modal { max-height: 92vh; border-radius: 14px 14px 0 0; }
  .toast-root { right: 10px; bottom: 10px; }
  .kv { grid-template-columns: 88px minmax(0, 1fr); }
}

/* fixes */
.brand-word, .brand-sub { display: block; }
.farm-switch-meta { display: flex; flex-direction: column; min-width: 0; }
.user-meta { display: flex; flex-direction: column; }
button.nav-item { width: 100%; background: transparent; border: 0; text-align: left; font: inherit; }
button.nav-item:hover { background: rgba(255,255,255,.025); }
.nav-item > span:not(.nav-badge) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table tr.selected { background: rgba(94,224,138,.06); }
.spinner { width: 13px; height: 13px; border: 2px solid rgba(0,0,0,.25); border-top-color: currentColor; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; margin-right: 5px; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸ "; color: var(--dim); }
details[open] > summary::before { content: "▾ "; }

/* layout refinements */
.split, .split-2 { align-items: start; }
.table .actions { flex-wrap: nowrap; }
#group-form input[type="color"] { flex: 0 0 46px; width: 46px; min-width: 46px; height: 36px; padding: 3px; }
.term-body { font-size: 11.5px; }

/* interactive cards / focus */
button.farm-card { width: 100%; color: var(--text); font: inherit; text-align: left; }
.farm-card:focus-visible, .btn:focus-visible, .input:focus-visible { outline: 2px solid rgba(94,224,138,.55); outline-offset: 2px; }
.segmented .segment .dim { margin-left: 3px; font-size: 10px; }
