:root {
  --primary: #4b7bec;
  --primary-light: #63a4ff;
  --accent: #20bf6b;
  --danger: #eb3b5a;
  --bg-light: #f7faff;
  --bg-dark: #181d23;
  --fg-light: #222;
  --fg-dark: #eee;
  --border: #e4ecf5;
  --radius: 16px;
  --shadow: 0 2px 24px 0 rgba(75, 123, 236, 0.09);
}

body {
  min-height: 100vh;
  background: linear-gradient(120deg, #4b7bec 0%, #20bf6b 100%);
  background-attachment: fixed;
  color: var(--fg-light);
  font-family: 'Segoe UI', Arial, sans-serif;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

.header-bar {
  width: 100%;
  background: linear-gradient(100deg, #4b7bec 80%, #20bf6b 100%);
  color: #fff;
  padding: 0 0.5em;
  height: 54px;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 1px;
  margin-left: 10px;
}
.header-user {
  font-size: 1rem;
  margin-right: 1em;
  font-weight: 400;
  opacity: 0.98;
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-user i {
  background: #fff4;
  color: #fff;
  font-size: 1.1em;
  padding: 0.1em 0.48em;
  border-radius: 1.2em;
}

.button, button, input[type="submit"] {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.7em 1.5em;
  font-size: 1.07em;
  font-weight: 500;
  cursor: pointer;
  margin-top: 0.2em;
  box-shadow: 0 2px 8px rgba(75,123,236,0.09);
  transition: background 0.18s, box-shadow 0.18s;
}
.button:active, button:active {
  background: #3968b3;
}
.button:focus, button:focus {
  outline: 2px solid #fff;
  background: #3968b3;
}

.main-card {
  max-width: 720px;
  margin: 3.5em auto 1.7em auto;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.2rem 2.5rem 2rem 2.5rem;
}
.main-card-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
@media (max-width: 600px) {
  .main-card {
    padding: 1.1rem 0.2rem 1.1rem 0.2rem;
    margin: 1.2em 0.1em 1.3em 0.1em;
    width: 100vw;
  }
}

/* Video area centralizada e responsiva */
.video-center-container {
  width: 100%;
  display: flex;
  justify-content: center;
  margin: 0 auto 1.5em auto;
}

.video-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 98vw;
  max-width: 700px;
  aspect-ratio: 4/3;
  background: #dbe8fa;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(75,123,236,0.11);
}

#video-stream, #canvas-overlay {
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  border-radius: 16px;
}

#video-stream {
  z-index: 1;
}

#canvas-overlay {
  z-index: 2;
  pointer-events: none;
}

@media (max-width: 900px) {
  .video-wrapper {
    max-width: 98vw;
    border-radius: 12px;
  }
}

@media (max-width: 600px) {
  .video-wrapper {
    max-width: 99vw;
    border-radius: 10px;
  }
  #video-stream, #canvas-overlay {
    border-radius: 10px;
  }
}

#detection-data {
  margin-top: 1.2em;
  font-size: 1.13em;
  min-height: 2.2em;
  text-align: center;
  width: 100%;
}

@media (max-width: 430px) {
  .video-wrapper { max-width: 100vw; }
  #detection-data { font-size: 0.97em; }
}

.login-container {
  min-height: 93vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2.6rem 2.8rem 2.2rem 2.8rem;
  max-width: 400px;
  width: 97vw;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.login-card h2 {
  margin-bottom: 1.6rem;
  color: var(--primary);
  font-weight: 700;
}
.login-card label {
  width: 100%;
  font-size: 1.08em;
  margin-bottom: 1.2em;
  color: #234;
}
.login-card input[type="text"],
.login-card input[type="password"],
.login-card input[type="email"] {
  width: 100%;
  padding: .75em;
  margin-top: 0.33em;
  font-size: 1.04em;
  border: 1.7px solid var(--border);
  border-radius: var(--radius);
  background: #f7fbff;
  transition: border .15s;
}
.login-card input:focus { border: 1.7px solid var(--primary); }
.login-card .error-msg {
  color: var(--danger);
  text-align: center;
  margin-top: 0.8em;
  margin-bottom: -0.5em;
}

@media (max-width: 600px) {
  .login-card { padding: 1.3em 0.7em 1.2em 0.7em; }
}
