/* =====================================================================
   HARTAMAS FAST CLAIM — Layout (Sidebar + Header + Content)
   ===================================================================== */

/* ── Prevent horizontal overflow at root ── */
html {
  overflow-x: hidden;
}
body {
  overflow-x: hidden;
  min-height: 100vh;
}

/* ── App Shell ── */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden; /* prevents the shell itself from scrolling */
  background: var(--bg);
  position: relative;
}
.app-shell::before {
  content: '';
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--surface-700);
  border-right: 1px solid var(--surface-500);
  z-index: 49;
}
.app-shell.sidebar-ready::before {
  display: none;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface-700);
  border-right: 1px solid var(--surface-500);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  transition: transform var(--t-slow) var(--ease);
  overflow: hidden;
  flex-shrink: 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 16px;
  border-bottom: 1px solid var(--surface-500);
  text-decoration: none;
  min-height: 82px;
}
.sidebar-logo-img {
  width: 168px;
  height: auto;
  border-radius: 0;
  flex-shrink: 1;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-logo-img img {
  width: 100%;
  height: auto;
  border-radius: 0;
  object-fit: contain;
  display: block;
}
.sidebar-logo-text {
  overflow: hidden;
  transition: opacity var(--t-base) var(--ease), width var(--t-base) var(--ease);
}
.sidebar-logo-text .brand-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.sidebar-logo-text .brand-sub {
  font-size: 10.5px;
  color: var(--white40);
  white-space: nowrap;
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--white40);
  padding: 6px 8px 4px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--t-base) var(--ease);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border-radius: var(--r-md);
  color: var(--white70);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
  transition: background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease);
  white-space: nowrap;
  overflow: hidden;
  margin-bottom: 2px;
  font-family: inherit;
}
.nav-item svg {
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity var(--t-fast);
}
.nav-item:hover {
  background: var(--surface-600);
  color: var(--white);
}
.nav-item:hover svg { opacity: 1; }
.nav-item.active {
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 600;
}
.nav-item.active svg { opacity: 1; color: var(--on-brand); }

.nav-item-label {
  transition: opacity var(--t-base) var(--ease);
  white-space: nowrap;
}

.sidebar-footer {
  padding: 12px 10px 16px;
  border-top: 1px solid var(--surface-500);
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-md);
  overflow: hidden;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--on-brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}
.user-info {
  overflow: hidden;
  transition: opacity var(--t-base) var(--ease);
}
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 11px;
  color: var(--white40);
  white-space: nowrap;
}

.sidebar-logout {
  justify-content: center;
  text-align: center;
}

/* ── Main Content Area ── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  height: 100vh;           /* full viewport height */
  overflow-y: auto;        /* scroll happens here, not on body */
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--t-slow) var(--ease);
  min-width: 0;            /* prevent flex blowout */
}

/* ── Top Bar ── */
.topbar {
  height: var(--header-h);
  flex-shrink: 0;          /* never compress */
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  position: sticky;
  top: 0;
  z-index: 30;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.topbar-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink2);
  padding: 6px;
  border-radius: var(--r-sm);
  transition: background var(--t-fast), color var(--t-fast);
}
.topbar-menu-btn:hover { background: var(--card2); color: var(--ink); }

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.topbar-breadcrumb {
  font-size: 13px;
  color: var(--ink3);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.topbar-logout {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: var(--r-md);
  border: 1px solid var(--line2);
  background: transparent;
  color: var(--ink2);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--t-fast) var(--ease);
}
.topbar-logout:hover { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-border); }

/* ── Page Content ── */
.page-content {
  flex: 1;
  padding: 22px 18px 36px;
  max-width: none !important;
  width: 100%;
  margin: 0;
  box-sizing: border-box;
  overflow-x: hidden; /* no horizontal scroll in content area */
}

.welcome-bar,
.section-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  flex-wrap: wrap !important;
  margin-bottom: 18px !important;
}

.welcome-bar h1,
.section-header h1 {
  font-size: 1.45rem !important;
  line-height: 1.15;
  margin: 0 !important;
  letter-spacing: 0;
}

.welcome-bar p,
.section-header p {
  margin: 4px 0 0 !important;
}

.profile-hero {
  margin-bottom: 18px !important;
  padding: 24px 28px !important;
  border-radius: var(--r-xl) !important;
}

/* ── Mobile sidebar overlay ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 49;
}

/* ── Responsive Layout ── */
@media (max-width: 900px) {
  .app-shell::before { display: none; }
  .sidebar {
    transform: translateX(-100%);
    /* On mobile, sidebar floats over content */
    position: fixed;
    z-index: 50;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .sidebar-overlay.show { display: block; }
  .topbar-menu-btn { display: flex; align-items: center; justify-content: center; }
  .main-content {
    margin-left: 0; /* no margin — sidebar is fixed on top */
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
  }
  .page-content { padding: 18px 14px 32px; }
  .topbar { padding: 0 16px; }
}

@media (max-width: 600px) {
  .topbar-title { font-size: 15px; }
  .page-content { padding: 16px 12px 28px; }
}

/* ── Two column split (form + calc) ── */
.form-split {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 22px;
  align-items: start;
}
@media (max-width: 900px) {
  .form-split { grid-template-columns: 1fr; }
  .calc-panel { position: static; }
}

/* ── Login Page ── */
.login-page {
  height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden; /* prevent any bleed */
}
.login-left {
  background: var(--surface-800);
  display: flex;
  flex-direction: column;
  padding: 40px 48px;
  height: 100vh;
  overflow-y: auto;  /* allow scroll if form is tall */
  overflow-x: hidden;
  box-sizing: border-box;
}
.login-right {
  background: var(--brand);
  position: relative;
  overflow: hidden;
  height: 100vh;
}
.login-right-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.85;
  mix-blend-mode: multiply;
}
.login-right-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(245,197,24,0.6) 0%, rgba(230,180,0,0.8) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  text-align: center;
}
.login-right-overlay h2 {
  font-size: 2rem;
  font-weight: 900;
  color: var(--on-brand);
  line-height: 1.2;
  margin-bottom: 12px;
}
.login-right-overlay p {
  font-size: 15px;
  color: rgba(0,0,0,0.65);
  max-width: 360px;
}

.login-form-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 48px;
}
.login-logo img {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  object-fit: cover;
}
.login-logo-text {
  font-size: 16px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: 0.02em;
}
.login-logo-sub {
  font-size: 11px;
  color: var(--white40);
  margin-top: 1px;
}

.login-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 6px;
}
.login-subtitle {
  font-size: 14px;
  color: var(--white40);
  margin-bottom: 32px;
}

@media (max-width: 768px) {
  .login-page {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }
  .login-right { display: none; }
  .login-left {
    padding: 32px 24px;
    height: auto;
    min-height: 100vh;
  }
}

/* ── Done / Success screen ── */
.done-screen {
  max-width: 520px;
  margin: 60px auto;
  text-align: center;
  padding: 0 20px;
}
.done-icon {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--ok-bg);
  color: var(--ok);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 0 0 12px rgba(18,121,59,0.08);
}
.done-ref {
  display: inline-block;
  background: var(--brand-soft);
  color: var(--on-brand);
  border: 1px solid var(--warn-border);
  border-radius: var(--r-md);
  padding: 8px 16px;
  font-family: 'Roboto Mono', monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin: 12px 0;
}
