/* ============================================
   BOQ Reformatter — styles
   ============================================ */

:root {
  --bg: #f1f3f6;
  --panel: #ffffff;
  --ink: #1d2127;
  --muted: #6b7280;
  --line: #d8dde4;
  --accent: #1f6feb;
  --accent-ink: #ffffff;
  --soft: #eef2ff;
  --good: #16a34a;
  --sheet-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Cairo', system-ui, -apple-system, Segoe UI, sans-serif;
  font-size: 14px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
  gap: 6px;
}
.topbar h1 { margin: 0; font-size: 18px; font-weight: 700; }
.topbar h1 .brand {
  color: var(--accent);
  font-family: system-ui, -apple-system, Segoe UI, sans-serif;
  letter-spacing: 0.2px;
}
.subtitle { color: var(--muted); font-size: 13px; }

.layout {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--sheet-shadow);
  padding: 20px;
}
.panel h2 { margin: 0 0 14px; font-size: 15px; font-weight: 700; }
.panel-hint { margin: -8px 0 14px; color: var(--muted); font-size: 12.5px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.dup-sheet { margin-bottom: 14px; }
.dup-sheet:last-child { margin-bottom: 0; }
.dup-sheet h3 { margin: 0 0 8px; font-size: 13.5px; }
.dup-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #fffaf0;
}
.dup-group:last-child { margin-bottom: 0; }
.dup-group-title { margin: 0 0 6px; font-size: 12.5px; font-weight: 700; color: #92400e; }
.dup-col { margin-bottom: 4px; }
.dup-col:last-child { margin-bottom: 0; }
.dup-col small { color: var(--muted); }

.drop-zone {
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--soft);
}
.drop-icon { font-size: 36px; margin-bottom: 8px; }
.drop-title { margin: 0 0 4px; font-weight: 700; }
.drop-hint { margin: 0; color: var(--muted); font-size: 12.5px; }

.file-info {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--soft);
  border-radius: 8px;
  font-size: 13.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.file-info .fname { font-weight: 700; }
.file-info .fmeta { color: var(--muted); }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 20px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
}
.field input {
  font: inherit;
  font-weight: 400;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
}

.options-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 20px;
  margin-bottom: 18px;
}
.opt {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  cursor: pointer;
}
.opt input { width: 16px; height: 16px; cursor: pointer; }

.btn {
  font: inherit;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  font-weight: 700;
  transition: background 0.15s, transform 0.05s;
}
.btn:hover { background: #f7f9fc; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #1a5fd0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.sheet-report {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.sheet-report:last-child { margin-bottom: 0; }
.sheet-report h3 { margin: 0 0 8px; font-size: 13.5px; }
.sheet-report ul { margin: 6px 0 0; padding-inline-start: 20px; font-size: 13px; color: var(--muted); }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--soft);
  color: var(--accent);
  margin-inline-end: 6px;
}
.badge.good { background: #e9f9ee; color: var(--good); }

.preview-table-wrap {
  overflow-x: auto;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.preview-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12.5px;
}
.preview-table th, .preview-table td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  text-align: right;
  vertical-align: top;
  max-width: 260px;
}
.preview-table th {
  background: #1f3b57;
  color: #fff;
  position: sticky;
  top: 0;
}
.preview-table td.num { text-align: center; }
.preview-table tr:nth-child(even) td { background: #f2f5f8; }
