:root {
  --brand-blue: #2b75cc;
  --brand-blue-deep: #2060b2;
  --brand-yellow: #ffd000;
  --ink: #0c1523;
  --muted: #667085;
  --surface: rgba(255, 255, 255, 0.82);
  --line: rgba(12, 21, 35, 0.1);
  --page: #f8fafc;
  --radius: 24px;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 34rem;
  height: 34rem;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .14;
  pointer-events: none;
}
.ambient-one { top: -18rem; left: 18%; background: var(--brand-blue); }
.ambient-two { right: -18rem; bottom: -20rem; background: var(--brand-yellow); opacity: .12; }

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  width: min(1480px, calc(100% - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, .92);
  border-radius: 30px;
  box-shadow: 0 30px 90px rgba(12, 21, 35, .10);
  backdrop-filter: blur(24px);
}

.sidebar {
  min-height: calc(100vh - 32px);
  padding: 34px 28px 26px;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(248, 250, 252, .62);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}
.brand-mark {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: white;
  background: var(--brand-blue);
  border-radius: 14px;
  font-size: 22px;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(43, 117, 204, .24);
}
.brand-mark-light { color: var(--brand-blue); background: white; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.2; }
.brand-copy small { margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 500; }

.primary-nav { display: flex; flex-direction: column; gap: 5px; margin-top: 64px; }
.nav-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  padding: 13px 14px;
  color: #4a5160;
  border-radius: 14px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  transition: color .18s ease, background-color .18s ease, transform .18s ease;
}
.nav-item:hover { color: var(--brand-blue); background: rgba(43, 117, 204, .07); transform: translateX(2px); }
.nav-item.active { color: var(--brand-blue); background: rgba(43, 117, 204, .10); }
.nav-index { color: #a3aab5; font-size: 10px; letter-spacing: .08em; }
.nav-item.active .nav-index { color: var(--brand-blue); }

.sidebar-footer { margin-top: auto; padding-top: 28px; border-top: 1px solid var(--line); }
.account-label { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.account-label span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.account-label strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; }
.logout-link { padding: 9px 0 0; color: var(--muted); font-size: 13px; text-decoration: none; }
.logout-link:hover { color: #b42318; }

.workspace { min-width: 0; padding: clamp(36px, 5vw, 76px); }
.page-header { display: flex; justify-content: space-between; gap: 32px; align-items: flex-start; margin-bottom: 54px; }
.page-header h1 { max-width: 760px; margin: 0 0 12px; font-size: clamp(36px, 5vw, 64px); font-weight: 650; letter-spacing: -.045em; line-height: 1.03; }
.narrow-header h1 { font-size: clamp(34px, 4vw, 52px); }
.eyebrow { margin: 0 0 14px; color: var(--brand-blue); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.eyebrow-light { color: rgba(255,255,255,.7); }
.section-note { max-width: 660px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.65; }

.operation-list { border-top: 1px solid var(--line); }
.operation {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 50px;
  align-items: center;
  gap: 24px;
  min-height: 122px;
  padding: 18px 6px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  transition: color .2s ease, padding .2s ease, background-color .2s ease;
}
.operation:hover { padding-inline: 18px; color: var(--brand-blue); background: rgba(43,117,204,.035); }
.operation-number { color: #98a2b3; font-size: 12px; font-weight: 700; letter-spacing: .1em; }
.operation-copy { display: flex; flex-direction: column; gap: 7px; }
.operation-copy strong { font-size: clamp(20px, 2.1vw, 28px); font-weight: 650; letter-spacing: -.025em; }
.operation-copy small { color: var(--muted); font-size: 14px; line-height: 1.5; }
.operation-arrow { justify-self: end; font-size: 28px; transition: transform .2s ease; }
.operation:hover .operation-arrow { transform: translateX(5px); }
.operation-primary .operation-number, .operation-primary .operation-arrow { color: var(--brand-blue); }

.recent-section { margin-top: 86px; }
.section-heading-row { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 24px; }
.section-heading-row h2, .result-callout h2 { margin: 0; font-size: 28px; font-weight: 650; letter-spacing: -.03em; }
.text-link { color: var(--brand-blue); font-size: 13px; font-weight: 700; text-decoration: none; }
.compact-list { border-top: 1px solid var(--line); }
.compact-row { display: grid; grid-template-columns: 46px minmax(0,1fr) auto auto; align-items: center; gap: 16px; padding: 18px 2px; border-bottom: 1px solid var(--line); }
.file-monogram { display: grid; width: 42px; height: 42px; place-items: center; color: var(--brand-blue); background: #eef6ff; border-radius: 12px; font-size: 10px; font-weight: 800; }
.compact-main { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.compact-main strong, .file-name { overflow-wrap: anywhere; font-size: 14px; }
.compact-main small, .error-detail { color: var(--muted); font-size: 12px; }
.record-count { color: var(--muted); font-size: 13px; }
.status-badge { display: inline-flex; justify-content: center; min-width: 82px; padding: 7px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.status-success { color: #027a48; background: #ecfdf3; }
.status-failed { color: #b42318; background: #fef3f2; }

.drop-zone {
  display: flex;
  min-height: 370px;
  padding: 48px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  cursor: pointer;
  border: 1.5px dashed rgba(43,117,204,.45);
  border-radius: var(--radius);
  background: rgba(255,255,255,.62);
  transition: transform .2s ease, border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}
.drop-zone:hover, .drop-zone.is-dragging, .drop-zone.has-file { transform: translateY(-3px); border-color: var(--brand-blue); background: rgba(238,246,255,.82); box-shadow: 0 20px 50px rgba(43,117,204,.10); }
.drop-icon { display: grid; width: 64px; height: 64px; margin-bottom: 24px; place-items: center; color: white; background: var(--brand-blue); border-radius: 20px; font-size: 30px; box-shadow: 0 15px 30px rgba(43,117,204,.22); }
.drop-title { max-width: 620px; font-size: clamp(20px, 2.5vw, 28px); font-weight: 650; letter-spacing: -.025em; overflow-wrap: anywhere; }
.drop-note { margin-top: 10px; color: var(--muted); font-size: 13px; }
.upload-actions { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding-top: 24px; }
.upload-actions p { max-width: 620px; margin: 0; color: var(--muted); font-size: 13px; }

.result-strip { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 28px; border-block: 1px solid var(--line); }
.result-strip > div { padding: 26px 22px; border-right: 1px solid var(--line); }
.result-strip > div:last-child { border-right: 0; }
.result-strip span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.result-strip strong { font-size: 34px; font-weight: 650; letter-spacing: -.04em; }
.result-callout { display: flex; justify-content: space-between; align-items: center; gap: 30px; padding: 34px 38px; border-radius: var(--radius); }
.result-callout p:last-child { max-width: 640px; margin: 9px 0 0; color: var(--muted); }
.result-success { background: rgba(236,253,243,.88); border: 1px solid #abefc6; }
.result-error { background: rgba(254,243,242,.88); border: 1px solid #fecdca; }

.table-shell { overflow-x: auto; background: rgba(255,255,255,.65); border: 1px solid var(--line); border-radius: 18px; }
.table-shell .table { min-width: 780px; --bs-table-bg: transparent; }
.table-shell th { padding: 16px 20px; color: var(--muted); background: rgba(248,250,252,.72); border-bottom-color: var(--line); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.table-shell td { padding: 18px 20px; border-bottom-color: var(--line); color: var(--ink); font-size: 13px; }
.table-shell tbody tr:last-child td { border-bottom: 0; }
.history-table .history-stat, .history-table .history-action { vertical-align: middle; }
.history-table .history-action { width: 1%; white-space: nowrap; }
.history-table .btn-outline-danger { --bs-btn-color: #b42318; --bs-btn-border-color: rgba(180,35,24,.25); --bs-btn-hover-bg: #b42318; --bs-btn-hover-border-color: #b42318; font-size: 12px; }
.error-table code { color: #b42318; white-space: normal; }
.error-detail { display: block; margin-top: 4px; color: #b42318; }

.delete-dialog { width: min(520px, calc(100% - 32px)); margin: auto; padding: 0; color: var(--ink); background: #fff; border: 1px solid rgba(180,35,24,.18); border-radius: 20px; box-shadow: 0 24px 60px rgba(12,21,35,.24); }
.delete-dialog::backdrop { background: rgba(12,21,35,.46); backdrop-filter: blur(2px); }
.delete-dialog-content { padding: 26px; }
.delete-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.delete-dialog h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.025em; }
.delete-dialog p { margin: 16px 0 0; color: var(--muted); line-height: 1.6; }
.delete-dialog p strong { color: var(--ink); overflow-wrap: anywhere; }
.dialog-close { width: 36px; height: 36px; margin: -6px -6px 0 0; padding: 0; color: var(--muted); background: transparent; border: 0; border-radius: 10px; font-size: 26px; line-height: 1; }
.dialog-close:hover, .dialog-close:focus-visible { color: var(--ink); background: #f2f4f7; }
.delete-dialog-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 26px; }
.delete-dialog-actions form { margin: 0; }

.transfer-progress { width: min(100%, 720px); margin-top: 26px; padding: 16px 18px; border: 1px solid rgba(43,117,204,.16); border-radius: 16px; background: rgba(238,246,255,.62); transition: opacity .2s ease, transform .2s ease; }
.transfer-progress.is-hidden { display: none; }
.transfer-progress-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; color: #344054; font-size: 13px; font-weight: 700; }
.transfer-progress-head strong { color: var(--brand-blue); font-variant-numeric: tabular-nums; }
.transfer-progress small { display: block; margin-top: 9px; color: var(--muted); font-size: 12px; }
.transfer-progress-track { height: 9px; overflow: hidden; background: rgba(43,117,204,.12); border-radius: 999px; }
.transfer-progress-bar { background: linear-gradient(90deg, var(--brand-blue), #5a9cea); border-radius: inherit; transition: width .22s ease; }
.transfer-progress-bar.is-indeterminate { width: 100% !important; background: linear-gradient(90deg, #2b75cc 0%, #2b75cc 28%, #a9d0ff 48%, #2b75cc 68%, #2b75cc 100%); background-size: 220% 100%; animation: transfer-flow 1.8s linear infinite; }
.transfer-progress-inline { min-width: min(100%, 330px); margin-top: 16px; }
@keyframes transfer-flow { from { background-position: 180% 0; } to { background-position: -40% 0; } }

.empty-state { display: flex; padding: 32px 0; align-items: flex-start; flex-direction: column; color: var(--muted); border-top: 1px solid var(--line); }
.empty-state strong { margin-bottom: 5px; color: var(--ink); font-size: 18px; }
.empty-state.spacious { min-height: 340px; align-items: center; justify-content: center; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }

.login-canvas { min-height: 100vh; padding: 16px; }
.login-layout { display: grid; grid-template-columns: 1.08fr .92fr; min-height: calc(100vh - 32px); overflow: hidden; background: rgba(255,255,255,.84); border: 1px solid rgba(255,255,255,.9); border-radius: 30px; box-shadow: 0 30px 90px rgba(12,21,35,.12); }
.login-brand-panel { display: flex; min-height: 620px; padding: clamp(34px, 5vw, 74px); flex-direction: column; color: white; background: var(--brand-blue); position: relative; overflow: hidden; }
.login-brand-panel::after { content: "ДАНІ"; position: absolute; right: -1.5vw; bottom: -4vw; color: rgba(255,255,255,.075); font-size: clamp(110px, 18vw, 300px); font-weight: 800; letter-spacing: -.09em; line-height: .8; }
.login-brand-top { display: flex; align-items: center; gap: 12px; font-size: 16px; font-weight: 700; }
.login-brand-copy { position: relative; z-index: 1; max-width: 700px; margin: auto 0; }
.login-brand-copy h1 { margin: 0 0 24px; font-size: clamp(48px, 6vw, 88px); font-weight: 650; letter-spacing: -.055em; line-height: .98; }
.login-brand-copy > p:last-child { max-width: 560px; margin: 0; color: rgba(255,255,255,.74); font-size: 17px; line-height: 1.6; }
.login-line { position: relative; z-index: 1; width: min(220px, 45%); height: 3px; background: rgba(255,255,255,.2); }
.login-line span { display: block; width: 34%; height: 100%; background: var(--brand-yellow); }
.login-form-panel { display: grid; padding: clamp(38px, 7vw, 110px); place-items: center; }
.login-form-wrap { width: min(100%, 470px); }
.login-form-wrap h2 { margin: 0 0 10px; font-size: clamp(32px, 4vw, 48px); font-weight: 650; letter-spacing: -.04em; }
.form-label { margin-bottom: 9px; font-size: 13px; font-weight: 700; }
.form-control { min-height: 56px; padding-inline: 17px; border-color: rgba(12,21,35,.14); border-radius: 14px; background: rgba(255,255,255,.78); font-size: 15px; }
.form-control:focus { border-color: var(--brand-blue); box-shadow: 0 0 0 4px rgba(43,117,204,.12); }

.btn { border-radius: 13px; font-weight: 700; transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease; }
.btn-primary { --bs-btn-bg: var(--brand-blue); --bs-btn-border-color: var(--brand-blue); --bs-btn-hover-bg: var(--brand-blue-deep); --bs-btn-hover-border-color: var(--brand-blue-deep); padding-inline: 24px; box-shadow: 0 10px 22px rgba(43,117,204,.16); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 28px rgba(43,117,204,.22); }
.btn-outline-primary { --bs-btn-color: var(--brand-blue); --bs-btn-border-color: rgba(43,117,204,.4); --bs-btn-hover-bg: var(--brand-blue); --bs-btn-hover-border-color: var(--brand-blue); }
.btn.is-loading { cursor: wait; }
.alert { border: 0; border-radius: 14px; font-size: 14px; }
.error-page { display: flex; min-height: 65vh; max-width: 720px; justify-content: center; align-items: flex-start; flex-direction: column; }
.error-page h1 { margin: 0 0 12px; font-size: clamp(42px, 6vw, 72px); font-weight: 650; letter-spacing: -.05em; }
.error-page p:not(.eyebrow) { margin-bottom: 28px; color: var(--muted); }
.public-error { min-height: calc(100vh - 32px); margin: auto; padding: 40px; }
.mobile-header { display: flex; height: 74px; padding: 12px 20px; align-items: center; justify-content: space-between; background: rgba(248,250,252,.9); border-bottom: 1px solid var(--line); backdrop-filter: blur(18px); }
.mobile-header .navbar-toggler { display: grid; width: 44px; height: 44px; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: 13px; }
.mobile-header .navbar-toggler:focus { box-shadow: 0 0 0 4px rgba(43,117,204,.12); }
.mobile-header .navbar-toggler-icon { width: 20px; height: 14px; background: linear-gradient(var(--ink),var(--ink)) top/100% 2px no-repeat, linear-gradient(var(--ink),var(--ink)) center/100% 2px no-repeat, linear-gradient(var(--ink),var(--ink)) bottom/100% 2px no-repeat; }
.mobile-nav { background: #f8fafc; }
.mobile-nav .primary-nav { margin-top: 20px; }
.mobile-nav .sidebar-footer { margin-top: 36px; }

.page-enter { animation: page-enter .42s cubic-bezier(.2,.7,.2,1) both; }
@keyframes page-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media (max-width: 991.98px) {
  .app-shell { display: block; width: 100%; min-height: calc(100vh - 74px); margin: 0; border: 0; border-radius: 0; box-shadow: none; }
  .workspace { padding: 42px 24px 64px; }
  .page-header { margin-bottom: 38px; }
  .login-layout { grid-template-columns: 1fr; }
  .login-brand-panel { min-height: 440px; }
  .login-brand-copy { margin: 70px 0; }
  .login-form-panel { min-height: 560px; }
}

@media (max-width: 575.98px) {
  .workspace { padding: 34px 18px 52px; }
  .page-header, .upload-actions, .result-callout { align-items: stretch; flex-direction: column; }
  .page-header { gap: 20px; }
  .page-header .btn { align-self: flex-start; }
  .page-header h1 { font-size: 39px; }
  .operation { grid-template-columns: 34px minmax(0,1fr) 26px; gap: 12px; min-height: 112px; }
  .operation-copy small { display: none; }
  .compact-row { grid-template-columns: 42px minmax(0,1fr) auto; }
  .compact-row .record-count { display: none; }
  .status-badge { min-width: auto; }
  .recent-section { margin-top: 64px; }
  .drop-zone { min-height: 310px; padding: 32px 22px; }
  .upload-actions .btn { width: 100%; }
  .result-strip > div { padding: 20px 12px; }
  .result-strip strong { font-size: 28px; }
  .result-callout { padding: 28px 24px; }
  .result-callout .btn { width: 100%; }
  .transfer-progress-inline { width: 100%; min-width: 0; }
  .history-table .history-action { padding-inline: 12px; }
  .login-canvas { padding: 0; }
  .login-layout { min-height: 100vh; border: 0; border-radius: 0; }
  .login-brand-panel { min-height: 390px; padding: 30px 24px; }
  .login-brand-copy { margin: 52px 0; }
  .login-brand-copy h1 { font-size: 45px; }
  .login-form-panel { min-height: auto; padding: 58px 24px 70px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
