:root{
    --navy: #1F3A5F;
    --navy-deep: #15293f;
    --navy-soft: #E2E8F4;
    --beige: #EDE7DA;
    --beige-deep: #DCD2B8;
    --paper: #F7F8FA;
    --ink: #1A1F29;
    --ink-soft: #5B6472;
    --line: #DCE2EC;
    --good: #2F7D5C;
    --warn-bg: #FCE9B5;
    --warn-text: #7A5A05;
    --danger: #B23B3B;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(20,30,50,0.06), 0 8px 24px -12px rgba(20,30,50,0.18);
  }

  *{box-sizing:border-box;}
  html,body{margin:0;padding:0;}
  body{
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--paper);
    color: var(--ink);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
  }
  .mono{ font-family: "SF Mono","Consolas","Menlo",monospace; font-variant-numeric: tabular-nums; }

  .topbar{
    display:flex; align-items:center; justify-content:space-between;
    padding: 18px 28px;
    background: var(--navy);
    color: #fff;
  }
  .topbar .brand{
    display:flex; align-items:center; gap:10px;
    font-weight:600; letter-spacing: 0.2px; font-size: 15px;
  }
  .topbar .brand .dot{
    width:9px;height:9px;border-radius:50%;background:#9FD6B5;
    box-shadow: 0 0 0 3px rgba(159,214,181,0.18);
  }
  .topbar .venue-pill{
    font-size: 13px; padding: 5px 12px; border-radius: 999px;
    background: rgba(255,255,255,0.12); color:#dfe7f5;
  }
  .topbar .reset-link{
    background:none;border:none;color:#cbd7ec;font-size:13px;cursor:pointer;
    text-decoration:underline; padding:0;
  }
  .topbar .reset-link:hover{ color:#fff; }

  .app{
    max-width: 980px;
    margin: 0 auto;
    padding: 48px 24px 80px;
  }

  .screen{ animation: fadeIn .25s ease; }
  @keyframes fadeIn{ from{opacity:0; transform:translateY(4px);} to{opacity:1; transform:none;} }

  .eyebrow{
    font-size: 12px; font-weight:600; letter-spacing: 0.08em; text-transform:uppercase;
    color: var(--navy); margin-bottom: 10px;
  }
  h1{ font-size: 26px; margin: 0 0 8px; letter-spacing:-0.01em; }
  .lead{ color: var(--ink-soft); font-size: 15px; margin: 0 0 32px; max-width: 560px; line-height:1.55; }

  /* --- экран пароля --- */
  .center-screen{
    min-height: calc(100vh - 64px);
    display:flex; align-items:center; justify-content:center;
  }
  .password-card{
    width: 100%; max-width: 380px;
    background:#fff; border:1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 36px 32px;
    text-align:center;
  }
  .password-card .icon-row{
    width:48px;height:48px;margin:0 auto 18px;
    border-radius: 12px; background: var(--navy-soft);
    display:flex; align-items:center; justify-content:center;
  }
  .password-card .icon-row svg{ width:22px;height:22px; }
  .password-card h1{ font-size: 19px; text-align:center; }
  .password-card .lead{ text-align:center; margin: 0 auto 26px; font-size:13.5px; }

  input[type="password"], input[type="text"]{
    width:100%; padding: 12px 14px; font-size:15px;
    border:1px solid var(--line); border-radius: 8px;
    background: var(--paper); color: var(--ink);
    outline:none; transition: border-color .15s, box-shadow .15s;
  }
  input[type="password"]:focus, input[type="text"]:focus{
    border-color: var(--navy); box-shadow: 0 0 0 3px rgba(31,58,95,0.12);
    background:#fff;
  }

  .btn{
    display:inline-flex; align-items:center; justify-content:center; gap:8px;
    font-size: 14.5px; font-weight:600; padding: 12px 20px;
    border-radius: 8px; border:none; cursor:pointer;
    transition: transform .08s ease, box-shadow .15s, background .15s;
    text-decoration:none;
  }
  a.btn:visited{ color: inherit; }
  .btn:active{ transform: scale(0.98); }
  .btn-primary{ background: var(--navy); color:#fff; width:100%; margin-top:18px; }
  .btn-primary:hover{ background: var(--navy-deep); }
  .btn-primary:disabled{ background:#A9B6C9; cursor:not-allowed; }
  .btn-secondary{ background: #fff; color: var(--navy); border:1px solid var(--line); }
  .btn-secondary:hover{ border-color: var(--navy); }
  .btn-ghost{ background:none; color: var(--ink-soft); }

  .error-msg{
    color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 16px;
  }

  /* --- выбор заведения --- */
  .venue-grid{
    display:grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  }
  @media (max-width: 640px){ .venue-grid{ grid-template-columns: repeat(2, 1fr); } }

  .venue-card{
    background:#fff; border:1px solid var(--line); border-radius: var(--radius);
    padding: 26px 18px; text-align:center; cursor:pointer;
    transition: border-color .15s, box-shadow .15s, transform .1s;
  }
  .venue-card:hover{ border-color: var(--navy); box-shadow: var(--shadow); transform: translateY(-1px); }
  .venue-card .glyph{
    width:42px;height:42px;margin:0 auto 14px; border-radius:10px;
    background: var(--navy-soft); color: var(--navy);
    display:flex;align-items:center;justify-content:center;
    font-weight:700; font-size:15px;
  }
  .venue-card .name{ font-weight:600; font-size: 15px; }
  .venue-card .hint{ font-size:12px; color: var(--ink-soft); margin-top:4px; }

  /* --- загрузка файлов --- */
  .upload-list{ display:flex; flex-direction:column; gap: 12px; margin-bottom: 28px; }
  .upload-row{
    display:flex; align-items:center; gap: 14px;
    background:#fff; border:1px solid var(--line); border-radius: var(--radius);
    padding: 16px 18px;
  }
  .upload-row.is-filled{ border-color: var(--good); background: #F4FAF6; }
  .upload-row .u-icon{
    width:38px;height:38px;border-radius:9px;flex:none;
    background: var(--beige); color:#6b5d33;
    display:flex;align-items:center;justify-content:center; font-weight:700; font-size:13px;
  }
  .upload-row.is-filled .u-icon{ background:#D9EFE2; color: var(--good); }
  .upload-row .u-body{ flex:1; min-width:0; }
  .upload-row .u-title{ font-weight:600; font-size:14.5px; }
  .upload-row .u-sub{ font-size:12.5px; color: var(--ink-soft); margin-top:2px;
    white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .upload-row .u-action{ flex:none; }
  .file-input-hidden{ display:none; }
  .pick-btn{
    font-size:13px; font-weight:600; padding:8px 14px; border-radius:7px;
    border:1px solid var(--navy); background:#fff; color:var(--navy); cursor:pointer;
  }
  .pick-btn:hover{ background: var(--navy-soft); }
  .pick-btn.filled{ border-color: var(--good); color: var(--good); }

  .actions-row{ display:flex; gap:12px; align-items:center; }
  .actions-row .btn-primary{ width:auto; margin-top:0; flex:1; }

  .note-box{
    background: var(--beige); border-radius: 8px; padding: 13px 16px;
    font-size: 13px; color:#5b4f30; margin-bottom: 24px; line-height:1.5;
  }

  /* --- прогресс/обработка --- */
  .progress-card{
    background:#fff; border:1px solid var(--line); border-radius: var(--radius);
    padding: 40px; text-align:center;
  }
  .spinner{
    width:36px;height:36px;border-radius:50%;
    border: 3px solid var(--navy-soft); border-top-color: var(--navy);
    margin: 0 auto 18px; animation: spin 0.8s linear infinite;
  }
  @keyframes spin{ to{ transform: rotate(360deg); } }

  /* --- результат --- */
  .result-summary{
    display:grid; grid-template-columns: repeat(3,1fr); gap:14px; margin-bottom: 28px;
  }
  @media (max-width:640px){ .result-summary{ grid-template-columns: 1fr; } }
  .stat-card{
    background:#fff; border:1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
  }
  .stat-card .stat-label{ font-size:12px; color: var(--ink-soft); margin-bottom:6px; }
  .stat-card .stat-value{ font-size: 20px; font-weight:700; }
  .stat-card.warn{ background: var(--warn-bg); border-color: #EAD27F; }
  .stat-card.warn .stat-label{ color:#7A5A05; }
  .stat-card.warn .stat-value{ color: var(--warn-text); }

  table.preview{
    width:100%; border-collapse:collapse; font-size: 12.5px; margin-bottom: 28px;
    background:#fff; border:1px solid var(--line); border-radius: var(--radius); overflow:hidden;
  }
  table.preview th, table.preview td{
    padding: 8px 10px; border-bottom:1px solid var(--line); text-align:right;
    white-space:nowrap;
  }
  table.preview th{ background: var(--navy-soft); font-weight:600; white-space:nowrap; }
  table.preview td:first-child, table.preview th:first-child{ text-align:left; }
  table.preview td.labor-col, table.preview th.labor-col{ background: var(--beige); }
  table.preview td.diff-col{ }
  table.preview td.diff-nonzero{ background: var(--warn-bg); font-weight:600; }
  table.preview tbody tr:last-child{ font-weight:700; background:#EFF3FA; }
  .table-scroll{ overflow-x:auto; border-radius: var(--radius); }
  .table-scroll table.preview{ border-radius:0; }

  .footer-actions{ display:flex; gap:12px; flex-wrap:wrap; }

  .step-dots{ display:flex; gap:6px; margin-bottom: 22px; }
  .step-dots .d{ width:26px; height:4px; border-radius:2px; background: var(--line); }
  .step-dots .d.active{ background: var(--navy); }
  .step-dots .d.done{ background: #9FB6D6; }

  .file-meta-link{
    font-size:12px; color: var(--ink-soft); text-decoration:underline; cursor:pointer; background:none; border:none; padding:0;
  }