/* Dezzington Services — Live Control Panel
   Design tokens */
:root {
  --bg: #0b1220;
  --bg-elevated: #101a2e;
  --surface: #16223b;
  --surface-hover: #1c2a47;
  --border: #263454;
  --border-soft: #1d2740;
  --text: #e8ecf6;
  --text-muted: #93a1c2;
  --text-faint: #64729a;
  --accent: #e8b64f;
  --accent-strong: #f2c869;
  --accent-ink: #2a1f04;
  --danger: #f0555c;
  --danger-strong: #ff6b72;
  --success: #3ecf8e;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

::selection {
  background: rgba(232, 182, 79, 0.35);
}

/* ---------- Brand ---------- */

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(155deg, var(--accent-strong), #b8862c);
  color: #241a02;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.brand-mark-lg {
  width: 56px;
  height: 56px;
  border-radius: var(--radius);
  font-size: 22px;
  box-shadow: 0 6px 18px rgba(232, 182, 79, 0.25);
}

.brand-name strong {
  color: var(--accent);
  font-weight: 700;
}

/* ---------- Top bar ---------- */

.topbar {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

.nav a {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav a:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav a.active {
  background: var(--surface);
  color: var(--accent);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.role-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
  display: inline-block;
}

.role-dot.role-admin {
  background: var(--accent);
}

.role-dot.role-user {
  background: var(--success);
}

/* ---------- Page layout ---------- */

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 28px 80px;
}

.page-narrow {
  max-width: 760px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.page-head h1 {
  font-size: 26px;
}

.page-sub {
  color: var(--text-muted);
  margin-top: 6px;
  font-size: 14.5px;
}

.text-muted {
  color: var(--text-muted);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(160deg, var(--accent-strong), #cf9a35);
  color: var(--accent-ink);
  box-shadow: 0 6px 16px rgba(232, 182, 79, 0.18);
}

.btn-primary:hover {
  box-shadow: 0 8px 22px rgba(232, 182, 79, 0.3);
}

.btn-block {
  width: 100%;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  background: transparent;
  border-color: rgba(240, 85, 92, 0.4);
  color: var(--danger-strong);
}

.btn-danger:hover {
  background: rgba(240, 85, 92, 0.1);
  border-color: var(--danger-strong);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.icon-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  width: 30px;
  height: 30px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.inline {
  display: inline-block;
}

/* ---------- Forms ---------- */

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13.5px;
  color: var(--text-muted);
  font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="number"],
select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14.5px;
  font-family: var(--font);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 182, 79, 0.15);
}

.hint {
  font-size: 12.5px;
  color: var(--text-faint);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- Auth pages ---------- */

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(circle at 20% -10%, rgba(232, 182, 79, 0.08), transparent 45%),
    var(--bg);
}

.auth-shell {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.auth-brand h1 {
  font-size: 20px;
  font-weight: 600;
}

.auth-brand h1 strong {
  color: var(--accent);
}

.auth-brand p {
  color: var(--text-faint);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.auth-card {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow);
}

.auth-card h2 {
  font-size: 19px;
  margin-bottom: 6px;
}

.auth-sub {
  color: var(--text-muted);
  font-size: 13.5px;
  margin-bottom: 20px;
}

.auth-footer {
  color: var(--text-faint);
  font-size: 12.5px;
}

/* ---------- Alerts ---------- */

.alert {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13.5px;
  margin-bottom: 18px;
}

.alert ul {
  margin: 0;
  padding-left: 18px;
}

.alert-error {
  background: rgba(240, 85, 92, 0.1);
  border: 1px solid rgba(240, 85, 92, 0.3);
  color: #ffb3b6;
}

/* ---------- Filter pills ---------- */

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill:hover {
  color: var(--text);
  border-color: var(--accent);
}

.pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

/* ---------- Card grid ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  animation: card-in 0.35s ease both;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--border);
  box-shadow: var(--shadow);
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
  font-weight: 700;
  overflow: hidden;
}

.card-icon img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.card-heading {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-heading h3 {
  font-size: 15.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-desc {
  color: var(--text-muted);
  font-size: 13.5px;
  flex: 1;
}

.card-meta {
  display: flex;
  gap: 6px;
}

.tag {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 999px;
}

.card-actions {
  margin-top: auto;
}

.conn-details {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

.conn-string {
  flex: 1;
  font-size: 12.5px;
  color: var(--text);
  overflow-x: auto;
  white-space: nowrap;
}

/* ---------- Badges ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  width: fit-content;
}

.badge-protocol {
  background: rgba(147, 161, 194, 0.15);
  color: var(--text-muted);
}

.badge-http,
.badge-https {
  background: rgba(62, 207, 142, 0.15);
  color: var(--success);
}

.badge-rdp {
  background: rgba(120, 150, 255, 0.15);
  color: #93a8ff;
}

.badge-ssh,
.badge-sftp {
  background: rgba(232, 182, 79, 0.15);
  color: var(--accent);
}

.badge-success {
  background: rgba(62, 207, 142, 0.15);
  color: var(--success);
}

.badge-muted {
  background: rgba(147, 161, 194, 0.12);
  color: var(--text-faint);
}

.badge-accent {
  background: rgba(232, 182, 79, 0.15);
  color: var(--accent);
}

/* ---------- Status dot ---------- */

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-unknown {
  background: var(--text-faint);
}

.status-online {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.18);
  animation: pulse 2s ease-in-out infinite;
}

.status-offline {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(240, 85, 92, 0.18);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

/* ---------- Empty state ---------- */

.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 60px 20px;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* ---------- Admin table ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  margin-bottom: 32px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.admin-table th {
  text-align: left;
  padding: 12px 16px;
  color: var(--text-faint);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border-soft);
}

.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.admin-table tr.row-disabled {
  opacity: 0.5;
}

.cell-title {
  font-weight: 600;
}

.cell-sub {
  color: var(--text-faint);
  font-size: 12px;
  margin-top: 2px;
}

.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12.5px;
  color: var(--text-muted);
}

.col-icon {
  width: 40px;
}

.row-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: contain;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px;
}

.row-icon-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
}

.col-actions {
  text-align: right;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
}

/* ---------- Form card (add/edit) ---------- */

.form-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 28px;
}

.form-card-title {
  font-size: 17px;
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.span-2 {
  grid-column: span 2;
}

.icon-picker {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 24px;
}

.icon-picker legend {
  padding: 0 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
}

.icon-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.icon-choice input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.icon-swatch {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.icon-swatch img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.icon-swatch-none {
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
}

.icon-choice input:checked + .icon-swatch {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 182, 79, 0.18);
  color: var(--accent);
}

.form-toggles {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.toggle-row {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 400;
  font-size: 14px;
}

.toggle-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 28px;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .topbar-inner {
    flex-wrap: wrap;
    padding: 12px 16px;
  }

  .nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .page {
    padding: 24px 16px 60px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }
}
