:root {
  --ink: #14221f;
  --muted: #5c6b67;
  --line: #d8e0dc;
  --paper: #f6f3ec;
  --white: #fffcf7;
  --teal: #0f5c52;
  --deep: #0a3d37;
  --gold: #c4a35a;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: "Segoe UI", system-ui, sans-serif; background: var(--paper); color: var(--ink); }
.hidden { display: none !important; }
.hub-logo {
  height: auto;
  max-height: 48px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
  display: block;
  margin-bottom: 10px;
  background: #07090d;
  border-radius: 10px;
  padding: 8px 12px;
}
.hub-mark { height: 36px; width: auto; display: block; margin-bottom: 8px; border-radius: 8px; }
h1, h2 { margin: 0; font-weight: 650; letter-spacing: -0.02em; }
.kicker {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  font-weight: 700;
}
.sub { color: var(--muted); }
.error { color: #8f2d2d; min-height: 1.1em; }

.login { min-height: 100vh; display: grid; place-items: center; background: var(--deep); }
.card { background: var(--white); border: 1px solid var(--line); padding: 28px; }
.login .card { width: min(420px, 92vw); display: grid; gap: 10px; }
label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input, select { border: 1px solid var(--line); padding: 10px 12px; font: inherit; background: #fff; color: var(--ink); }
button { border: 0; background: var(--teal); color: #f4efe4; font: inherit; font-weight: 650; padding: 11px 16px; cursor: pointer; }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }

.app { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }
.top { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 28px; }
.top-right { display: flex; gap: 12px; align-items: center; color: var(--muted); }
.pill { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 8px; background: #d7efe3; color: var(--teal); }

.grid { display: grid; grid-template-columns: 1fr 280px; gap: 24px; }
.row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.tenants { display: grid; gap: 10px; }
.tenant-group { display: grid; gap: 6px; }
.tenant-children {
  display: grid;
  gap: 6px;
  margin: 0 0 4px 16px;
  padding-left: 12px;
  border-left: 2px solid var(--line);
}
.tenant {
  background: var(--white);
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 0;
}
.tenant:hover { border-color: var(--teal); }
.tenant-hq { border-color: #c5d4ce; }
.tenant-child { background: #fbfaf6; }
.tenant-child .tenant-main { padding: 12px 14px; }
.tenant-child .tenant-main strong { font-size: 14px; }
.tenant-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.tenant-stores-btn { white-space: nowrap; font-size: 12px !important; }
.tenant-group.is-open .tenant-stores-btn {
  background: #d7efe3;
  border-color: #b7d8c8;
  color: var(--teal);
}
.tenant-main {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.tenant-main strong { font-size: 16px; }
.tenant .meta { color: var(--muted); font-size: 13px; }
.tenant .ghost { padding: 8px 12px; font-size: 13px; }
.inline-link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--teal);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-decoration: underline;
}
.mods { list-style: none; padding: 0; margin: 8px 0 22px; }
.mods li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.mods small { display: block; color: var(--muted); }
.totp-box { font-size: 14px; margin-bottom: 22px; }
.totp-box .sub { margin: 8px 0; }
.totp-qr { width: 160px; height: 160px; background: #fff; padding: 6px; display: block; margin: 10px 0; }

.create, .detail { margin-top: 24px; }
.modal-back {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(10, 61, 55, 0.45);
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-back .create {
  margin: 0;
  width: min(640px, 100%);
  max-height: min(90vh, 760px);
  overflow: auto;
}
.modal-back .detail {
  margin: 0;
  width: min(760px, 100%);
  max-height: min(92vh, 900px);
  overflow: auto;
}
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}
.secret-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 16px;
  display: grid;
  gap: 8px;
}
.secret-row {
  border: 1px solid var(--line);
  background: #fff;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.secret-row strong { display: block; }
.secret-row small { display: block; color: var(--muted); margin-top: 3px; }
.secret-row .ok { color: var(--teal); font-weight: 650; }
.secret-row .miss { color: #8f2d2d; font-weight: 650; }
.secret-edit {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.secret-edit .fields { margin: 0; }
.flash { font-size: 13px; color: var(--teal); min-height: 1.1em; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.actions { display: flex; gap: 8px; }
.toggle { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 800px) {
  .grid, .fields { grid-template-columns: 1fr; }
  .tenant {
    grid-template-columns: 1fr;
    padding-right: 0;
  }
  .tenant-actions {
    justify-content: flex-end;
    padding: 0 12px 12px;
  }
  .tenant-children { margin-left: 10px; }
}
