* {
  box-sizing: border-box;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.language-switcher {
  position: fixed;
  top: 60px;
  right: 20px;
  z-index: 10;
}

.logo-banner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 50px;
  background: #0b4f6c;
  display: flex;
  align-items: center;
  padding: 0 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  z-index: 1000;
}

.logo-banner a {
  text-decoration: none;
  color: white;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.2rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 10px;
}

.language-switcher select {
  --flag-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='12' viewBox='0 0 18 12'%3E%3Crect width='18' height='12' fill='%23b22234'/%3E%3Cg fill='%23ffffff'%3E%3Crect y='2' width='18' height='2'/%3E%3Crect y='6' width='18' height='2'/%3E%3Crect y='10' width='18' height='2'/%3E%3C/g%3E%3Crect width='7' height='6' fill='%232e3a87'/%3E%3Ccircle cx='1.6' cy='1.4' r='0.6' fill='%23ffffff'/%3E%3Ccircle cx='3.4' cy='1.4' r='0.6' fill='%23ffffff'/%3E%3Ccircle cx='5.2' cy='1.4' r='0.6' fill='%23ffffff'/%3E%3Ccircle cx='1.6' cy='3.2' r='0.6' fill='%23ffffff'/%3E%3Ccircle cx='3.4' cy='3.2' r='0.6' fill='%23ffffff'/%3E%3Ccircle cx='5.2' cy='3.2' r='0.6' fill='%23ffffff'/%3E%3Ccircle cx='1.6' cy='5.0' r='0.6' fill='%23ffffff'/%3E%3Ccircle cx='3.4' cy='5.0' r='0.6' fill='%23ffffff'/%3E%3Ccircle cx='5.2' cy='5.0' r='0.6' fill='%23ffffff'/%3E%3C/svg%3E");
  appearance: none;
  border: 1px solid rgba(15, 20, 27, 0.2);
  border-radius: 999px;
  padding: 6px 30px 6px 36px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #fff;
  color: #0f141b;
  box-shadow: 0 6px 14px rgba(15, 20, 27, 0.12);
  background-image: var(--flag-icon),
    linear-gradient(45deg, transparent 50%, #0f141b 50%),
    linear-gradient(135deg, #0f141b 50%, transparent 50%);
  background-position: 10px center, calc(100% - 14px) calc(50% - 2px), calc(100% - 10px) calc(50% - 2px);
  background-size: 16px 11px, 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.language-switcher select:focus {
  outline: none;
  border-color: #0b4f6c;
  box-shadow: 0 0 0 3px rgba(11, 79, 108, 0.2);
}

.language-switcher select[data-lang="en"] {
  --flag-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='12' viewBox='0 0 18 12'%3E%3Crect width='18' height='12' fill='%23b22234'/%3E%3Cg fill='%23ffffff'%3E%3Crect y='2' width='18' height='2'/%3E%3Crect y='6' width='18' height='2'/%3E%3Crect y='10' width='18' height='2'/%3E%3C/g%3E%3Crect width='7' height='6' fill='%232e3a87'/%3E%3Ccircle cx='1.6' cy='1.4' r='0.6' fill='%23ffffff'/%3E%3Ccircle cx='3.4' cy='1.4' r='0.6' fill='%23ffffff'/%3E%3Ccircle cx='5.2' cy='1.4' r='0.6' fill='%23ffffff'/%3E%3Ccircle cx='1.6' cy='3.2' r='0.6' fill='%23ffffff'/%3E%3Ccircle cx='3.4' cy='3.2' r='0.6' fill='%23ffffff'/%3E%3Ccircle cx='5.2' cy='3.2' r='0.6' fill='%23ffffff'/%3E%3Ccircle cx='1.6' cy='5.0' r='0.6' fill='%23ffffff'/%3E%3Ccircle cx='3.4' cy='5.0' r='0.6' fill='%23ffffff'/%3E%3Ccircle cx='5.2' cy='5.0' r='0.6' fill='%23ffffff'/%3E%3C/svg%3E");
}

.language-switcher select[data-lang="es"] {
  --flag-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='12' viewBox='0 0 18 12'%3E%3Crect width='18' height='12' fill='%23aa151b'/%3E%3Crect y='3' width='18' height='6' fill='%23f1bf00'/%3E%3C/svg%3E");
}

.language-switcher select[data-lang="sv"] {
  --flag-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='12' viewBox='0 0 18 12'%3E%3Crect width='18' height='12' fill='%23006aa7'/%3E%3Crect x='5' width='3' height='12' fill='%23fecc00'/%3E%3Crect y='4.5' width='18' height='3' fill='%23fecc00'/%3E%3C/svg%3E");
}

.language-switcher select[data-lang="he"] {
  --flag-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='12' viewBox='0 0 18 12'%3E%3Crect width='18' height='12' fill='%23ffffff'/%3E%3Crect y='1' width='18' height='2' fill='%23003399'/%3E%3Crect y='9' width='18' height='2' fill='%23003399'/%3E%3Cpolygon points='9,3.2 10.1,5.1 12.3,5.1 10.5,6.4 11.2,8.3 9,7.1 6.8,8.3 7.5,6.4 5.7,5.1 7.9,5.1' fill='%23003399'/%3E%3Cpolygon points='9,8.8 7.9,6.9 5.7,6.9 7.5,5.6 6.8,3.7 9,4.9 11.2,3.7 10.5,5.6 12.3,6.9 10.1,6.9' fill='%23003399'/%3E%3C/svg%3E");
}

.language-switcher select[data-lang="ru"] {
  --flag-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='12' viewBox='0 0 18 12'%3E%3Crect width='18' height='12' fill='%23ffffff'/%3E%3Crect y='4' width='18' height='4' fill='%23003f9e'/%3E%3Crect y='8' width='18' height='4' fill='%23d52b1e'/%3E%3C/svg%3E");
}

body.page-signup {
  color-scheme: light;
  --ink: #0f141b;
  --muted: #4c5563;
  --accent: #0b4f6c;
  --accent-2: #ff6b35;
  --card: #f8f4f0;
  --shadow: 0 22px 60px rgba(15, 20, 27, 0.18);
  --radius: 24px;
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 15% 20%, #fef1e6 0%, #fde9d6 35%, #f3efe9 65%, #e9f1f4 100%);
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

.social-login {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 8px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  transition: transform 0.1s, box-shadow 0.1s;
  border: 1px solid rgba(0,0,0,0.1);
}

.btn-social:active {
  transform: scale(0.98);
}

.btn-social img {
  width: 18px;
  height: 18px;
}

.btn-google {
  background: white;
  color: #3c4043;
}

.btn-facebook {
  background: #1877f2;
  color: white;
}

.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 20px 0;
  color: #666;
  font-size: 0.9rem;
}

.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(0,0,0,0.1);
}

body.page-login .card {
  width: min(420px, 100%);
  background: var(--card, #fff);
  padding: 40px;
  border-radius: 24px;
  box-shadow: 0 22px 60px rgba(15, 20, 27, 0.1);
}

body.page-login {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 15% 20%, #fef1e6 0%, #fde9d6 35%, #f3efe9 65%, #e9f1f4 100%);
  font-family: "Space Grotesk", sans-serif;
}

body.page-signup .page {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 28px;
  align-items: stretch;
}

body.page-signup .hero {
  padding: 40px;
  border-radius: var(--radius);
  background: linear-gradient(140deg, #0b4f6c 0%, #124559 45%, #1b2a41 100%);
  color: #f5f7fb;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

body.page-signup .hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(255, 107, 53, 0.35), transparent 55%);
}

body.page-signup .hero h1 {
  position: relative;
  margin: 0 0 12px;
  font-size: clamp(2rem, 3vw, 3rem);
  letter-spacing: -0.02em;
}

body.page-signup .hero p {
  position: relative;
  margin: 0;
  color: rgba(245, 247, 251, 0.85);
  line-height: 1.5;
}

body.page-signup .card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 20px;
  animation: rise 0.6s ease-out both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body.page-signup .fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

body.page-signup .field {
  display: grid;
  gap: 6px;
}

body.page-signup label {
  font-size: 0.9rem;
  font-weight: 600;
}

body.page-signup input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(15, 20, 27, 0.15);
  font-size: 0.95rem;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.page-signup input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 79, 108, 0.2);
}

body.page-signup .full {
  grid-column: 1 / -1;
}

body.page-signup button {
  border: none;
  border-radius: 999px;
  padding: 14px 22px;
  font-size: 1rem;
  font-weight: 700;
  background: linear-gradient(120deg, var(--accent) 0%, #106581 55%, var(--accent-2) 100%);
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

body.page-signup button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(11, 79, 108, 0.3);
}

body.page-signup button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

body.page-signup .note {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

body.page-signup .field-hint {
  margin: 6px 0 0;
  padding-left: 18px;
  color: rgba(76, 85, 99, 0.65);
  font-size: 0.8rem;
  font-style: italic;
}

body.page-signup .field-hint li {
  margin: 2px 0;
}

body.page-signup .field-error {
  min-height: 1rem;
  font-size: 0.8rem;
  color: #b42318;
}

body.page-signup .helper {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

body.page-signup .helper a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

body.page-signup .helper a:hover {
  text-decoration: underline;
}

@media (max-width: 840px) {
  body.page-signup .page {
    grid-template-columns: 1fr;
  }
  body.page-signup .fields {
    grid-template-columns: 1fr;
  }
}

body.page-index {
  color-scheme: light;
  --ink: #0f141b;
  --muted: #4c5563;
  --accent: #0b4f6c;
  --accent-2: #ff6b35;
  --card: #f8f4f0;
  --shadow: 0 22px 60px rgba(15, 20, 27, 0.18);
  --radius: 22px;
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 12% 20%, #f7f0e6 0%, #f3efe9 45%, #e7eef2 100%);
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

body.page-index .card {
  width: min(720px, 100%);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px;
  display: grid;
  gap: 18px;
  text-align: center;
  animation: rise 0.55s ease-out both;
}

body.page-index h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.6rem);
  letter-spacing: -0.02em;
}

body.page-index p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

body.page-index .actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

body.page-index .actions a {
  text-decoration: none;
  color: #fff;
  background: linear-gradient(120deg, var(--accent) 0%, #106581 55%, var(--accent-2) 100%);
  padding: 12px 20px;
  border-radius: 999px;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

body.page-index .actions a:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(11, 79, 108, 0.3);
}

body.page-index .card a:not(.actions a) {
  color: var(--accent);
  text-decoration: underline;
  background: none;
  padding: 0;
  border-radius: 0;
  font-weight: normal;
  transition: color 0.2s ease;
}

body.page-index .card a:not(.actions a):hover {
  color: var(--accent-2);
  transform: none;
  box-shadow: none;
}

body.page-index ul {
  text-align: left;
  margin: 10px 0;
  padding-left: 20px;
}

body.page-index li {
  margin-bottom: 8px;
  color: var(--muted);
}

body.page-login {
  color-scheme: light;
  --ink: #0f141b;
  --muted: #4c5563;
  --accent: #0b4f6c;
  --accent-2: #ff6b35;
  --card: #f8f4f0;
  --shadow: 0 22px 60px rgba(15, 20, 27, 0.18);
  --radius: 22px;
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 78% 12%, #fef1e6 0%, #f3efe9 50%, #e7eef2 100%);
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

body.page-login .card {
  width: min(640px, 100%);
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px;
  display: grid;
  gap: 18px;
  text-align: center;
  animation: rise 0.55s ease-out both;
}

.profile-info {
  width: min(500px, 100%);
  margin: 20px auto;
  border-top: 1px solid rgba(0,0,0,0.1);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.avatar-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.avatar-placeholder {
  background-color: #e0e0e0;
}

.refresh-button {
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.refresh-button:hover {
  background: var(--accent);
  color: white;
}

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

.profile-row.full-width {
  grid-template-columns: 1fr;
}

.profile-info .info-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.profile-info label {
  color: var(--muted);
  margin-bottom: 2px;
}

.profile-info span {
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  font-size: 1rem;
}

@media (max-width: 480px) {
  .profile-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

body.page-login h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.4rem);
  letter-spacing: -0.02em;
}

body.page-login p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

body.page-login form {
  display: grid;
  gap: 14px;
  text-align: left;
}

body.page-login .login-inline-form {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

body.page-login .login-inline-form .field {
  flex: 1;
}

body.page-login .login-inline-form button {
  white-space: nowrap;
}

@media (max-width: 600px) {
  body.page-login .login-inline-form {
    flex-direction: column;
    align-items: stretch;
  }
}

body.page-login .field {
  display: grid;
  gap: 6px;
}

body.page-login label {
  font-size: 0.9rem;
  font-weight: 600;
}

body.page-login input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(15, 20, 27, 0.15);
  font-size: 0.95rem;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

body.page-login input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(11, 79, 108, 0.2);
}

body.page-login button {
  border: none;
  border-radius: 999px;
  padding: 14px 22px;
  font-size: 1rem;
  font-weight: 700;
  background: linear-gradient(120deg, var(--accent) 0%, #106581 55%, var(--accent-2) 100%);
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

body.page-login button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(11, 79, 108, 0.3);
}

body.page-login .helper a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

body.page-login .helper a:hover {
  text-decoration: underline;
}

:root {
  --side-nav-width: 200px;
}

/* Sidebar Navigation Layout */
.app-container {
  display: flex;
  margin-top: 50px; /* Offset for top logo-banner */
  min-height: calc(100vh - 50px);
}

.side-nav {
  width: var(--side-nav-width);
  background: #f4f7f9;
  border-right: 1px solid rgba(0,0,0,0.1);
  padding: 20px 0;
  flex-shrink: 0;
  position: fixed;
  top: 50px;
  bottom: 0;
  overflow-y: auto;
  transition: width 0.3s ease;
  z-index: 100;
}

.side-nav.collapsed {
  width: 60px;
}

.side-nav.collapsed a {
  padding: 12px 0;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
}

.side-nav.collapsed a span {
  display: none;
}

.side-nav.collapsed a .nav-icon {
  margin-right: 0;
  font-size: 20px;
}

.nav-resizer {
  width: 4px;
  height: 100%;
  position: absolute;
  right: 0;
  top: 0;
  cursor: col-resize;
  background: transparent;
  transition: background 0.2s;
}

.nav-resizer:hover, .nav-resizer.resizing {
  background: rgba(11, 79, 108, 0.3);
}

.nav-toggle-btn {
  position: absolute;
  bottom: 20px;
  right: -12px;
  width: 24px;
  height: 24px;
  background: #0b4f6c;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid white;
  z-index: 110;
  transition: transform 0.3s ease;
}

.side-nav.collapsed .nav-toggle-btn {
  transform: rotate(180deg);
  right: 18px;
}

.side-nav a {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  text-decoration: none;
  color: #0b4f6c;
  font-weight: 600;
  font-family: "Space Grotesk", sans-serif;
  transition: background 0.2s, color 0.2s, padding 0.3s;
}

.nav-icon {
  margin-right: 10px;
  min-width: 20px;
  text-align: center;
}

.side-nav a:hover {
  background: #e1e9ee;
}

.side-nav a.active {
  background: #0b4f6c;
  color: white;
  pointer-events: none;
  cursor: default;
}

.side-nav a.nav-disabled {
  color: #999;
  pointer-events: none;
  cursor: default;
  opacity: 0.6;
}

.main-content {
  flex: 1;
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-left: var(--side-nav-width);
  transition: margin-left 0.3s ease;
}

.side-nav.collapsed + .main-content {
  margin-left: 60px;
}

/* Adjustments for existing pages to use sidebar */
.page-profile, .page-customer-dashboard, .page-contract-create {
  background: #f8f9fa;
  margin: 0;
  font-family: "Space Grotesk", "IBM Plex Sans", "Segoe UI", sans-serif;
}

/* Override existing full-page grid/place-items if necessary */
.page-profile .card, .page-customer-dashboard .card, .page-contract-create .card {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }
  .side-nav {
    width: 100%;
    position: static;
    display: flex;
    overflow-x: auto;
    padding: 10px;
    border-right: none;
    border-bottom: 1px solid rgba(0,0,0,0.1);
  }
  .side-nav a {
    padding: 8px 15px;
    white-space: nowrap;
  }
  .main-content {
    padding: 16px;
    margin-left: 0 !important;
  }
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ccc;
  border-top: none;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  max-height: 250px;
  overflow-y: auto;
  z-index: 1000;
}

.autocomplete-prediction {
  padding: 12px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
  transition: background-color 0.2s;
}

.autocomplete-prediction:last-child {
  border-bottom: none;
}

.autocomplete-prediction:hover {
  background-color: #f0f0f0;
}

/* Field Status Labels */
.label-enabled {
  font-size: 0.9rem;
  color: inherit;
  font-weight: normal;
}

.form-row-top {
  display: flex;
  align-items: flex-start;
}
