:root {
  --bg: #121016;
  --bg-elevated: #1b1822;
  --bg-card: #201c28;
  --gold: #d4af37;
  --gold-soft: #f1d98b;
  --text: #ece7f0;
  --text-muted: #a89fb3;
  --border: #322c3d;
  --green: #4caf7d;
  --red: #e0555f;
  --amber: #e0a84a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: radial-gradient(circle at top, #1c1824 0%, var(--bg) 60%);
  color: var(--text);
  font-family: "Segoe UI", Roboto, system-ui, sans-serif;
  min-height: 100vh;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: var(--bg-elevated);
  border-bottom: 2px solid var(--gold);
}
.brand { font-size: 1.2rem; font-weight: 700; color: var(--gold-soft); }
.brand span { font-weight: 400; color: var(--text-muted); font-size: 0.9rem; margin-left: 6px; }
nav { display: flex; gap: 16px; align-items: center; }
nav a { color: var(--text); text-decoration: none; padding: 6px 10px; border-radius: 6px; }
nav a:hover { background: var(--bg-card); color: var(--gold-soft); }
.link-button {
  background: none; border: none; color: var(--text-muted); cursor: pointer; font: inherit; padding: 6px 10px;
}
.link-button:hover { color: var(--gold-soft); }
.content { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 18px;
}
.card h2, .card h3 { margin-top: 0; color: var(--gold-soft); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; }
a.button, button.primary, input[type=submit] {
  background: linear-gradient(135deg, var(--gold), #a9802a);
  color: #1a1410;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button.secondary { background: var(--bg-elevated); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 9px 14px; cursor: pointer; }
button.danger { background: var(--red); color: #fff; border: none; border-radius: 8px; padding: 9px 14px; cursor: pointer; }
.badge { padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; display: inline-block; }
.badge-online { background: rgba(76,175,125,.18); color: var(--green); }
.badge-offline { background: rgba(224,85,95,.18); color: var(--red); }
.badge-stale { background: rgba(224,168,74,.18); color: var(--amber); }
.badge-applied { background: rgba(76,175,125,.18); color: var(--green); }
.badge-rejected, .badge-expired { background: rgba(224,85,95,.18); color: var(--red); }
.badge-pending, .badge-sent { background: rgba(224,168,74,.18); color: var(--amber); }
.badge-unknown { background: rgba(168,159,179,.25); color: var(--text-muted); }
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.alert-error { background: rgba(224,85,95,.15); border: 1px solid var(--red); color: #ffb3b8; }
.alert-success { background: rgba(76,175,125,.15); border: 1px solid var(--green); color: #b9f0d2; }
input[type=text], input[type=email], input[type=password], input[type=number], select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 10px;
  border-radius: 6px;
  width: 100%;
}
label { display: block; margin: 12px 0 4px; color: var(--text-muted); font-size: 0.9rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.field-group { border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 10px; }
.field-group h4 { margin: 0 0 8px; color: var(--gold-soft); text-transform: capitalize; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }
.muted { color: var(--text-muted); font-size: 0.85rem; }
.login-wrap { max-width: 400px; margin: 10vh auto; }
.inline { display: inline; }
code.token { display: block; background: #0d0b11; color: var(--gold-soft); padding: 12px; border-radius: 8px; word-break: break-all; margin: 10px 0; }
@media (max-width: 640px) {
  .topbar { flex-direction: column; gap: 10px; }
  .content { padding: 14px 10px 50px; }
}

:root {
  --bg: #111315;
  --bg-elevated: #181b1d;
  --bg-card: #1b1f20;
  --gold: #c9a64d;
  --gold-soft: #ead391;
  --text: #eef0ed;
  --text-muted: #a7aca8;
  --border: #333a37;
  --green: #65c28c;
  --red: #ef7378;
  --amber: #e5b758;
}
body { background: #111315; font-family: "Trebuchet MS", "Segoe UI", sans-serif; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: #171a1b; border-right: 1px solid #2d3330; padding: 22px 14px 14px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; font-size: 1.06rem; font-weight: 700; padding: 2px 10px 28px; }
.brand small { display: block; margin-top: 4px; color: var(--text-muted); font-size: .62rem; letter-spacing: 1.6px; }
.brand-mark { width: 34px; height: 34px; border: 1px solid var(--gold); color: var(--gold-soft); display: grid; place-items: center; font-family: Georgia, serif; font-size: 1.2rem; }
.side-nav { display: grid; gap: 5px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 5px; color: #bdc1bd; text-decoration: none; font-size: .92rem; }
.side-nav a span { width: 18px; color: var(--gold); text-align: center; font-size: 1rem; }
.side-nav a:hover, .side-nav a:focus-visible { background: #252a28; color: var(--text); }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); padding: 15px 4px 2px; display: flex; align-items: center; gap: 9px; min-width: 0; }
.user-avatar { width: 30px; height: 30px; flex: 0 0 30px; display: grid; place-items: center; border-radius: 50%; background: #3d382b; color: var(--gold-soft); }
.user-info { min-width: 0; flex: 1; display: grid; gap: 3px; }
.user-info strong, .user-info small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-info strong { font-size: .8rem; }
.user-info small { color: var(--text-muted); font-size: .68rem; }
.main-column { min-width: 0; }
.content { max-width: 1440px; padding: 34px clamp(18px, 3vw, 46px) 100px; }
.mobile-top, .mobile-nav { display: none; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.page-heading h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 1.8rem; font-weight: 500; color: #f4f0e4; }
.page-heading p { margin: 7px 0 0; color: var(--text-muted); font-size: .9rem; }
.card { background: #191d1e; border-color: #303634; border-radius: 7px; padding: 20px; margin-bottom: 16px; }
.card h2, .card h3 { color: #e8d69e; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.metric { background: #191d1e; border: 1px solid #303634; border-top: 2px solid #806b38; padding: 16px 18px; min-height: 100px; }
.metric span { color: var(--text-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .7px; }
.metric strong { display: block; margin-top: 10px; font: 1.8rem Georgia, serif; color: #f1e3b8; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.section-title h2, .section-title h3 { margin: 0; }
.server-row, .machine-row { display: grid; grid-template-columns: minmax(160px, 1.5fr) minmax(120px, 1fr) minmax(120px, 1fr) auto; align-items: center; gap: 14px; padding: 14px 4px; border-top: 1px solid var(--border); }
.server-row:first-of-type, .machine-row:first-of-type { border-top: 0; }
.row-title { color: var(--text); font-weight: 600; text-decoration: none; }
.row-title:hover { color: var(--gold-soft); }
.row-meta { color: var(--text-muted); font-size: .82rem; }
.status-dot { display: inline-flex; align-items: center; gap: 7px; color: var(--text-muted); font-size: .82rem; }
.status-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); }
.status-dot.online::before { background: var(--green); box-shadow: 0 0 9px #65c28c55; }
.status-dot.stale::before { background: var(--amber); }
.status-dot.offline::before { background: var(--red); }
.badge { border-radius: 4px; padding: 4px 8px; font-size: .73rem; }
.button, button.primary, input[type=submit] { background: #b99748; background-image: none; border-radius: 4px; color: #171713; font-weight: 700; }
button.secondary { border-radius: 4px; }
.icon-button { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 1rem; padding: 8px; }
.icon-button:hover { color: var(--gold-soft); }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--border); margin: -4px 0 20px; }
.tab-button { flex: 0 0 auto; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--text-muted); padding: 12px 15px; cursor: pointer; font: inherit; }
.tab-button[aria-selected="true"] { color: var(--gold-soft); border-bottom-color: var(--gold); }
.tab-panel[hidden] { display: none; }
.setting-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.setting { padding: 13px 0; border-bottom: 1px solid #2d3330; }
.setting label { margin: 0 0 7px; color: #e0e4df; font-size: .9rem; }
.setting small { display: block; margin-top: 5px; color: var(--text-muted); font-size: .75rem; line-height: 1.45; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 38px; height: 22px; display: inline-block; border-radius: 15px; background: #515957; position: relative; transition: background .18s ease; }
.switch-track::after { content: ""; position: absolute; width: 16px; height: 16px; top: 3px; left: 3px; background: #f3f3ed; border-radius: 50%; transition: transform .18s ease; }
.switch input:checked + .switch-track { background: #9c7e39; }
.switch input:checked + .switch-track::after { transform: translateX(16px); }
.save-dock { position: sticky; bottom: 12px; z-index: 5; display: none; align-items: center; justify-content: space-between; gap: 20px; padding: 13px 16px; margin: 18px 0 0; background: #24231f; border: 1px solid #9c7e39; box-shadow: 0 12px 35px #0008; }
.save-dock.visible { display: flex; }
.save-summary { min-width: 0; color: var(--text-muted); font-size: .82rem; }
.save-summary strong { display: block; color: var(--gold-soft); margin-bottom: 4px; }
.save-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.diff-list { margin: 0; padding-left: 18px; }
.diff-list li { margin: 3px 0; }
.diff-old { color: #e79a9d; text-decoration: line-through; }
.diff-new { color: #93ddb0; }
.alert { border-radius: 4px; }
.notice-stale { padding: 11px 14px; margin-bottom: 16px; color: #f0ca76; background: #382f1c; border-left: 3px solid #d3a94b; }
.table-wrap { overflow-x: auto; }
table { min-width: 600px; }
th, td { padding: 11px 10px; }
th { letter-spacing: .6px; }
input[type=text], input[type=email], input[type=password], input[type=number], select { border-radius: 4px; min-height: 40px; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
details summary { cursor: pointer; color: var(--gold-soft); }
code.token { border: 1px solid var(--border); }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 205px minmax(0,1fr); }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 680px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .mobile-top { display: flex; position: sticky; top: 0; z-index: 8; background: #171a1b; border-bottom: 1px solid var(--border); align-items: center; justify-content: space-between; padding: 10px 14px; }
  .mobile-top .brand { padding: 0; }
  .mobile-nav { display: flex; position: sticky; top: 51px; z-index: 7; overflow-x: auto; background: #171a1b; border-bottom: 1px solid var(--border); gap: 4px; padding: 6px 10px; }
  .mobile-nav a { flex: 1 0 auto; text-align: center; color: var(--text-muted); padding: 9px 12px; text-decoration: none; font-size: .82rem; }
  .content { padding: 22px 13px 100px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .metric-grid { gap: 8px; }
  .metric { min-height: 88px; padding: 13px; }
  .metric strong { font-size: 1.5rem; }
  .server-row, .machine-row { grid-template-columns: 1fr auto; gap: 8px; }
  .row-meta:nth-child(3) { grid-column: 1; }
  .setting-grid { grid-template-columns: 1fr; }
  .save-dock { align-items: stretch; flex-direction: column; gap: 9px; }
  .save-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .tabs { margin-right: -13px; padding-right: 13px; }
}
