* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #07151c;
  --sidebar: #091b23;
  --panel: #0d222c;
  --panel-hover: #112d38;

  --blue: #55c9e8;
  --blue-bright: #83def4;
  --blue-dim: #2d7185;

  --text: #e8f7fa;
  --text-dim: #8baab4;
  --text-muted: #58737c;

  --border: rgba(85, 201, 232, 0.13);
  --border-bright: rgba(85, 201, 232, 0.28);

  --shadow: rgba(0, 0, 0, 0.35);
}

html,
body {
  width: 100%;
  min-height: 100%;
}

body {
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;

  background: var(--bg);
  color: var(--text);

  overflow-x: hidden;
}

.app {
  width: 100%;
  min-height: 100vh;

  display: flex;

  background:
    radial-gradient(
      circle at 65% 0%,
      rgba(42, 128, 155, 0.12),
      transparent 42%
    ),
    var(--bg);
}

/* --------------------------------------------------
   Sidebar
-------------------------------------------------- */

.sidebar {
  width: 245px;
  min-height: 100vh;

  flex-shrink: 0;

  display: flex;
  flex-direction: column;

  padding: 26px 18px;

  background:
    linear-gradient(
      180deg,
      rgba(12, 34, 44, 0.96),
      rgba(7, 22, 29, 0.98)
    );

  border-right: 1px solid var(--border);

  box-shadow:
    10px 0 35px rgba(0, 0, 0, 0.12);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;

  padding: 4px 10px 30px;
}

.brand-mark {
  width: 38px;
  height: 38px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid var(--border-bright);
  border-radius: 10px;

  background: rgba(85, 201, 232, 0.08);

  color: var(--blue);

  font-size: 20px;
  font-weight: 500;

  box-shadow:
    0 0 20px rgba(85, 201, 232, 0.08);
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.brand-status {
  margin-top: 3px;

  font-size: 9px;
  letter-spacing: 0.12em;

  color: var(--blue);
}

.sidebar-section {
  margin-bottom: 28px;
}

.section-label {
  margin: 0 10px 10px;

  font-size: 9px;
  font-weight: 600;

  letter-spacing: 0.16em;

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

.control-button {
  width: 100%;
  min-height: 44px;

  display: flex;
  align-items: center;

  gap: 12px;

  padding: 0 13px;
  margin-bottom: 7px;

  border: 1px solid transparent;
  border-radius: 9px;

  background: rgba(255, 255, 255, 0.025);

  color: var(--text-dim);

  font-size: 13px;
  font-weight: 500;

  text-align: left;

  cursor: pointer;

  transition:
    background 0.2s,
    border-color 0.2s,
    color 0.2s,
    box-shadow 0.2s;
}

.control-button:hover {
  background: rgba(85, 201, 232, 0.08);
  border-color: var(--border);
  color: var(--blue-bright);
}

.control-button:active {
  transform: translateY(1px);
}

.control-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.control-icon {
  width: 20px;
  text-align: center;
  color: var(--blue);
  font-size: 16px;
}

.control-status {
  min-height: 18px;

  padding: 3px 13px;

  font-size: 10px;
  color: var(--text-muted);
}

.light-controls {
  display: flex;
  gap: 7px;
}

.light-controls .light-button {
  justify-content: center;
  margin-bottom: 0;
  padding: 0 8px;
}

.sidebar-spacer {
  flex: 1;
}

.sidebar-nav {
  padding-top: 15px;
  border-top: 1px solid var(--border);
}

.nav-button {
  width: 100%;
  height: 42px;

  display: flex;
  align-items: center;

  gap: 12px;

  padding: 0 13px;

  border: none;
  border-radius: 9px;

  background: transparent;

  color: var(--text-muted);

  font-size: 13px;

  cursor: pointer;
  text-align: left;
}

.nav-button span {
  width: 18px;
  text-align: center;
  color: var(--text-muted);
}

.nav-button:hover {
  background: rgba(85, 201, 232, 0.06);
  color: var(--text-dim);
}

.nav-button.active {
  background: rgba(85, 201, 232, 0.09);
  color: var(--blue-bright);
}

.nav-button.active span {
  color: var(--blue);
}

/* --------------------------------------------------
   Main
-------------------------------------------------- */

.main-content {
  flex: 1;
  min-width: 0;
  min-height: 100vh;

  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 82px;
  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 0 42px;

  border-bottom: 1px solid var(--border);
}

.page-label {
  margin-bottom: 4px;

  font-size: 9px;
  font-weight: 600;

  letter-spacing: 0.18em;

  color: var(--blue-dim);
}

.topbar h1 {
  font-size: 20px;
  font-weight: 500;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 8px;

  font-size: 9px;
  font-weight: 600;

  letter-spacing: 0.12em;

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

.status-dot {
  width: 6px;
  height: 6px;

  display: inline-block;

  border-radius: 50%;

  background: var(--blue);

  box-shadow:
    0 0 10px rgba(85, 201, 232, 0.6);
}

/* --------------------------------------------------
   Dashboard
-------------------------------------------------- */

.dashboard {
  width: 100%;
  max-width: 1050px;

  margin: 0 auto;

  padding: 55px 42px;

  overflow-y: auto;
}

.welcome-card {
  display: flex;
  align-items: center;

  gap: 24px;

  padding: 30px;

  border: 1px solid var(--border);
  border-radius: 14px;

  background:
    linear-gradient(
      135deg,
      rgba(13, 40, 51, 0.8),
      rgba(8, 25, 32, 0.7)
    );

  box-shadow:
    0 15px 45px var(--shadow);
}

.tarvis-symbol {
  width: 64px;
  height: 64px;

  flex-shrink: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border: 1px solid var(--border-bright);
  border-radius: 16px;

  color: var(--blue);

  font-size: 30px;
  font-weight: 300;

  background: rgba(85, 201, 232, 0.06);

  box-shadow:
    0 0 35px rgba(85, 201, 232, 0.08);
}

.welcome-label {
  margin-bottom: 5px;

  font-size: 9px;
  font-weight: 600;

  letter-spacing: 0.16em;

  color: var(--blue-dim);
}

.welcome-card h2 {
  font-size: 25px;
  font-weight: 500;

  margin-bottom: 5px;
}

.welcome-card p {
  color: var(--text-dim);
  font-size: 13px;
}

.dashboard-grid {
  display: grid;

  grid-template-columns: repeat(2, 1fr);

  gap: 18px;

  margin-top: 20px;
}

.dashboard-card {
  min-height: 150px;

  padding: 24px;

  border: 1px solid var(--border);
  border-radius: 13px;

  background: rgba(13, 34, 44, 0.55);
}

.dashboard-card:hover {
  border-color: var(--border-bright);
  background: rgba(17, 45, 56, 0.65);
}

.card-label {
  font-size: 9px;
  font-weight: 600;

  letter-spacing: 0.16em;

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

.card-title {
  margin-top: 20px;

  font-size: 19px;
  font-weight: 500;
}

.card-status {
  display: flex;
  align-items: center;

  gap: 8px;

  margin-top: 10px;

  font-size: 11px;

  color: var(--text-dim);
}

/* --------------------------------------------------
   Mobile
-------------------------------------------------- */

@media (max-width: 700px) {

  .app {
    min-height: 100vh;
  }

  .sidebar {
    width: 190px;
    padding: 20px 12px;
  }

  .topbar {
    padding: 0 25px;
  }

  .dashboard {
    padding: 35px 25px;
  }

  .welcome-card {
    padding: 22px;
  }

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


/* --------------------------------------------------
   Phone
-------------------------------------------------- */

@media (max-width: 600px) {

  .app {
    display: block;
  }

  .sidebar {
    width: 100%;
    min-height: auto;

    padding: 14px 14px 10px;

    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .brand {
    padding: 4px 8px 14px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .sidebar-section {
    margin-bottom: 12px;
  }

  .section-label {
    margin-bottom: 7px;
  }

  .control-button {
    min-height: 42px;
    margin-bottom: 6px;
  }

  .light-controls {
    display: flex;
  }

  .sidebar-nav {
    display: none;
  }

  .main-content {
    width: 100%;
    min-height: auto;
  }

  .topbar {
    min-height: 70px;
    padding: 0 18px;
  }

  .topbar h1 {
    font-size: 18px;
  }

  .system-status {
    display: none;
  }

  .dashboard {
    width: 100%;
    max-width: none;

    padding: 20px 14px 30px;
  }

  .welcome-card {
    width: 100%;

    padding: 20px;

    gap: 16px;
  }

  .tarvis-symbol {
    width: 52px;
    height: 52px;

    border-radius: 13px;

    font-size: 25px;
  }

  .welcome-card h2 {
    font-size: 21px;
  }

  .welcome-card p {
    font-size: 12px;
  }

  .dashboard-grid {
    width: 100%;

    grid-template-columns: 1fr;

    gap: 12px;

    margin-top: 14px;
  }

  .dashboard-card {
    min-height: 120px;
    padding: 20px;
  }

}


/* --------------------------------------------------
   Small phone
-------------------------------------------------- */

@media (max-width: 400px) {

  .sidebar {
    padding: 12px 10px 8px;
  }

  .brand-name {
    font-size: 13px;
  }

  .topbar {
    padding: 0 14px;
  }

  .dashboard {
    padding: 16px 10px 25px;
  }

  .welcome-card {
    padding: 17px;
  }

}

/* TARVIS LOGIN */

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #06111b;
}

.login-card {
  width: min(420px, calc(100% - 40px));
  padding: 42px;
  text-align: center;
  background: #0b1b29;
  border: 1px solid rgba(80, 210, 220, 0.2);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.login-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(80, 210, 220, 0.5);
  border-radius: 50%;
  color: #70e0e8;
  font-size: 28px;
  font-weight: 600;
}

.login-label {
  margin-bottom: 8px;
  color: #70e0e8;
  font-size: 11px;
  letter-spacing: 3px;
}

.login-card h1 {
  margin: 0;
  color: #ffffff;
  font-size: 32px;
  font-weight: 500;
}

.login-card p {
  margin: 10px 0 28px;
  color: #8295a5;
}

.login-card input {
  box-sizing: border-box;
  width: 100%;
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(130, 170, 190, 0.2);
  border-radius: 8px;
  outline: none;
  background: #071521;
  color: #ffffff;
  font-size: 14px;
}

.login-card input:focus {
  border-color: rgba(112, 224, 232, 0.6);
}

.login-button {
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  border: 0;
  border-radius: 8px;
  background: #70e0e8;
  color: #06111b;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
}

.login-error {
  min-height: 20px;
  margin-top: 14px;
  color: #ff7d7d;
  font-size: 13px;
}



/* ===== TARVIS CHAT ===== */

.chat-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.chat-view .topbar {
  flex-shrink: 0;
}

.chat {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-form {
  display: flex;
  gap: 12px;
  padding: 16px 0 24px;
  flex-shrink: 0;
}

.chat-form input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid #333;
  border-radius: 8px;
  background: #111;
  color: #fff;
  font-size: 15px;
  outline: none;
}

.chat-form input:focus {
  border-color: #666;
}

.chat-form button {
  padding: 14px 22px;
  border: none;
  border-radius: 8px;
  background: #fff;
  color: #000;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.chat-form button:hover {
  opacity: 0.85;
}


/* ===== TARVIS CHAT ===== */

.chat-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.chat-view .topbar {
  flex-shrink: 0;
}

.chat {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 8px 24px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Message rows */

.chat .message {
  display: flex;
  width: 100%;
}

.chat .message.user {
  justify-content: flex-end;
}

.chat .message.tarvis {
  justify-content: flex-start;
}

/* Message bubbles */

.chat .message-text {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 18px;
  line-height: 1.5;
  font-size: 15px;
  overflow-wrap: anywhere;
}

/* User bubble */

.chat .message.user .message-text {
  background: #2b2b2b;
  color: #fff;
  border-bottom-right-radius: 5px;
}

/* Tarvis bubble */

.chat .message.tarvis .message-text {
  background: #171717;
  color: #fff;
  border: 1px solid #2d2d2d;
  border-bottom-left-radius: 5px;
}

/* Chat input area */

.chat-form {
  display: flex;
  gap: 12px;
  padding: 12px 0 20px;
  flex-shrink: 0;
  background: inherit;
}

.chat-form input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid #333;
  border-radius: 10px;
  background: #111;
  color: #fff;
  font-size: 15px;
  outline: none;
}

.chat-form input:focus {
  border-color: #666;
}

.chat-form button {
  padding: 14px 22px;
  border: none;
  border-radius: 10px;
  background: #fff;
  color: #000;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.chat-form button:hover {
  opacity: 0.85;
}


/* ===== TARVIS CHAT LAYOUT FIX ===== */

.chat-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.chat-view .topbar {
  flex-shrink: 0;
}

.chat {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 8px 24px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Every message */

.chat .message {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* User messages on the right */

.chat .user-message {
  align-items: flex-end;
}

/* Tarvis messages on the left */

.chat .tarvis-message {
  align-items: flex-start;
}

/* Sender name */

.chat .message-name {
  font-size: 12px;
  opacity: 0.55;
  margin-bottom: 4px;
}

/* Bubble */

.chat .message-text {
  max-width: 75%;
  padding: 12px 16px;
  border-radius: 18px;
  line-height: 1.5;
  font-size: 15px;
  overflow-wrap: anywhere;
}

/* User bubble */

.chat .user-message .message-text {
  background: #2b2b2b;
  color: #fff;
  border-bottom-right-radius: 5px;
}

/* Tarvis bubble */

.chat .tarvis-message .message-text {
  background: #171717;
  color: #fff;
  border: 1px solid #2d2d2d;
  border-bottom-left-radius: 5px;
}

/* Input area stays at bottom */

.chat-form {
  display: flex;
  gap: 12px;
  padding: 12px 0 20px;
  flex-shrink: 0;
  margin-top: auto;
}

.chat-form input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid #333;
  border-radius: 10px;
  background: #111;
  color: #fff;
  font-size: 15px;
  outline: none;
}

.chat-form input:focus {
  border-color: #666;
}

.chat-form button {
  padding: 14px 22px;
  border: none;
  border-radius: 10px;
  background: #fff;
  color: #000;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.chat-form button:hover {
  opacity: 0.85;
}

/* ===== FORCE CHAT TO FILL AVAILABLE SPACE ===== */

main {
  min-height: 0;
}

.chat-view {
  height: calc(100vh - 40px);
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chat-view .chat {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.chat-view .chat-form {
  flex: 0 0 auto;
  margin-top: auto;
}

/* ===== GARDEN LIGHT STATUS ===== */

.light-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 14px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  transition: all 0.2s ease;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  background: #888;
}

.light-status.is-on {
  background: rgba(255, 193, 7, 0.15);
}

.light-status.is-on .status-dot {
  background: #ffc107;
  box-shadow: 0 0 8px rgba(255, 193, 7, 0.8);
}

.light-status.is-off {
  opacity: 0.7;
}

.light-status.is-off .status-dot {
  background: #666;
}

