:root {
  --navy: #232f3e;
  --navy2: #2e3b4e;
  --orange: #ff9900;
  --blue: #0972d3;
  --blue-dark: #033160;
  --blue-bg: #f2f8fd;
  --bg: #f2f3f3;
  --surface: #ffffff;
  --text: #16191f;
  --muted: #5f6b7a;
  --border: #e9ebed;
  --border2: #d5dbdb;
  --ok: #037f0c;
  --ok-bg: #e8f5e9;
  --warn: #8d6605;
  --warn-bg: #fdf3d6;
  --err: #d91515;
  --err-bg: #fde7e7;
  --shadow: 0 1px 4px rgba(0,7,22,0.1), 0 0 0 1px rgba(0,7,22,0.06);
  --mono: ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Open Sans', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 20px;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); text-decoration: underline; }
code { font-family: var(--mono); background: var(--bg); padding: 1px 6px; border-radius: 4px; font-size: 12px; }

/* buttons */
button { font: inherit; cursor: pointer; }
.btn {
  background: var(--blue); color: #fff; border: 2px solid var(--blue);
  border-radius: 20px; font-weight: 700; padding: 7px 18px; min-height: 40px;
}
.btn:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-accent { background: var(--orange); border-color: var(--orange); color: #0f141a; }
.btn-accent:hover { background: #e88b00; border-color: #e88b00; }
.btn-ghost { background: #fff; color: var(--blue); border: 2px solid var(--blue); border-radius: 20px; font-weight: 700; padding: 7px 16px; min-height: 40px; }
.btn-ghost:hover { background: var(--blue-bg); }
.btn-sm { min-height: 32px; padding: 4px 12px; font-weight: 600; font-size: 13px; }
.btn-danger { background: #fff; color: var(--err); border: 2px solid var(--err); border-radius: 20px; font-weight: 600; padding: 4px 12px; min-height: 32px; }
.btn-danger:hover { background: var(--err-bg); }
.icon-btn { background: transparent; border: 0; color: inherit; min-width: 40px; min-height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 8px; }
.icon-btn:hover { background: rgba(0,0,0,0.06); }

/* inputs */
input, textarea, select {
  font: inherit; width: 100%; background: #fff; color: var(--text);
  border: 2px solid var(--border2); border-radius: 8px; padding: 8px 10px;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--blue); }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.field b { color: var(--text); font-weight: 700; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: #fff; border-radius: 14px; padding: 32px; width: 340px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { font-size: 20px; margin: 0; display: flex; align-items: center; gap: 10px; }
.logo { width: 34px; height: 34px; border-radius: 7px; background: var(--navy); color: var(--orange); font-weight: 700; font-size: 12px; display: flex; align-items: center; justify-content: center; flex: none; }

/* ---------- app shell ---------- */
.app { display: flex; flex-wrap: wrap; min-height: 100vh; }

.sidebar { flex: 1 1 300px; max-width: 320px; background: #fff; border-right: 1px solid var(--border2); display: flex; flex-direction: column; min-height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.side-brand .t { font-weight: 700; font-size: 15px; line-height: 18px; }
.side-brand .s { color: var(--muted); font-size: 12px; }
.side-actions { padding: 14px 16px 10px; display: flex; flex-direction: column; gap: 10px; }
.side-actions .btn { display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 10px; }
.search { display: flex; align-items: center; gap: 8px; border: 2px solid var(--border2); border-radius: 8px; padding: 0 10px; height: 38px; color: var(--muted); }
.search input { border: 0; padding: 0; height: 34px; }
.search input:focus { outline: none; }
.side-label { padding: 6px 18px 4px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.camp-list { flex: 1; overflow-y: auto; padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.camp-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border-radius: 10px; border-left: 3px solid transparent; color: var(--text); cursor: pointer; background: none; text-align: left; width: 100%; border-top: 0; border-right: 0; border-bottom: 0; }
.camp-item:hover { background: #f7f8f8; }
.camp-item.active { background: var(--blue-bg); border-left-color: var(--blue); }
.camp-item .nm { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.camp-item .sub { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; margin-top: 6px; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.err { background: var(--err); } .dot.idle { background: #b6bec9; }
.side-footer { border-top: 1px solid var(--border); padding: 12px 14px; display: flex; align-items: center; gap: 8px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--blue); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; flex: none; }
.side-footer .who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 16px; }
.side-footer .who .r { color: var(--muted); font-size: 12px; }

/* ---------- workspace ---------- */
.workspace { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.view { display: flex; flex-direction: column; flex: 1; min-width: 0; }

.ctxbar { background: #fff; border-bottom: 1px solid var(--border2); padding: 16px 28px; display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.ctxbar h1 { margin: 0; font-size: 22px; line-height: 28px; font-weight: 700; }
.badges { display: flex; gap: 8px 14px; flex-wrap: wrap; align-items: center; color: #414d5c; font-size: 13px; margin-top: 8px; }
.ctx-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.tabs { background: #fff; border-bottom: 1px solid var(--border2); padding: 0 20px; display: flex; gap: 4px; flex-wrap: wrap; }
.tab { border: 0; background: transparent; font-weight: 700; padding: 12px 14px; color: #414d5c; border-bottom: 3px solid transparent; }
.tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab:disabled { color: #b6bec9; cursor: default; }

.content { flex: 1; min-width: 0; padding: 22px 28px 48px; }
.content-inner { max-width: 1120px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }

.section-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.section-head h2 { font-size: 18px; margin: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.card { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.card .label { color: var(--muted); font-weight: 600; }
.card .value { font-size: 24px; line-height: 28px; font-weight: 700; }

.panel { background: #fff; border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.panel-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 17px; }
.panel-body { padding: 20px; }

.progress { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.progress > div { height: 8px; background: var(--blue); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 20px; border-bottom: 1px solid var(--border); }
th { background: #fafafa; font-weight: 700; color: #414d5c; border-bottom: 1px solid var(--border2); }
tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

.pill { font-size: 12px; padding: 2px 9px; border-radius: 999px; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.err { background: var(--err-bg); color: var(--err); }
.pill.plain { background: var(--bg); color: var(--muted); }

.error { color: var(--err); }
.warning { background: var(--blue-bg); border: 2px solid var(--blue); border-radius: 12px; padding: 12px 18px; }

.form { display: flex; flex-direction: column; gap: 14px; max-width: 620px; }
.form .btn, .form .btn-accent { align-self: flex-start; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 200px; }

.dns-box { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 16px; }
.dns-row { font-family: var(--mono); font-size: 12px; word-break: break-all; padding: 4px 0; }

.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; color: var(--muted); padding: 60px 20px; }
.empty-state h2 { color: var(--text); margin: 0; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(16,25,35,0.45); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal-card { background: #fff; border-radius: 16px; width: 440px; max-width: 100%; max-height: 90vh; overflow-y: auto; box-shadow: 0 10px 40px rgba(0,0,0,0.25); }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 10px; box-shadow: var(--shadow); z-index: 100; max-width: 90vw; }
