body {
  background: #f4f6f9;
  color: #1f2937;
  font-family: Arial, Helvetica, sans-serif;
  margin: 0;
}

* {
  box-sizing: border-box;
}

a {
  color: inherit;
}

label {
  display: inline-block;
  margin-bottom: 7px;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #202938;
  color: #fff;
  padding: 24px 16px;
}

.brand {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 28px;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar .nav-link {
  align-items: center;
  border-radius: 8px;
  color: #b7c3d6;
  display: flex;
  font-size: 14px;
  font-weight: 500;
  gap: 12px;
  padding: 10px 12px;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar .nav-link:hover {
  background: #314156;
  color: #fff;
}

.sidebar .nav-link.active {
  background: #2563eb;
  color: #fff;
}

.nav-icon {
  align-items: center;
  display: flex;
  flex-shrink: 0;
  height: 18px;
  width: 18px;
}

.nav-icon svg {
  height: 100%;
  width: 100%;
}

.content {
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.topbar h1 {
  font-size: 26px;
  margin: 0;
}

.panel {
  background: #fff;
  border: 1px solid #dde3ec;
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.05);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 20px;
  padding-bottom: 14px;
}

.panel-title h2 {
  font-size: 21px;
  margin: 0;
}

.alert {
  border-radius: 6px;
  margin-bottom: 16px;
  padding: 14px 16px;
}

.alert-danger {
  background: #fde2eb;
  border: 1px solid #f8b7cc;
  color: #be185d;
}

.alert-success {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #166534;
}

.btn {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  font-size: 15px;
  font-weight: 600;
  justify-content: center;
  line-height: 1.25;
  min-height: 38px;
  padding: 8px 13px;
  text-decoration: none;
}

.btn-sm {
  font-size: 13px;
  min-height: 32px;
  padding: 6px 10px;
}

.btn-primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.btn-warning {
  background: #f7b718;
  border-color: #f7b718;
  color: #1f2937;
}

.btn-light {
  background: #e5e7eb;
  border-color: #e5e7eb;
  color: #1f2937;
}

.btn-outline-primary {
  background: #fff;
  border-color: #2563eb;
  color: #2563eb;
}

.btn-outline-danger {
  background: #fff;
  border-color: #dc2626;
  color: #dc2626;
}

.btn:hover {
  filter: brightness(0.96);
}

.form-group {
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.col-md-3 {
  grid-column: span 3;
}

.col-md-6 {
  grid-column: span 6;
}

.form-control {
  background: #fff;
  border: 1px solid #cfd8e3;
  border-radius: 6px;
  color: #1f2937;
  display: block;
  min-height: 38px;
  padding: 8px 11px;
  width: 100%;
}

.form-control:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: none;
}

.table-responsive {
  overflow-x: auto;
  width: 100%;
}

.table {
  border-collapse: collapse;
  color: #1f2937;
  margin-bottom: 0;
  width: 100%;
}

.table th,
.table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

.table thead th {
  background: #f8fafc;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.table-hover tbody tr:hover {
  background: #f8fafc;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.summary-tile {
  display: block;
  border: 1px solid #d9e2ec;
  border-radius: 8px;
  padding: 18px;
  color: #1f2937;
  text-decoration: none;
}

.summary-tile strong {
  display: block;
  font-size: 34px;
}

.summary-tile-warning {
  background: #fef2f2;
  border-color: #fca5a5;
}

.process-note-warning {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #991b1b;
}

.actions,
.button-row,
.form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #475569;
  font-size: 14px;
}

.user-menu form {
  margin: 0;
}

.auth-shell {
  align-items: center;
  background: #f4f6f9;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  background: #fff;
  border: 1px solid #dde3ec;
  border-radius: 10px;
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.08);
  max-width: 360px;
  padding: 32px;
  width: 100%;
}

.auth-brand {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
}

.auth-brand img {
  height: 40px;
  object-fit: contain;
  width: 40px;
}

.auth-brand span {
  font-size: 22px;
  font-weight: 700;
}

.auth-subtitle {
  color: #64748b;
  margin: 4px 0 20px;
}

.auth-submit {
  width: 100%;
}

.form-actions {
  justify-content: space-between;
  margin-top: 22px;
}

.process-note {
  background: #f8fafc;
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  line-height: 1.5;
  margin-bottom: 18px;
  padding: 14px 16px;
}

.folder-path {
  background: #111827;
  border-radius: 8px;
  color: #f9fafb;
  padding: 12px 14px;
  white-space: pre-wrap;
}

.pdf-list {
  display: grid;
  gap: 8px;
  margin: 16px 0 22px;
}

.pdf-list a {
  border: 1px solid #dbe4ee;
  border-radius: 6px;
  color: #2563eb;
  padding: 10px 12px;
  text-decoration: none;
}

.pdf-list a:hover {
  background: #f8fafc;
}

.pdf-list.compact {
  margin: 10px 0;
}

.pdf-list.compact a {
  font-size: 13px;
  padding: 7px 9px;
}

.excel-tools {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.excel-analysis {
  display: grid;
  gap: 10px;
}

.excel-analysis p {
  margin: 0;
}

.sheet-card {
  background: #f8fafc;
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  padding: 12px;
}

.sheet-card > span {
  color: #64748b;
  display: block;
  font-size: 13px;
  margin-top: 3px;
}

.column-suggestions {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin-top: 10px;
}

.column-suggestions code {
  background: #111827;
  border-radius: 5px;
  color: #f8fafc;
  display: inline-block;
  padding: 4px 6px;
}

.column-suggestions small {
  color: #475569;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.simple-editor {
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  margin-top: 6px;
  overflow: hidden;
}

.editor-toolbar {
  align-items: center;
  background: #f8fafc;
  border-bottom: 1px solid #dbe4ee;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
}

.editor-toolbar button,
.editor-toolbar select,
.editor-swatch {
  align-items: center;
  background: #fff;
  border: 1px solid #cfd8e3;
  border-radius: 6px;
  color: #1f2937;
  display: inline-flex;
  font-size: 13px;
  height: 34px;
  justify-content: center;
  min-width: 34px;
  padding: 0 9px;
}

.editor-toolbar button:hover,
.editor-toolbar select:hover {
  background: #eef4fb;
}

.editor-toolbar span {
  background: #dbe4ee;
  height: 24px;
  width: 1px;
}

.editor-swatch input {
  border: 0;
  height: 24px;
  padding: 0;
  width: 24px;
}

.editor-canvas,
.editor-source {
  background: #fff;
  border: 0;
  min-height: 640px;
  outline: none;
  padding: 22px;
  width: 100%;
}

.editor-source {
  color: #111827;
  font-family: Monaco, Consolas, monospace;
  resize: vertical;
}

.editor-canvas table {
  border-collapse: collapse;
  margin: 10px 0;
  width: 100%;
}

.editor-canvas td,
.editor-canvas th {
  border: 1px solid #9ca3af;
  min-width: 70px;
  padding: 7px;
}

.editor-canvas img {
  max-width: 100%;
}

.hidden-editor-control {
  display: none !important;
}

.columns-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 20px;
  margin-bottom: 18px;
}

.column-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.color-swatch {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 38px;
  padding: 3px;
  border: 1px solid #cfd8e3;
  border-radius: 6px;
  background: none;
  cursor: pointer;
}

.color-swatch::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-swatch::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.badge-master {
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  color: #4338ca;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  text-transform: uppercase;
  vertical-align: middle;
}

.template-checklist {
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  display: grid;
  gap: 2px;
  margin-top: 6px;
  max-height: 320px;
  overflow-y: auto;
  padding: 10px;
}

.template-checklist-item {
  align-items: center;
  border-radius: 6px;
  display: flex;
  font-weight: 400;
  gap: 8px;
  margin: 0;
  padding: 6px 8px;
}

.template-checklist-item:hover {
  background: #f8fafc;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .columns-grid,
  .column-pair,
  .form-row,
  .panel-title,
  .topbar {
    display: block;
  }

  .col-md-3 {
    grid-column: auto;
  }

  .col-md-6 {
    grid-column: auto;
  }
}
