:root {
  color-scheme: light;
  --bg: #fff7fb;
  --panel: #ffffff;
  --line: #f0d9e8;
  --text: #34233a;
  --muted: #8a6f86;
  --accent: #ff70a6;
  --accent-dark: #e64988;
  --soft: #fff0f7;
  --danger: #e5484d;
  --warn: #936100;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, #ffe1ef 0, transparent 24%),
    radial-gradient(circle at 90% 18%, #e0f2ff 0, transparent 22%),
    var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
button, .button, input, select {
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font: inherit;
}
button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button:hover, .button:hover { background: var(--accent-dark); }
button:disabled {
  border-color: #d8d0d7;
  background: #e9e4ea;
  color: #9a8d99;
  cursor: not-allowed;
}
input, select { min-width: 220px; padding: 0 10px; background: #fff; color: var(--text); }
.ghost { background: #fff; color: var(--accent); }
.ghost:hover { background: #eef5ff; }
.secondary { background: #42526e; border-color: #42526e; }
.danger { background: var(--danger); border-color: var(--danger); }
.full { width: 100%; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 220px;
  padding: 20px 14px;
  background: linear-gradient(180deg, #5c4267, #3b2a45);
  color: #fff;
  box-shadow: 8px 0 24px rgba(92, 66, 103, 0.18);
}
.brand { margin: 0 0 22px 6px; font-size: 20px; font-weight: 800; }
.brand::before { content: "☁ "; }
.sidebar nav { display: grid; gap: 6px; margin-bottom: 22px; }
.sidebar a {
  display: block;
  padding: 10px 12px;
  border-radius: 6px;
  color: #d0d5dd;
}
.sidebar a.active, .sidebar a:hover { background: rgba(255,255,255,0.14); color: #fff; }
.main { margin-left: 220px; padding: 28px; }
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
h1, h2, p { margin: 0; }
h1 { font-size: 24px; }
h2 { font-size: 17px; }
.page-head p { margin-top: 4px; color: var(--muted); }

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.metrics div, .panel, .detail, .notice {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(92, 66, 103, 0.08);
}
.metrics div { padding: 14px; }
.metrics span { display: block; color: var(--muted); }
.metrics strong { display: block; margin-top: 6px; font-size: 24px; }
.panel { overflow: hidden; }
.panel-head, .toolbar, .actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
}
.panel-head { justify-content: space-between; border-bottom: 1px solid var(--line); }
.toolbar { margin-bottom: 14px; padding: 0; }
.notice { margin-bottom: 14px; padding: 12px 14px; }
.notice.warn { color: var(--warn); background: #fff8e6; }
.notice.success { color: #176b42; background: #e9fff3; }
.danger-text { color: var(--danger); font-weight: 800; }
.ok-text { color: #176b42; font-weight: 800; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: var(--soft); color: var(--muted); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); text-align: center; padding: 28px; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: flex-end; padding: 12px; color: var(--muted); }

.detail { padding: 16px; max-width: 860px; }
dl { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; }
.actions { align-items: flex-start; padding-left: 0; flex-wrap: wrap; }
.actions form { display: flex; gap: 8px; }
.compact-actions { padding-left: 0; padding-bottom: 0; }
.form-panel { padding: 16px; margin-bottom: 16px; }
.stack-form { display: grid; gap: 10px; max-width: 820px; }
.stack-form input, .stack-form select, .stack-form textarea { width: 100%; }
.stack-form textarea {
  min-height: 120px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  resize: vertical;
  font: inherit;
}
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { min-width: 360px; }
.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 14px; align-items: start; }
.format-help {
  padding: 14px;
  border: 1px dashed #f2a6c5;
  border-radius: 12px;
  background: #fff8fc;
  color: var(--muted);
}
.format-help h2 { margin-bottom: 10px; color: var(--text); }
.format-help p { margin: 8px 0; }
.hint { margin: 4px 0 8px; color: var(--muted); }
.cert-days, .service-status { margin-top: 8px; font-size: 18px; }
.console-head { padding: 0 0 12px; border-bottom: 0; }
.console-output {
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: #241b2b;
  color: #f7f2fb;
  font: 13px/1.5 Consolas, "Courier New", monospace;
  white-space: pre-wrap;
}
code { padding: 2px 5px; border-radius: 4px; background: #eef2f6; }

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 16%, #ffd6e7 0, transparent 24%),
    radial-gradient(circle at 85% 24%, #ccecff 0, transparent 24%),
    #4d365a;
}
.login-box {
  width: min(380px, calc(100vw - 32px));
  padding: 24px;
  border-radius: 16px;
  background: #fff;
}
.login-box h1 { margin-bottom: 6px; }
.login-box p { margin-bottom: 16px; color: var(--muted); }
.login-box input, .login-box button { width: 100%; margin-top: 10px; }
.alert { padding: 10px; border-radius: 6px; background: #fff1f0; color: var(--danger); }

@media (max-width: 900px) {
  .sidebar { position: static; width: auto; }
  .main { margin-left: 0; padding: 18px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .toolbar, .actions { flex-direction: column; align-items: stretch; }
  .two-cols, .editor-grid { grid-template-columns: 1fr; }
  input, select, button, .button { width: 100%; }
  table { min-width: 760px; }
  .panel { overflow-x: auto; }
}
