/*
 * X3WEB Control Hub styling.
 *
 * Visual direction:
 * - white and #51b6e7 as the main palette,
 * - black/dark text in light mode,
 * - clean rounded website-like layout,
 * - dark mode that properly affects the full layout, including the sidebar.
 */

:root {
  --blue: #51b6e7;
  --blue-dark: #1997d0;
  --bg: #f7fbfe;
  --card: #ffffff;
  --side: #ffffff;
  --side-button: #eef8fd;
  --text: #101820;
  --muted: #667085;
  --border: #dbeef8;
  --shadow: 0 18px 45px rgba(16, 24, 32, .08);
  --radius: 34px;
}

html[data-theme="dark"] {
  --bg: #0e141b;
  --card: #151e27;
  --side: #101820;
  --side-button: #1b2a36;
  --text: #f5fbff;
  --muted: #b8c5ce;
  --border: #243747;
  --shadow: 0 18px 45px rgba(0, 0, 0, .32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

.shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.side {
  padding: 28px;
  background: var(--side);
  color: var(--text);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  font-size: 28px;
  font-weight: 900;
  line-height: .95;
  margin-bottom: 20px;
}

.brand span {
  color: var(--blue);
}

.brand small {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

nav a,
.theme,
.logout,
.btn {
  border: 0;
  background: var(--side-button);
  color: var(--text);
  padding: 14px 18px;
  border-radius: 999px;
  font-weight: 800;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}

nav a:hover,
.theme:hover,
.logout:hover {
  background: var(--blue);
  color: #ffffff;
  transform: translateY(-1px);
}

html[data-theme="dark"] nav a,
html[data-theme="dark"] .theme,
html[data-theme="dark"] .logout {
  background: var(--side-button);
  color: #ffffff;
}

html[data-theme="dark"] nav a:hover,
html[data-theme="dark"] .theme:hover,
html[data-theme="dark"] .logout:hover {
  background: var(--blue);
  color: #101820;
}

.btn,
.primary {
  display: inline-block;
  background: var(--blue);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(81, 182, 231, .28);
}

.btn:hover,
.primary:hover {
  background: var(--blue-dark);
  color: #ffffff;
}

.logout {
  margin-top: auto;
  text-align: center;
}

.main {
  padding: 32px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  gap: 16px;
}

.top h1 {
  font-size: 34px;
  margin: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.card {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}

.hero {
  background: linear-gradient(135deg, #ffffff, #eaf8ff);
  border-radius: 42px;
  padding: 34px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

html[data-theme="dark"] .hero {
  background: linear-gradient(135deg, #172333, #101820);
}

.hero h2 {
  font-size: 38px;
  margin: 0 0 10px;
}

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

input,
select,
textarea {
  width: 100%;
  padding: 15px 18px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(81, 182, 231, .18);
}

label {
  font-weight: 800;
  margin: 14px 0 6px;
  display: block;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.table th {
  text-align: left;
  color: var(--muted);
  font-size: 13px;
}

.table td {
  background: var(--card);
  color: var(--text);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 14px;
}

.table td:first-child {
  border-left: 1px solid var(--border);
  border-radius: 18px 0 0 18px;
}

.table td:last-child {
  border-right: 1px solid var(--border);
  border-radius: 0 18px 18px 0;
}

.pill {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 999px;
  background: #eaf8ff;
  color: var(--blue-dark);
  font-weight: 900;
  font-size: 12px;
}

html[data-theme="dark"] .pill {
  background: #1b2a36;
  color: var(--blue);
}

.alert {
  padding: 14px 18px;
  border-radius: 22px;
  background: #fff4e5;
  color: #7a4d00;
  margin: 12px 0;
}

html[data-theme="dark"] .alert {
  background: #3a2c12;
  color: #ffd99a;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(440px, 100%);
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 42px;
  padding: 34px;
  box-shadow: var(--shadow);
}

@media (max-width: 850px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .side {
    position: static;
  }

  .grid,
  .row {
    grid-template-columns: 1fr;
  }
}