@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@500;700;800&family=Manrope:wght@400;500;600;700&display=swap');

:root {
  --bg: #eef2ef;
  --bg-accent: #d9e2da;
  --surface: #ffffff;
  --surface-strong: #f6f8f7;
  --surface-muted: #e6ece8;
  --text: #1f2924;
  --text-soft: #5f6f64;
  --line: #cfdbd2;
  --primary: #174f3c;
  --primary-strong: #10392b;
  --success: #1d7f4b;
  --danger: #c13a2e;
  --warning: #a36a07;
  --shadow-sm: 0 10px 24px rgba(16, 40, 30, 0.08);
  --shadow-md: 0 18px 42px rgba(10, 29, 21, 0.14);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
}

html[data-theme='dark'] {
  --bg: #111915;
  --bg-accent: #1b2a23;
  --surface: #1a241f;
  --surface-strong: #202e27;
  --surface-muted: #293831;
  --text: #e7f0ea;
  --text-soft: #9ab2a5;
  --line: #34463c;
  --primary: #67c59f;
  --primary-strong: #8be1bb;
  --shadow-sm: 0 14px 28px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 24px 50px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--text);
  font-family: 'Manrope', 'Segoe UI', sans-serif;
  line-height: 1.45;
  background:
    radial-gradient(circle at 12% -8%, rgba(23, 79, 60, 0.2), transparent 45%),
    radial-gradient(circle at 100% 0, rgba(81, 125, 104, 0.22), transparent 40%),
    linear-gradient(180deg, var(--bg-accent) 0%, var(--bg) 28%, var(--bg) 100%);
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: 'Barlow', 'Franklin Gothic Medium', sans-serif;
  font-weight: 700;
  letter-spacing: 0.02em;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-strong);
}

.page-shell {
  width: min(1240px, 94vw);
  margin: 34px auto;
  animation: fade-slide 420ms ease;
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 30px;
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 6px;
  background: linear-gradient(90deg, var(--primary) 0%, #4f876e 65%, #9ac4ac 100%);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.auth-brand img {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.auth-brand h1 {
  font-size: 1.55rem;
}

.auth-note {
  color: var(--text-soft);
  margin: 0 0 16px;
  font-size: 0.95rem;
}

.container {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 24px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px;
  margin-bottom: 16px;
}

.toolbar-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar-slot {
  flex: 1;
}

.header-flex {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.logo-img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.header-flex h1 {
  font-size: clamp(1.35rem, 2.4vw, 2rem);
}

form {
  margin: 0;
}

label {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: 0.92rem;
}

input,
select,
textarea,
button,
.button,
.toolbar-btn {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 79, 60, 0.2);
}

button,
.button,
.toolbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary) 0%, #2a6a52 100%);
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.2s ease;
}

button:hover,
.button:hover,
.toolbar-btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  transform: none;
}

.ghost-btn {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--line);
}

.error-message,
.error,
.flash-error {
  color: #8a261f;
  background: #fcebe8;
  border: 1px solid #f3c0b9;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 0 0 12px;
}

.flash-success {
  color: #145733;
  background: #e8f6ed;
  border: 1px solid #b3e1c3;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 0 0 12px;
}

.warning {
  color: #7d5008;
  font-size: 0.88rem;
  margin: -4px 0 10px;
}

.password-container {
  position: relative;
}

.password-container input {
  padding-right: 84px;
}

.toggle-password {
  position: absolute;
  right: 8px;
  top: 8px;
  bottom: 8px;
  width: auto;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--text);
  padding: 0 12px;
  font-size: 0.85rem;
}

.password-reset-panel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

#progressContainer {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
}

progress {
  width: 100%;
}

#uploadResult,
#uploadMessage {
  margin-top: 10px;
  font-weight: 600;
}

.simple-card {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
}

.footer-links {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

@keyframes fade-slide {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .page-shell {
    width: 95vw;
    margin: 20px auto;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-group {
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .container,
  .auth-card {
    border-radius: 18px;
    padding: 18px;
  }

  .header-flex {
    gap: 10px;
  }

  .header-flex h1 {
    font-size: 1.26rem;
  }
}
