/* TRON Wallet Admin — Avocado Theme */
:root {
  --cream: #f6f1e4;
  --cream-deep: #ebe4d4;
  --panel: #fffcf5;
  --panel-soft: #f9f5eb;
  --border: #ddd4c0;
  --border-soft: #e8e0ce;
  --text: #2f3b22;
  --muted: #6f7a5f;
  --avocado: #568203;
  --avocado-deep: #3f6200;
  --avocado-soft: #a8c56e;
  --avocado-mist: rgba(86, 130, 3, 0.12);
  --avocado-glow: rgba(86, 130, 3, 0.18);
  --ok: #4f7a12;
  --warn: #c4891a;
  --bad: #c45a3a;
  --pending: #8a9078;
  --in: #4f7a12;
  --out: #c4891a;
  --shadow: 0 8px 24px rgba(63, 78, 40, 0.06);
  --shadow-sm: 0 2px 8px rgba(63, 78, 40, 0.05);
  --radius: 14px;
  --radius-sm: 10px;
  --nav-h: 64px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(168, 197, 110, 0.22), transparent 55%),
    radial-gradient(900px 420px at 95% 0%, rgba(86, 130, 3, 0.08), transparent 50%),
    var(--cream);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--avocado); }

/* —— Top bar —— */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 252, 245, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
}

.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  min-width: 160px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--avocado-soft), var(--avocado));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 4px 10px rgba(86,130,3,.25);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand-title { font-size: 15px; font-weight: 700; letter-spacing: 0.01em; }
.brand-sub { font-size: 11px; color: var(--muted); }

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  transition: background .15s, color .15s, box-shadow .15s;
}

.nav a:hover {
  color: var(--avocado-deep);
  background: var(--avocado-mist);
}

.nav a.active {
  color: #fff;
  background: linear-gradient(135deg, var(--avocado), var(--avocado-deep));
  box-shadow: 0 4px 12px rgba(86, 130, 3, 0.28);
}

.top-meta {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

/* —— Page shell —— */
.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px 20px 36px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 16px;
}

.page-head h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--avocado-deep);
}

.page-head .meta,
.meta { color: var(--muted); font-size: 13px; }

/* —— Cards / panels —— */
.panel {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--avocado-deep);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel h2::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--avocado);
  box-shadow: 0 0 0 4px var(--avocado-mist);
  flex-shrink: 0;
}

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.card .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.card .value {
  font-size: 20px;
  font-weight: 750;
  margin-top: 4px;
  color: var(--text);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

/* —— Controls —— */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.controls input,
.controls select { width: auto; min-width: 140px; }

input, select, textarea, button {
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--avocado-soft);
  box-shadow: 0 0 0 3px var(--avocado-mist);
}

textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  background: var(--panel-soft);
}

button {
  cursor: pointer;
  background: linear-gradient(135deg, var(--avocado), var(--avocado-deep));
  color: #fff;
  border: none;
  font-weight: 700;
  padding: 9px 16px;
  box-shadow: 0 4px 12px rgba(86, 130, 3, 0.22);
}

button:hover { filter: brightness(1.06); }
button:disabled { opacity: .55; cursor: not-allowed; filter: none; }

button.secondary {
  background: #fff;
  color: var(--avocado-deep);
  border: 1px solid var(--border);
  box-shadow: none;
}

button.secondary:hover {
  background: var(--avocado-mist);
  border-color: var(--avocado-soft);
}

button.danger {
  background: #fff;
  color: var(--bad);
  border: 1px solid rgba(196, 90, 58, 0.35);
  box-shadow: none;
}

button.danger:hover { background: rgba(196, 90, 58, 0.08); }

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  align-items: center;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 700px) {
  .grid-2 { grid-template-columns: 1fr; }
}

.field { margin-top: 10px; }
.field label,
label.field-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.switch-row,
.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.switch-row input[type=checkbox],
.switch input[type=checkbox] {
  width: auto;
  accent-color: var(--avocado);
}

.hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
  line-height: 1.55;
}

.msg { font-size: 13px; margin-top: 8px; color: var(--ok); font-weight: 600; }
.msg.err { color: var(--bad); }

/* —— Badges —— */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.badge.online, .badge.yes, .badge.ok, .badge.on, .badge.in {
  background: var(--avocado-mist);
  color: var(--ok);
}

.badge.offline, .badge.bad, .badge.error {
  background: rgba(196, 90, 58, 0.12);
  color: var(--bad);
}

.badge.pending, .badge.off {
  background: rgba(138, 144, 120, 0.15);
  color: var(--pending);
}

.badge.no, .badge.warn, .badge.out {
  background: rgba(196, 137, 26, 0.14);
  color: var(--warn);
}

/* —— Tables —— */
.wrap, .table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}

th, td {
  padding: 11px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 700;
  background: linear-gradient(180deg, #f3efdf, #ebe5d4);
  user-select: none;
}

th[data-sort] { cursor: pointer; }
th:hover { color: var(--avocado-deep); }
th .arrow { opacity: .45; margin-left: 4px; }
th.active .arrow { opacity: 1; color: var(--avocado); }

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(86, 130, 3, 0.04); }

td.addr, td.mono, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

td.num { font-variant-numeric: tabular-nums; }

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}

.err {
  color: var(--bad);
  font-size: 12px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scroll {
  max-height: 440px;
  overflow: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--panel);
}

.scroll table {
  border: none;
  box-shadow: none;
  border-radius: 0;
}

.scroll th { position: sticky; top: 0; z-index: 1; }

/* —— Layout helpers —— */
.layout-2 {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 16px;
}

@media (max-width: 960px) {
  .layout-2 { grid-template-columns: 1fr; }
}

.stack { display: grid; gap: 16px; }

.addr-list {
  max-height: 200px;
  overflow: auto;
  margin-top: 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}

.addr-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 12px;
}

.addr-item:last-child { border-bottom: none; }
.addr-item .a {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  word-break: break-all;
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.tabs button {
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 999px;
}

.tabs button.active {
  background: linear-gradient(135deg, var(--avocado), var(--avocado-deep));
  color: #fff;
}

.tabs button:not(.active) {
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--border);
  box-shadow: none;
}

.tabs button:not(.active):hover {
  color: var(--avocado-deep);
  background: var(--avocado-mist);
}

footer.page-foot {
  max-width: 1400px;
  margin: 0 auto;
  padding: 4px 20px 28px;
  color: var(--muted);
  font-size: 12px;
}

.admin-wrap {
  max-width: 920px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

input[type="search"],
input[type="file"] { width: 100%; }


/* —— Tools page —— */
.tools-stack { display: flex; flex-direction: column; gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

.log-box {
  margin-top: 10px;
  max-height: 280px;
  overflow: auto;
  padding: 12px 14px;
  background: var(--panel-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 0;
}
.log-box:empty { display: none; }

a.btn-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-weight: 700;
  padding: 9px 16px;
  border-radius: 10px;
  background: #fff;
  color: var(--avocado-deep);
  border: 1px solid var(--border);
  font-size: 14px;
}
a.btn-link:hover {
  background: var(--avocado-mist);
  border-color: var(--avocado-soft);
}

/* —— App shell: left sidebar + single-column content —— */
body.app { margin: 0; }
.app-shell {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}
.sidenav {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: var(--panel);
  border-right: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
}
.sidenav .brand { margin: 0 6px 8px; min-width: 0; }
.sidenav .nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  margin-top: 22px;
  flex: 1;
}
.sidenav .nav a {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}
.sidenav-foot {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sidenav-note { color: var(--muted); font-size: 12px; line-height: 1.45; }
.sidenav-foot a.logout {
  text-decoration: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 10px;
}
.sidenav-foot a.logout:hover {
  color: var(--bad);
  background: rgba(196, 90, 58, 0.08);
}
.app-main {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 40px;
  max-width: 920px;
}
.app-main .page-head { margin-bottom: 18px; }
.app-main .page-foot {
  max-width: none;
  margin: 24px 0 0;
  padding: 0;
}
body.app .grid-2,
body.app .layout-2 {
  display: flex;
  flex-direction: column;
  gap: 14px;
  grid-template-columns: none;
}
body.app .summary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
body.app .summary .card,
body.app .card {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
body.app .card .value {
  margin-top: 0;
  font-size: 16px;
  text-align: right;
}
body.app .controls {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}
body.app .controls input,
body.app .controls select,
body.app .field input,
body.app .field select,
body.app .field textarea {
  width: 100%;
  min-width: 0;
}
body.app .field { margin-top: 0; }
body.app .stack,
body.app .tools-stack,
body.app .admin-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: none;
  margin: 0;
}
body.app .addr-pick {
  max-height: 260px;
  overflow: auto;
  margin-top: 8px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}
body.app .addr-pick label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-soft);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px;
  margin: 0;
  color: var(--text);
  font-weight: 500;
}
body.app .addr-pick label:last-child { border-bottom: none; }
body.app .addr-pick input[type="checkbox"] {
  width: auto;
  min-width: 0;
  margin-top: 2px;
  accent-color: var(--avocado);
}
body.app .pager {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
@media (max-width: 800px) {
  .app-shell { flex-direction: column; }
  .sidenav {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
  }
  .sidenav .nav { margin-top: 12px; flex: none; }
  .app-main { padding: 16px 16px 32px; }
}
/* —— ERP full-bleed shell —— */

html, body.app {
  height: 100%;
  margin: 0;
}
body.app {
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(168, 197, 110, 0.22), transparent 55%),
    radial-gradient(900px 420px at 95% 0%, rgba(86, 130, 3, 0.08), transparent 50%),
    var(--cream);
  overflow: hidden;
}
.app-shell {
  display: flex;
  align-items: stretch;
  width: 100%;
  height: 100vh;
  min-height: 100vh;
}
.sidenav {
  width: 228px;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: auto;
  background: var(--panel);
  border-right: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  padding: 18px 12px 14px;
}
.sidenav .brand { margin: 0 4px 4px; }
.sidenav .brand-title { color: var(--text); }
.sidenav .brand-sub { color: var(--muted); }
.sidenav .nav {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  margin-top: 20px;
  flex: 1;
}
.sidenav .nav a {
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}
.sidenav .nav a:hover {
  color: var(--avocado-deep);
  background: var(--avocado-mist);
}
.sidenav .nav a.active {
  color: #fff;
  background: linear-gradient(135deg, var(--avocado), var(--avocado-deep));
  box-shadow: 0 4px 12px rgba(86, 130, 3, 0.28);
}
.sidenav-foot {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.sidenav-note { color: var(--muted); }
.sidenav-foot a.logout { color: var(--muted); }
.sidenav-foot a.logout:hover {
  color: var(--bad);
  background: rgba(196, 90, 58, 0.08);
}
.app-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  width: 100%;
  max-width: none;
  padding: 16px 22px 20px;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.app-main .page-head { margin-bottom: 14px; }
.app-main .page-foot { max-width: none; margin: 16px 0 0; padding: 0; }
body.app .wrap,
body.app .table-wrap {
  width: 100%;
  max-width: none;
  overflow: auto;
  max-height: calc(100vh - 230px);
  flex: 1;
}
body.app table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}
body.app .summary {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
body.app .summary .card,
body.app .card {
  flex: 1 1 160px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 4px;
  min-width: 140px;
}
body.app .card .value {
  margin-top: 0;
  font-size: 20px;
  text-align: left;
}
body.app .controls {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
body.app .controls input,
body.app .controls select {
  width: auto;
  min-width: 160px;
  flex: 1 1 160px;
  max-width: 280px;
}
body.app .field input,
body.app .field select,
body.app .field textarea {
  width: 100%;
  min-width: 0;
}
body.app .stack,
body.app .tools-stack,
body.app .admin-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: none;
  width: 100%;
  margin: 0;
}
@media (min-width: 1100px) {
  body.app .grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
  }
  body.app .layout-2 {
    display: grid;
    grid-template-columns: minmax(320px, 380px) 1fr;
    gap: 16px;
    align-items: start;
  }
}
@media (max-width: 1099px) {
  body.app .grid-2,
  body.app .layout-2 {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
}
@media (max-width: 800px) {
  body.app { overflow: auto; }
  .app-shell { flex-direction: column; height: auto; min-height: 100vh; }
  .sidenav {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
  }
  .sidenav .nav { margin-top: 12px; flex: none; }
  .app-main { padding: 14px 14px 24px; overflow: visible; }
  body.app .wrap,
  body.app .table-wrap { max-height: none; }
}


/* Customer-facing layout polish */
details.adv {
  margin: 10px 0 4px;
  padding: 8px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}
details.adv summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  list-style: none;
}
details.adv summary::-webkit-details-marker { display: none; }
details.adv summary::before {
  content: "▸ ";
  color: var(--avocado, #6b8f3a);
}
details.adv[open] summary::before { content: "▾ "; }
details.adv .field { margin-top: 10px; }

.watch-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}
.watch-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.watch-top .addr-list {
  max-height: 280px;
  overflow: auto;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px 16px;
  margin-top: 8px;
}
.switches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 12px 0 6px;
}
@media (max-width: 1099px) {
  .watch-top {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
}

.subhead {
  margin: 18px 0 8px;
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
}
.totp-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--panel-soft, #fff);
}
.totp-box img {
  width: 180px;
  height: 180px;
  background: #fff;
  border-radius: 8px;
  padding: 6px;
}
.totp-secret {
  flex: 1;
  min-width: 220px;
}
.totp-secret code {
  display: block;
  margin: 8px 0 10px;
  padding: 10px 12px;
  font-size: 16px;
  letter-spacing: 0.12em;
  word-break: break-all;
  background: #fff;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}
