:root {
  --navy-950: #071b2c;
  --navy-900: #0a2740;
  --navy-800: #123b5a;
  --teal-600: #0f8b8d;
  --teal-100: #dff4f1;
  --blue-600: #1265d8;
  --orange-500: #f29a2e;
  --ink: #13212e;
  --muted: #62717e;
  --line: #dce4e8;
  --surface: #ffffff;
  --canvas: #f3f6f7;
  --danger: #c53636;
  --success: #13755a;
  --shadow: 0 18px 60px rgba(9, 39, 64, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--canvas); }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.ambient { position: fixed; border-radius: 999px; filter: blur(70px); opacity: .24; pointer-events: none; }
.ambient-a { width: 420px; height: 420px; background: #61cbc0; left: -160px; top: -160px; }
.ambient-b { width: 360px; height: 360px; background: #f2ad5e; right: -180px; bottom: -180px; }

.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(420px, .8fr); position: relative; z-index: 1; }
.login-story { color: #fff; background: linear-gradient(145deg, var(--navy-950), var(--navy-800)); padding: clamp(32px, 6vw, 88px); display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; position: relative; }
.login-story::after { content: ""; position: absolute; right: -11vw; bottom: -18vw; width: 44vw; height: 44vw; border: 1px solid rgba(255,255,255,.14); transform: rotate(32deg); box-shadow: inset 0 0 0 8vw rgba(255,255,255,.025), inset 0 0 0 16vw rgba(255,255,255,.018); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; font-weight: 760; letter-spacing: -.02em; text-decoration: none; position: relative; z-index: 1; }
.brand-logo { display: block; width: 132px; height: auto; object-fit: contain; }
.brand.compact .brand-logo { width: 112px; }
.story-copy { max-width: 720px; position: relative; z-index: 1; }
.eyebrow { margin: 0 0 10px; font-size: 11px; line-height: 1.4; font-weight: 800; letter-spacing: .18em; color: var(--teal-600); }
.login-story .eyebrow { color: #76ded2; }
.story-copy h1 { font-size: clamp(44px, 5.7vw, 78px); line-height: .98; letter-spacing: -.055em; margin: 0 0 26px; max-width: 850px; }
.story-copy p:last-child { font-size: clamp(17px, 1.5vw, 22px); line-height: 1.55; color: #c7d7e1; max-width: 640px; }
.story-points { display: flex; flex-wrap: wrap; gap: 10px; position: relative; z-index: 1; }
.story-points span { border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.06); padding: 10px 13px; font-size: 12px; }
.login-panel { display: grid; place-items: center; padding: 36px; background: rgba(248,250,251,.94); }
.login-card { width: min(440px, 100%); background: #fff; padding: clamp(28px, 4vw, 48px); border: 1px solid rgba(10,39,64,.1); box-shadow: var(--shadow); }
.login-card h2, .modal h2 { font-size: 32px; letter-spacing: -.035em; margin: 0 0 8px; }
.muted { color: var(--muted); line-height: 1.6; }
.form-stack { display: grid; gap: 18px; margin-top: 28px; }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 700; color: #314453; }
input { min-width: 0; border: 1px solid #cdd8de; background: #fff; color: var(--ink); padding: 13px 14px; outline: none; border-radius: 4px; }
input:focus { border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(18,101,216,.12); }
.button { border: 1px solid transparent; border-radius: 4px; padding: 12px 16px; font-weight: 780; color: var(--ink); background: #fff; transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.button.primary { color: #fff; background: var(--blue-600); box-shadow: 0 8px 22px rgba(18,101,216,.2); }
.button.primary:hover { background: #0e57bb; }
.button.secondary { color: var(--navy-900); border-color: #b9c9d2; background: #fff; }
.button.ghost { background: transparent; border-color: #d4dee3; }
.button.small { padding: 8px 11px; font-size: 12px; }
.button.wide { width: 100%; }
.form-error { min-height: 20px; margin: 12px 0 0; color: var(--danger); font-size: 13px; line-height: 1.5; }
.security-note { color: var(--muted); font-size: 12px; margin-top: 24px; display: flex; gap: 8px; align-items: center; }
.connection-card { margin: 20px 0 4px; padding: 12px; border: 1px solid var(--line); background: #f7f9fa; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.connection-card span { color: var(--danger); font-size: 11px; font-weight: 800; }
.connection-card span.connected { color: var(--success); }

.app-shell { min-height: 100vh; position: relative; z-index: 1; }
.topbar { height: 68px; padding: 0 28px; background: var(--navy-950); color: #fff; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 20; }
.account-area { display: flex; align-items: center; gap: 18px; }
.account-area div { display: grid; text-align: right; }
.account-area strong { font-size: 12px; }
.account-area span { color: #aac0cf; font-size: 11px; margin-top: 2px; }
.topbar .button.ghost { color: #fff; border-color: rgba(255,255,255,.25); }
.workspace { display: grid; grid-template-columns: 238px minmax(0, 1fr); min-height: calc(100vh - 68px); }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 28px 18px; display: flex; flex-direction: column; }
.nav-label { font-size: 10px; font-weight: 900; color: #93a0aa; letter-spacing: .18em; margin: 4px 12px 12px; }
.nav-item { width: 100%; border: 0; background: transparent; display: flex; align-items: center; gap: 11px; padding: 13px 12px; color: #435765; font-weight: 730; text-align: left; border-left: 3px solid transparent; }
.nav-item:hover { background: #f4f8f9; }
.nav-item.active { color: var(--blue-600); background: #eef5ff; border-left-color: var(--blue-600); }
.nav-item:disabled { color: #98a4ad; cursor: not-allowed; }
.nav-icon { width: 24px; height: 24px; display: grid; place-items: center; background: #eaf0f3; color: var(--navy-900); }
.lock { margin-left: auto; font-size: 9px; color: #875919; background: #fff0d9; padding: 4px 6px; }
.sidebar-note { margin-top: auto; background: var(--navy-950); color: #fff; padding: 16px; display: grid; gap: 5px; }
.sidebar-note strong { font-size: 12px; }
.sidebar-note span { font-size: 11px; line-height: 1.5; color: #b6c8d3; }
.content { width: min(1240px, 100%); margin: 0 auto; padding: 42px clamp(22px, 4vw, 56px) 64px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 28px; }
.page-heading h1 { margin: 0; font-size: clamp(30px, 4vw, 46px); letter-spacing: -.045em; }
.page-heading .muted { margin: 8px 0 0; }
.step-card { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 18px; background: #fff; border: 1px solid var(--line); box-shadow: 0 8px 28px rgba(13,43,64,.06); padding: 24px; margin-top: 18px; }
.step-number { width: 38px; height: 38px; display: grid; place-items: center; color: #fff; background: var(--navy-900); font-weight: 850; }
.step-body { min-width: 0; }
.step-heading { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 20px; }
.step-heading h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.step-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.profile-chip { background: var(--teal-100); color: #0c6668; padding: 8px 10px; font-size: 11px; font-weight: 800; }
.controls-grid { display: grid; grid-template-columns: minmax(190px, .32fr) minmax(0, 1fr); gap: 18px; }
.controls-grid.wages-mode { grid-template-columns: minmax(170px, .25fr) minmax(190px, .28fr) minmax(0, 1fr); }
.controls-grid.payments-company-mode { grid-template-columns: minmax(170px, .25fr) minmax(190px, .28fr) minmax(0, 1fr); }
.controls-grid.payments-bank-mode { grid-template-columns: minmax(155px, .20fr) minmax(210px, .26fr) minmax(180px, .22fr) minmax(0, 1fr); }
.company-field select, .date-field input { width: 100%; min-height: 68px; font-weight: 750; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 0 13px; }
.company-field select:focus, .date-field input:focus { outline: 2px solid rgba(18,101,216,.18); border-color: var(--blue-600); }
.date-field input { min-height: 68px; font-weight: 750; }
.date-field.from-excel input { background: #f1f5f7; color: var(--muted); cursor: not-allowed; }
.date-field .field-hint { display: block; margin-top: 6px; color: #0c6668; font-size: 11px; line-height: 1.35; font-weight: 700; }
.date-field .field-hint[hidden] { display: none; }
.dropzone { min-height: 96px; border: 1.5px dashed #9cb0bb; background: #f8fafb; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 20px; cursor: pointer; text-align: left; }
.dropzone:hover, .dropzone.dragging { border-color: var(--blue-600); background: #f0f6ff; }
.dropzone span:nth-child(3) { display: grid; gap: 3px; }
.dropzone small { color: var(--muted); font-weight: 500; }
.upload-icon { width: 38px; height: 38px; background: #e5eef8; display: grid; place-items: center; color: var(--blue-600); font-size: 20px; }
.file-meta { margin-top: 14px; padding: 11px 13px; background: #edf8f5; color: var(--success); font-size: 13px; font-weight: 700; }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.summary-grid article { border: 1px solid var(--line); padding: 14px; display: grid; gap: 7px; }
.summary-grid span { color: var(--muted); font-size: 11px; }
.summary-grid strong { font-size: 20px; }
.summary-grid .success { color: var(--success); font-size: 15px; }
.summary-grid .danger { color: var(--danger); font-size: 15px; }
.validation-list { background: #fff0ef; color: #9e2e2e; padding: 12px 14px; margin-bottom: 14px; font-size: 12px; line-height: 1.6; white-space: pre-line; }
.table-wrap { max-width: 100%; overflow: auto; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 12px; }
th { background: #f4f7f8; color: #60717e; text-align: left; font-size: 10px; letter-spacing: .05em; text-transform: uppercase; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.invalid { background: #fff4f3; }
td.message-cell { white-space: normal; min-width: 180px; }
.export-bar { margin-top: 18px; background: var(--navy-950); color: #fff; padding: 18px 22px; display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.export-bar div { display: grid; gap: 4px; }
.export-bar span { color: #a9bdca; font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.export-bar strong { font-size: 13px; }
.app-error { text-align: right; }

.modal { width: min(470px, calc(100% - 28px)); border: 0; padding: 0; box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(4,18,31,.72); backdrop-filter: blur(3px); }
.modal form { padding: 34px; position: relative; display: grid; gap: 16px; }
.modal form > p, .modal h2 { margin-top: 0; margin-bottom: 0; }
.modal-close { position: absolute; right: 13px; top: 11px; border: 0; background: transparent; color: #758590; font-size: 26px; }
.modal-icon { width: 48px; height: 48px; display: grid; place-items: center; color: #fff; background: var(--navy-900); font-size: 24px; }
.toast { position: fixed; z-index: 50; right: 22px; bottom: 22px; max-width: 420px; color: #fff; background: var(--navy-950); padding: 13px 16px; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-story { min-height: 44vh; gap: 52px; }
  .story-copy h1 { font-size: clamp(38px, 9vw, 64px); }
  .story-points { display: none; }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; position: sticky; top: 68px; z-index: 15; padding: 8px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-label, .sidebar-note { display: none; }
  .nav-item { width: auto; flex: 1; justify-content: center; }
  .content { padding-top: 30px; }
}

@media (max-width: 650px) {
  .login-story { padding: 28px 24px; }
  .login-panel { padding: 20px 14px; }
  .topbar { padding: 0 14px; }
  .account-area div { display: none; }
  .page-heading, .step-heading, .export-bar { align-items: stretch; flex-direction: column; }
  .controls-grid, .controls-grid.wages-mode, .controls-grid.payments-company-mode, .controls-grid.payments-bank-mode, .summary-grid { grid-template-columns: 1fr; }
  .step-card { grid-template-columns: 1fr; padding: 18px; }
  .step-number { width: 32px; height: 32px; }
  .export-bar .button { width: 100%; }
  .nav-item { font-size: 12px; padding-inline: 8px; }
  .nav-icon { display: none; }
}
