:root {
  --bg: #faf9f8;
  --surface: #fff;
  --text: #323130;
  --text-soft: #605e5c;
  --accent: #0078d4;
  --accent-hover: #106ebe;
  --divider: #edebe9;
  --hover: #f3f2f1;
  --radius: 2px;
  --danger: #a4262c;
  --ok: #107c10;
  --warn: #8a6d00;
  --shadow:
    0 6.4px 14.4px rgba(0, 0, 0, 0.132), 0 1.2px 3.6px rgba(0, 0, 0, 0.11);
  --font:
    "Segoe UI", "Segoe UI Web (West European)", -apple-system,
    BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  cursor: pointer;
}
input,
select {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
}
.hidden {
  display: none !important;
}

/* -------- brand -------- */
.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
}
.brand-square {
  width: 26px;
  height: 26px;
  background: #000;
  border-radius: 2px;
  display: inline-block;
  flex: 0 0 auto;
}
.brand-word {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.1px;
}

/* -------- login -------- */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  padding: 8px 24px 24px;
  box-shadow: var(--shadow);
}
.login-title {
  font-size: 20px;
  font-weight: 600;
  margin: 8px 0 20px;
}
.field {
  display: block;
  margin-bottom: 14px;
}
.field > span {
  display: block;
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 6px;
}
.field input,
.field select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #c8c6c4;
  border-radius: var(--radius);
  background: var(--surface);
  outline: none;
}
.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.field .pw-wrap {
  position: relative;
}
.field .pw-wrap input {
  padding-right: 38px;
}
.pw-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  padding: 6px;
  color: var(--text-soft);
  display: flex;
}
.pw-toggle:hover {
  color: var(--text);
}
.err {
  color: var(--danger);
  font-size: 12.5px;
  min-height: 18px;
  margin: 2px 0 8px;
}

/* -------- buttons -------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius);
  border: 1px solid #c8c6c4;
  background: var(--surface);
  line-height: 20px;
  min-height: 32px;
}
.btn:hover {
  background: var(--hover);
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  filter: brightness(0.95);
}
.btn-danger[disabled],
.btn-primary[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-block {
  width: 100%;
}
.icon-btn {
  background: none;
  border: 0;
  padding: 4px 8px;
  font-size: 18px;
  line-height: 1;
  color: var(--text-soft);
  border-radius: var(--radius);
}
.icon-btn:hover {
  background: var(--hover);
  color: var(--text);
}

/* -------- app shell -------- */
.app-screen {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--bg);
  border-right: 1px solid var(--divider);
  display: flex;
  flex-direction: column;
}
.nav {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 0;
  background: none;
  border-radius: var(--radius);
  color: var(--text);
  text-align: left;
  width: 100%;
  position: relative;
}
.nav-item:hover {
  background: var(--hover);
}
.nav-item.active {
  background: var(--hover);
}
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
}
.nav-ico {
  display: inline-flex;
  color: var(--text-soft);
}
.nav-item.active .nav-ico {
  color: var(--text);
}
.sidebar-foot {
  border-top: 1px solid var(--divider);
  padding: 8px;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--divider);
  background: var(--surface);
}
.header-spacer {
  flex: 1;
}
.picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid #c8c6c4;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-soft);
  min-width: 280px;
}
.picker-btn:hover {
  background: var(--hover);
}
.picker-ico {
  display: inline-flex;
  color: var(--text-soft);
}
.user-chip {
  font-size: 12px;
  color: var(--text-soft);
}

.content {
  padding: 24px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* -------- page bits -------- */
.page-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 16px;
}
.page-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.page-head .page-title {
  margin: 0;
}
.page-head .spacer {
  flex: 1;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  padding: 16px;
}
.stat-card .label {
  font-size: 12px;
  color: var(--text-soft);
}
.stat-card .val {
  font-size: 26px;
  font-weight: 600;
  margin-top: 6px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
}
.card h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
}
.card.danger {
  border-color: #d13438;
  border-width: 2px;
}

table.tbl {
  width: 100%;
  border-collapse: collapse;
}
table.tbl th,
table.tbl td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--divider);
  font-size: 13px;
  vertical-align: top;
}
table.tbl th {
  font-weight: 600;
  color: var(--text-soft);
  font-size: 12px;
  background: var(--bg);
}
table.tbl tr:hover td {
  background: var(--hover);
}
.mono {
  font-family: Consolas, "SF Mono", Menlo, monospace;
  font-size: 12px;
}
.muted {
  color: var(--text-soft);
}
.mask {
  font-family: Consolas, monospace;
  color: var(--text-soft);
}

.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
}
.pill.pending {
  background: #fff4ce;
  color: #8a6d00;
  border-color: #f2e0a8;
}
.pill.dns {
  background: #deecf9;
  color: #005a9e;
  border-color: #b7d6f0;
}
.pill.cert {
  background: #e6e0f5;
  color: #5c2e91;
  border-color: #cdc4ec;
}
.pill.live {
  background: #dff6dd;
  color: #107c10;
  border-color: #b8e0b6;
}
.pill.error {
  background: #fde7e9;
  color: #a4262c;
  border-color: #f3c3c6;
}

.row-raw pre {
  background: var(--bg);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  padding: 10px;
  margin: 0;
  overflow: auto;
  font-size: 12px;
}
.link-btn {
  background: none;
  border: 0;
  color: var(--accent);
  padding: 0;
  font-size: 12.5px;
}
.link-btn:hover {
  text-decoration: underline;
}
.row-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* -------- modal -------- */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 50;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}
.modal-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
}
.modal-card.wide {
  width: min(680px, calc(100vw - 32px));
}
.modal-head {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--divider);
}
.modal-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  flex: 1;
}
.modal-body {
  padding: 18px;
  overflow: auto;
}
.modal-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--divider);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.note {
  background: var(--bg);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--text-soft);
  margin-bottom: 14px;
}
.gen-sub {
  font-family: Consolas, monospace;
  background: var(--bg);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 13px;
  color: var(--text);
}
.search-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #c8c6c4;
  border-radius: var(--radius);
  margin-bottom: 10px;
  outline: none;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.picker-list {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--divider);
  border-radius: var(--radius);
}
.picker-item {
  padding: 9px 12px;
  border-bottom: 1px solid var(--divider);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
}
.picker-item:last-child {
  border-bottom: 0;
}
.picker-item:hover {
  background: var(--hover);
}
.picker-item .t {
  font-weight: 600;
}
.picker-item .s {
  font-size: 12px;
  color: var(--text-soft);
}

/* -------- tabs -------- */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--divider);
  padding: 0 4px;
}
.tab {
  background: none;
  border: 0;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-soft);
  position: relative;
  border-radius: 0;
}
.tab:hover {
  background: var(--hover);
  color: var(--text);
}
.tab.active {
  color: var(--text);
  font-weight: 600;
}
.tab.active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
}
.tab-body {
  padding: 18px;
}
.tab-pane {
  max-width: 520px;
}

/* -------- bold labels & buttons -------- */
.lbl-bold {
  font-weight: 700;
  color: var(--text);
  font-size: 13px;
}
.btn-bold {
  font-weight: 700;
}
.field-desc {
  margin: 4px 0 10px;
  font-size: 12.5px;
  color: var(--text-soft);
  line-height: 1.5;
}

/* -------- fixed white sidebar -------- */
.app-screen {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--surface); /* white */
  border-right: 1px solid var(--divider);
  display: flex;
  flex-direction: column;
  overflow-y: auto; /* only sidebar's own overflow scrolls, not page */
}
