:root {
  --paper: #f6f7f4;
  --card: #ffffff;
  --ink: #18222b;
  --muted: #5d6873;
  --line: #dde2e0;
  --file-green: #1d3f38;
  --file-green-2: #2b5a50;
  --brass: #c99a3f;
  --ok: #1f7a4d;   --ok-bg: #e6f4ec;
  --miss: #b3261e; --miss-bg: #fdecea;
  --need: #9a5b00; --need-bg: #fff3dc;
  --exp: #7a1414;  --exp-bg: #f9dcdc;
  --skip: #59636e; --skip-bg: #eef0f2;
  --radius: 10px;
  --font: "IBM Plex Sans", "Hind Siliguri", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
body.bn { --font: "Hind Siliguri", "IBM Plex Sans", system-ui, "Segoe UI", "Nirmala UI", Arial, sans-serif; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; }
h1, h2 { margin: 0; line-height: 1.25; }
p { margin: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* top bar */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 16px clamp(16px, 4vw, 40px); background: var(--file-green); color: #fff; border-bottom: 4px solid var(--brass); }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand h1 { font-size: 21px; font-weight: 700; }
.brand p { font-size: 13px; color: #cfe2dc; }
.seal { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 2px solid var(--brass); color: var(--brass);
  display: grid; place-items: center; font-weight: 700; font-size: 20px; }
.top-actions { display: flex; gap: 8px; }

/* layout */
.wrap { max-width: 1320px; margin: 0 auto; padding: 22px clamp(12px, 3vw, 32px) 40px; display: grid; gap: 18px; }
.grid { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; gap: 18px; align-items: start; }
@media (max-width: 960px) { .grid { grid-template-columns: 1fr; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.card-head h2 { font-size: 18px; font-weight: 600; }
.card-head p { font-size: 14px; margin-top: 2px; }
.step { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--file-green); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px;
  border-radius: 8px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  background: #e9edeb; color: var(--ink); }
.btn:focus-visible, select:focus-visible, input:focus-visible, .drop:focus-visible, .icon-btn:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }
.btn.primary { background: var(--file-green); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--file-green-2); }
.btn.success { background: var(--ok); color: #fff; }
.btn.ghost { background: #fff; border-color: var(--line); }
.btn.ghost:hover:not(:disabled) { border-color: var(--file-green); }
.btn.danger { color: var(--miss); }
.btn.sm { min-height: 32px; padding: 4px 10px; font-size: 13px; }
.btn.lg { min-height: 50px; padding: 12px 26px; font-size: 16px; }
.btn.lang { background: var(--brass); color: #1b1b1b; min-width: 92px; }
.topbar .btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.45); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* tender */
.tender { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 8px; }
.tf { background: #fbfcfb; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tf span { font-size: 12px; color: var(--muted); }
.tf strong { font-weight: 600; overflow-wrap: anywhere; }
.tf.wide { grid-column: span 2; }
.tf.deadline { background: #fff8e8; }
.tf.deadline strong { color: #7a4d00; }
@media (max-width: 560px) { .tf.wide { grid-column: auto; } }

/* drop zone + files */
.drop { border: 2px dashed #b9c4c0; border-radius: 10px; padding: 24px 14px; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px; background: #fafbfa; }
.drop:hover, .drop.over { border-color: var(--file-green); background: #eef5f2; }
.drop.busy { opacity: .6; pointer-events: none; }
.drop-icon { width: 38px; height: 38px; border-radius: 50%; background: var(--file-green); color: #fff; font-size: 24px;
  display: grid; place-items: center; margin-bottom: 4px; }
.stats { margin: 10px 0 4px; }
.file-list { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 8px; }
.file-list .empty, .checklist .empty { padding: 18px; text-align: center; color: var(--muted); background: #fafbfa; border-radius: 8px; }
.file { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.file.is-used { border-left: 4px solid var(--ok); }
.file.is-dup { border-left: 4px solid var(--need); }
.file.is-bad { border-left: 4px solid var(--miss); background: #fff8f7; }
.file-ico { width: 34px; height: 40px; border-radius: 4px; background: #f2e6e4; color: var(--miss); font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.file-body { min-width: 0; }
.file-name { font-weight: 600; overflow-wrap: anywhere; }
.file-meta, .file-use, .file-dup { font-size: 13px; color: var(--muted); }
.file-dup { color: var(--need); }
.file-act { grid-column: 2; display: flex; gap: 6px; }
.badge { display: inline-block; padding: 0 8px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.badge.dup { background: var(--need-bg); color: var(--need); }
.badge.bad { background: var(--miss-bg); color: var(--miss); }

/* summary */
.summary { margin-bottom: 12px; }
.progress { height: 8px; border-radius: 99px; background: #e8ecea; overflow: hidden; }
.bar { height: 100%; background: var(--ok); transition: width .3s ease; }
.progress-label { font-size: 14px; font-weight: 600; margin: 6px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; padding: 2px 10px; border-radius: 99px; }
.chip.zero { opacity: .45; }

/* checklist */
.checklist { display: grid; gap: 8px; }
.req { display: grid; grid-template-columns: 40px minmax(160px, 1.2fr) minmax(180px, 1.3fr) minmax(150px, .9fr) minmax(150px, 1fr);
  gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-left-width: 5px; border-radius: 8px; }
.req[data-st="ok"] { border-left-color: var(--ok); }
.req[data-st="missing"] { border-left-color: var(--miss); }
.req[data-st="needed"] { border-left-color: #e0a12a; }
.req[data-st="expired"] { border-left-color: var(--exp); background: #fffafa; }
.req[data-st="skip"] { border-left-color: #c3c9cf; }
.req-order { width: 34px; height: 34px; border-radius: 6px; background: #edf2f0; color: var(--file-green); font-weight: 700; display: grid; place-items: center; }
.req-title { font-weight: 600; }
.req-alt { font-size: 13px; color: var(--muted); }
.req-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; align-items: center; }
.req-id { font-size: 12px; color: var(--muted); }
.tag { font-size: 12px; padding: 0 7px; border-radius: 4px; border: 1px solid var(--line); }
.tag-m { border-color: #e7b9b5; color: var(--miss); }
.tag-o { color: var(--skip); }
.tag-e { border-color: #ecd09a; color: var(--need); }
.lbl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.sel-row { display: flex; gap: 6px; }
select, input[type="date"] { width: 100%; min-height: 38px; padding: 6px 8px; border: 1px solid #c4ccc9; border-radius: 6px; font: inherit; font-size: 14px; background: #fff; color: var(--ink); min-width: 0; }
.icon-btn { flex: none; width: 38px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; color: var(--miss); font-size: 14px; }
.req-status { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.pill { font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.hint { font-size: 12.5px; color: var(--muted); }
.ok { background: var(--ok-bg); color: var(--ok); }
.missing { background: var(--miss-bg); color: var(--miss); }
.needed { background: var(--need-bg); color: var(--need); }
.expired { background: var(--exp-bg); color: var(--exp); }
.skip { background: var(--skip-bg); color: var(--skip); }

@media (max-width: 1200px) {
  .req { grid-template-columns: 40px 1fr 1fr; }
  .req-exp { grid-column: 2; }
  .req-status { grid-column: 3; }
}
@media (max-width: 640px) {
  .req { grid-template-columns: 36px 1fr; }
  .req-file, .req-exp, .req-status { grid-column: 2; }
  .card { padding: 14px; }
  .brand h1 { font-size: 18px; }
}

/* generate */
.check { display: inline-flex; gap: 8px; align-items: center; margin-bottom: 12px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--file-green); }
.notice { border-radius: 8px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }
.notice ul { margin: 6px 0 0; padding-left: 20px; }
.notice.block { background: var(--miss-bg); color: #6d1712; border: 1px solid #f1c3bf; }
.notice.ready { background: var(--ok-bg); color: #15532f; border: 1px solid #b9dfc9; font-weight: 600; }

.foot { text-align: center; padding: 0 16px 28px; }

/* toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 50; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 8px; background: #23303a; color: #fff;
  box-shadow: 0 6px 20px rgba(0,0,0,.18); font-size: 14px; animation: in .2s ease-out; }
.toast.error { background: var(--miss); }
.toast.warn { background: #8a5300; }
.toast.success { background: var(--ok); }
.toast button { margin-left: auto; background: none; border: 0; color: inherit; font-size: 18px; cursor: pointer; line-height: 1; }
@keyframes in { from { transform: translateY(8px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .toast, .bar { animation: none; transition: none; } }
