/* ═══════════════════════════════════════════════════════════════════════════
   ZeelandLOTO — Clean Light Theme
   Designed for clarity and ease of use for all skill levels
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --bg:           #F5F5F7;
  --surface:      #FFFFFF;
  --surface-2:    #F0F0F5;
  --border:       #D2D2D7;
  --border-light: #E8E8ED;

  --text:         #1D1D1F;
  --text-2:       #3A3A3C;
  --text-muted:   #6E6E73;
  --text-hint:    #AEAEB2;

  --red:          #CC0000;
  --red-hover:    #AA0000;
  --red-bg:       #FFF0F0;

  --blue:         #0066CC;
  --blue-hover:   #0052A3;
  --blue-bg:      #EBF4FF;

  --green:        #1A7F37;
  --green-bg:     #EDFAEF;

  --orange:       #B45309;
  --orange-bg:    #FFF8EB;

  --gray:         #6E6E73;
  --gray-bg:      #F5F5F7;

  --shadow-sm:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow:       0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:    0 12px 32px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);

  --radius-sm:    6px;
  --radius:       10px;
  --radius-lg:    14px;

  --font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --transition:   .18s ease;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

/* ── Typography ─────────────────────────────────────────────────────────── */
h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.3px; line-height: 1.2; }
h2 { font-size: 1.35rem; font-weight: 600; letter-spacing: -.2px; line-height: 1.3; }
h3 { font-size: 1.1rem;  font-weight: 600; line-height: 1.35; }
h4 { font-size: .95rem;  font-weight: 600; }
p  { line-height: 1.65; }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ─────────────────────────────────────────────────────────────── */
.app-header {
  background: #111827;
  border-bottom: 1px solid rgba(255,255,255,.06);
  height: 60px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
}

.header-brand { display: flex; align-items: center; gap: 12px; }

.brand-icon {
  height: 36px;
  width: auto;
  min-width: 36px;
  background: #c82333;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.5px;
  flex-shrink: 0;
  overflow: hidden;
}
.brand-icon img {
  height: 22px;
  width: auto;
  object-fit: contain;
  display: block;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.brand-subtitle {
  font-size: .72rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: .2px;
}

.header-actions { display: flex; align-items: center; gap: 10px; }

.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}

.user-avatar {
  width: 30px;
  height: 30px;
  background: var(--red);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-info { line-height: 1.2; }
.user-name  { font-size: .85rem; font-weight: 600; color: var(--text); }
.user-role  { font-size: .72rem; color: var(--text-muted); }

/* ── Header dark theme overrides ────────────────────────────────────────── */
.app-header .brand-title    { color: #fff; }
.app-header .brand-subtitle { color: rgba(255,255,255,.52); }
.app-header .header-user    { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); }
.app-header .user-name      { color: #fff; }
.app-header .user-role      { color: rgba(255,255,255,.52); }
.app-header .btn-secondary  { background: rgba(255,255,255,.1); color: rgba(255,255,255,.9); border-color: rgba(255,255,255,.15); }
.app-header .btn-secondary:hover:not(:disabled) { background: rgba(255,255,255,.18); color: #fff; text-decoration: none; }
.app-header .btn-ghost      { color: rgba(255,255,255,.65); }
.app-header .btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,.1); color: #fff; text-decoration: none; }
.app-header .badge          { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.15); color: rgba(255,255,255,.8); }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.page-content { max-width: 1280px; margin: 0 auto; padding: 32px 28px; }
.page-content-wide { max-width: 1440px; margin: 0 auto; padding: 32px 28px; }

/* ── Page Header ────────────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.page-title { font-size: 1.6rem; font-weight: 700; color: var(--text); }
.page-subtitle { font-size: .9rem; color: var(--text-muted); margin-top: 3px; }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-body  { padding: 24px; }
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h3 { font-size: 1rem; font-weight: 600; }

/* ── Stat Cards ─────────────────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: box-shadow .15s, transform .15s;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card.active-filter { outline: 2px solid var(--blue); outline-offset: 2px; }

.stat-label { font-size: .78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--text); line-height: 1; }
.stat-sub   { font-size: .78rem; color: var(--text-muted); }

.stat-card.stat-active  .stat-value { color: var(--green); }
.stat-card.stat-draft   .stat-value { color: var(--gray); }
.stat-card.stat-pending .stat-value { color: var(--orange); }
.stat-card.stat-archive .stat-value { color: var(--text-hint); }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  font-family: var(--font);
  font-size: .875rem;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
  min-height: 40px;
}

.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.btn-primary:hover:not(:disabled) { background: var(--blue-hover); border-color: var(--blue-hover); text-decoration: none; color: #fff; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); text-decoration: none; color: var(--text); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); text-decoration: none; }

.btn-blue {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.btn-blue:hover:not(:disabled) { background: var(--blue-hover); text-decoration: none; color: #fff; }

.btn-success {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}
.btn-success:hover:not(:disabled) { background: #156430; border-color: #156430; text-decoration: none; color: #fff; }

.btn-warning {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}
.btn-warning:hover:not(:disabled) { background: #924108; border-color: #924108; text-decoration: none; color: #fff; }

.btn-danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn-danger:hover:not(:disabled) { background: var(--red-hover); border-color: var(--red-hover); text-decoration: none; color: #fff; }

.btn-icon { padding: 6px 8px; min-width: 32px; }

.btn-sm  { padding: 6px 12px; font-size: .8rem; min-height: 32px; }
.btn-lg  { padding: 14px 24px; font-size: 1rem; min-height: 48px; }
.btn-xl  { padding: 16px 28px; font-size: 1.05rem; min-height: 54px; border-radius: var(--radius-lg); }
.w-100   { width: 100%; }

/* ── Forms ──────────────────────────────────────────────────────────────── */
.form-group  { margin-bottom: 18px; }
.form-row    { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: .1px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font);
  font-size: .95rem;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
  appearance: none;
  line-height: 1.5;
  min-height: 42px;
}

.form-control:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,102,204,.12);
}

.form-control::placeholder { color: var(--text-hint); }

textarea.form-control {
  resize: vertical;
  min-height: 100px;
  line-height: 1.65;
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236E6E73' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

/* ── Search Bar ─────────────────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  flex: 1;
  max-width: 520px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 16px;
}

.search-input {
  width: 100%;
  padding: 11px 14px 11px 42px;
  font-size: .95rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  transition: var(--transition);
  min-height: 44px;
  font-family: var(--font);
}

.search-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,102,204,.12);
}

.search-input::placeholder { color: var(--text-hint); }

/* ── Filter Bar ─────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filter-bar select {
  padding: 9px 32px 9px 12px;
  font-size: .85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  min-height: 40px;
  font-family: var(--font);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236E6E73' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  appearance: none;
}

.filter-bar select:focus { outline: none; border-color: var(--blue); }

/* ── Procedure Table ────────────────────────────────────────────────────── */
.proc-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.proc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.proc-table thead th {
  padding: 13px 16px;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.proc-table thead th:hover { color: var(--text); }
.proc-table thead th.sorted-asc::after  { content: ' ▲'; font-size: .65rem; }
.proc-table thead th.sorted-desc::after { content: ' ▼'; font-size: .65rem; }

.proc-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
  cursor: pointer;
}

.proc-table tbody tr:last-child { border-bottom: none; }
.proc-table tbody tr:hover { background: var(--blue-bg); }

.proc-table td {
  padding: 14px 16px;
  vertical-align: middle;
  color: var(--text);
}

.proc-name {
  font-weight: 600;
  color: var(--text);
  font-size: .9rem;
}

.proc-id {
  font-size: .78rem;
  color: var(--text-muted);
  font-family: ui-monospace, 'SF Mono', monospace;
  margin-top: 2px;
}

.proc-table .location-cell { color: var(--text-2); }

/* ── Status Badges ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .2px;
  white-space: nowrap;
}

.badge-active  { background: var(--green-bg);  color: var(--green); }
.badge-draft   { background: var(--gray-bg);   color: var(--gray);  border: 1px solid var(--border); }
.badge-pending { background: var(--orange-bg); color: var(--orange); }
.badge-archive { background: var(--surface-2); color: var(--text-hint); }

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ── Energy Type Chips ──────────────────────────────────────────────────── */
.energy-chips { display: flex; gap: 4px; flex-wrap: wrap; }

.energy-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .2px;
}

.chip-elec  { background: #FFF3CD; color: #856404; }
.chip-pneu  { background: #D1ECF1; color: #0C5460; }
.chip-hydr  { background: #CCE5FF; color: #004085; }
.chip-steam { background: #F8D7DA; color: #721C24; }
.chip-mech  { background: #E2D9F3; color: #4B2D83; }
.chip-other { background: var(--surface-2); color: var(--gray); }

/* ── Pagination ─────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  font-size: .85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 12px;
}

.page-btns { display: flex; gap: 4px; }

.page-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  font-size: .85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: var(--transition);
}

.page-btn:hover    { background: var(--surface-2); }
.page-btn.active   { background: var(--blue); color: #fff; border-color: var(--blue); font-weight: 700; }
.page-btn:disabled { opacity: .4; cursor: default; }

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  padding: 11px 18px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  margin-bottom: -1px;
  font-family: var(--font);
}

.tab-btn:hover  { color: var(--text); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Section ────────────────────────────────────────────────────────────── */
.section {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface-2);
}

.section-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.icon-elec  { background: #FFF3CD; }
.icon-pneu  { background: #D1ECF1; }
.icon-hydr  { background: #CCE5FF; }
.icon-info  { background: var(--blue-bg); }
.icon-steps { background: #EDF2FF; }

.section-body  { padding: 22px; }

/* ── Steps List ─────────────────────────────────────────────────────────── */
.steps-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }

.step-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.step-num {
  width: 28px;
  height: 28px;
  background: var(--red);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-item.startup .step-num { background: var(--green); }

.step-text {
  font-size: .92rem;
  line-height: 1.65;
  color: var(--text-2);
  padding-top: 3px;
  flex: 1;
}

/* ── Energy Source Table ────────────────────────────────────────────────── */
.energy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.energy-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.energy-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.energy-table tr:last-child td { border-bottom: none; }

.energy-type-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

/* ── Info Grid ──────────────────────────────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
}

.info-item { display: flex; flex-direction: column; gap: 3px; }
.info-label { font-size: .75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; }
.info-value { font-size: .95rem; color: var(--text); font-weight: 500; }
.info-value.empty { color: var(--text-hint); font-style: italic; font-weight: 400; }

/* ── Alert / Notice Banners ─────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: .875rem;
  line-height: 1.55;
  margin-bottom: 20px;
}

.alert-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

.alert-warning  { background: var(--orange-bg); color: var(--orange);  border-left: 3px solid var(--orange);  }
.alert-danger   { background: var(--red-bg);    color: var(--red);     border-left: 3px solid var(--red);     }
.alert-info     { background: var(--blue-bg);   color: var(--blue);    border-left: 3px solid var(--blue);    }
.alert-success  { background: var(--green-bg);  color: var(--green);   border-left: 3px solid var(--green);   }

.alert-warning strong, .alert-danger strong, .alert-info strong, .alert-success strong { color: inherit; }

/* ── Lock Banner ────────────────────────────────────────────────────────── */
.lock-banner {
  background: var(--orange-bg);
  border: 1px solid #FDE68A;
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: .9rem;
  color: var(--orange);
  margin-bottom: 20px;
}

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  padding: 20px;
  backdrop-filter: blur(2px);
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
  overflow: hidden;
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h3 { font-size: 1.05rem; }
.modal-body  { padding: 20px 24px; font-size: .9rem; color: var(--text-2); line-height: 1.6; }
.modal-footer { padding: 16px 24px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--border-light); }

/* ── Toast Notifications ────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  background: var(--text);
  color: #fff;
  border-radius: var(--radius);
  font-size: .875rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  pointer-events: auto;
  animation: slideUp .2s ease;
  max-width: 360px;
}

.toast-success { background: var(--green); }
.toast-error   { background: var(--red); }
.toast-warning { background: var(--orange); }

@keyframes slideUp {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── Loading Overlay ────────────────────────────────────────────────────── */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 8000;
  backdrop-filter: blur(2px);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Login Page ─────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.logo-icon {
  width: auto;
  min-width: 60px;
  height: 60px;
  background: #c82333;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  letter-spacing: -1px;
  margin: 0 auto 16px;
  overflow: hidden;
}
.logo-icon img {
  height: 34px;
  width: auto;
  object-fit: contain;
  display: block;
}

.login-logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.login-logo p {
  font-size: .85rem;
  color: var(--text-muted);
}

.login-error {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid #FECACA;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: .875rem;
  margin-bottom: 16px;
  display: none;
}

.login-defaults {
  margin-top: 24px;
  padding: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: .78rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ── Folder Connect Panel ───────────────────────────────────────────────── */
.fs-notice {
  background: var(--blue-bg);
  border: 1px solid #BFD9F5;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: .85rem;
  color: var(--blue);
  margin-top: 20px;
}
.fs-notice h4 { color: var(--blue); margin-bottom: 4px; font-size: .9rem; }

.fs-connected {
  background: var(--green-bg);
  border-color: #A7F3C0;
  color: var(--green);
}
.fs-connected h4 { color: var(--green); }

.btn-fs {
  width: 100%;
  margin-top: 10px;
  background: var(--surface);
  border: 1.5px solid var(--blue);
  color: var(--blue);
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font);
  font-size: .875rem;
  transition: var(--transition);
}
.btn-fs:hover { background: var(--blue-bg); }

.local-export { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.local-export .btn { flex: 1; font-size: .8rem; }

/* ── Procedure Detail Header ────────────────────────────────────────────── */
.proc-detail-header {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.proc-detail-title { font-size: 1.5rem; font-weight: 700; }
.proc-detail-meta  { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 8px; }
.proc-meta-item { font-size: .82rem; color: var(--text-muted); }
.proc-meta-item strong { color: var(--text-2); font-weight: 600; }

/* ── Utility ────────────────────────────────────────────────────────────── */
.d-none    { display: none !important; }
.d-flex    { display: flex; }
.gap-8     { gap: 8px; }
.gap-12    { gap: 12px; }
.mt-0      { margin-top: 0; }
.mt-16     { margin-top: 16px; }
.mt-24     { margin-top: 24px; }
.mb-20     { margin-bottom: 20px; }
.text-muted { color: var(--text-muted); }
.text-sm   { font-size: .82rem; }
.fw-600    { font-weight: 600; }
.separator { border: none; border-top: 1px solid var(--border-light); margin: 20px 0; }

/* ── Aliases (HTML uses these class names) ──────────────────────────────── */
.tab-bar {
  display: flex;
  gap: 2px;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  padding: 0 28px;
}

.page-container { max-width: 1280px; margin: 0 auto; padding: 32px 28px; }

.step-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }

/* ── Version Chip ────────────────────────────────────────────────────────── */
.version-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  white-space: nowrap;
}

/* ── Field Hint ─────────────────────────────────────────────────────────── */
.field-hint { font-size: .78rem; color: var(--text-muted); margin-top: 5px; line-height: 1.45; }

/* ── Section Title standalone ───────────────────────────────────────────── */
.section-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-light);
}

/* ── Form Row Variants ──────────────────────────────────────────────────── */
.form-row-2 { display: grid; gap: 16px; grid-template-columns: repeat(2, 1fr); }
.form-row-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, 1fr); }

/* ── Photo Components ───────────────────────────────────────────────────── */
.photo-grid { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; }

.photo-thumb-wrap {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.photo-thumb { width: 100%; height: 100%; object-fit: contain; background: #f3f4f6; display: block; }

.photo-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  background: rgba(0,0,0,.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.photo-upload-btn {
  width: 100px;
  height: 100px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 600;
  transition: var(--transition);
  flex-shrink: 0;
}
.photo-upload-btn:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-bg); }
.photo-upload-btn .icon { font-size: 22px; }

/* ── Energy Table Components ────────────────────────────────────────────── */
.energy-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
}

.energy-type-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .2px;
}

.energy-photo-thumb {
  width: 56px;
  height: 42px;
  object-fit: contain;
  background: #f3f4f6;
  border-radius: var(--radius-sm);
  cursor: zoom-in;
  border: 1px solid var(--border);
  display: block;
}

/* ── Isolation Point Pin Mapping ────────────────────────────────────────── */
.e-pin-wrap {
  position: relative;
  display: inline-block;
  border-radius: var(--radius-sm);
  overflow: hidden;
  line-height: 0;
}

.e-pin-wrap.e-pin-edit {
  cursor: crosshair;
  width: 100%;
}

.e-pin-wrap img {
  display: block;
  width: 100%;
  border-radius: var(--radius-sm);
}

.e-pin-edit img {
  width: 100%;
  max-height: 140px;
  object-fit: cover;
}

.e-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  border: 2px solid rgba(255,255,255,.85);
  box-shadow: 0 1px 5px rgba(0,0,0,.5);
  z-index: 10;
  pointer-events: all;
  line-height: 1;
  cursor: default;
  white-space: nowrap;
}

.e-pin-edit .e-pin {
  cursor: pointer;
}

.e-pin-edit .e-pin:hover { filter: brightness(0.8); }

.e-pin-keys {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 5px;
  line-height: 1.4;
}

.e-pin-key {
  font-size: .7rem;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--text-muted);
}

.e-pin-key-rm {
  font-size: .7rem;
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--text-muted);
  cursor: pointer;
}

.e-pin-key-rm:hover { background: var(--red-bg); color: var(--red); border-color: var(--red); }

.e-pin-actions {
  display: flex;
  gap: 4px;
  margin-top: 5px;
}

/* ── Collapsible ────────────────────────────────────────────────────────── */
.collapsible-content      { display: none; overflow: hidden; }
.collapsible-content.open { display: block; }

/* ── Audit Log ──────────────────────────────────────────────────────────── */
.audit-log { padding-bottom: 20px; }

.audit-entry {
  padding: 11px 0;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.audit-entry:last-child { border-bottom: none; }

.audit-meta    { font-size: .78rem; color: var(--text-muted); }
.audit-action  { font-size: .875rem; font-weight: 600; color: var(--text); }
.audit-changes { margin-top: 4px; }
.audit-change  {
  font-size: .78rem;
  color: var(--text-muted);
  font-family: ui-monospace, 'SF Mono', monospace;
  padding: 2px 0;
}

.audit-entry.audit-approve .audit-action { color: var(--green); }
.audit-entry.audit-submit  .audit-action { color: var(--orange); }
.audit-entry.audit-create  .audit-action { color: var(--blue); }

/* ── Extra Utilities ────────────────────────────────────────────────────── */
.text-right { text-align: right; }
.text-small { font-size: .82rem; }
.mt-2       { margin-top: 8px; }
.mt-3       { margin-top: 12px; }
.mb-2       { margin-bottom: 8px; }

/* ── Form Section Cards ─────────────────────────────────────────────────── */
/*
   Each .form-section becomes a white card on the gray page background.
   The first .section-title inside becomes the card's gray header band.
   Subsequent .section-title elements become subtle sub-section dividers.
*/
.form-section {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  padding: 0 24px 20px;
}

.form-section > .section-title:first-child {
  margin: 0 -24px 20px;
  padding: 13px 24px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-light);
  border-radius: 0;
  font-size: .875rem;
  font-weight: 700;
  color: var(--text-2);
  letter-spacing: .1px;
}

.form-section > .section-title:not(:first-child) {
  margin-top: 20px;
  margin-bottom: 12px;
  padding-top: 14px;
  padding-bottom: 0;
  background: transparent;
  border-top: 1px solid var(--border-light);
  border-bottom: none;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-muted);
}

/* Narrow the form content area — forms read better at ~1100px than at 1280px */
.tab-content-wrap .page-container {
  max-width: 1100px;
}

/* Connect-folder banner on dashboard */
.folder-connect-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--blue-bg);
  border: 1px solid #BFD9F5;
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.folder-connect-banner .fcb-icon { font-size: 28px; flex-shrink: 0; }
.folder-connect-banner .fcb-text { flex: 1; min-width: 220px; }
.folder-connect-banner .fcb-title { font-weight: 700; color: var(--blue); font-size: .95rem; margin-bottom: 2px; }
.folder-connect-banner .fcb-desc  { font-size: .82rem; color: var(--text-muted); }

/* ── Modern UI Polish Layer ───────────────────────────────────────────────
   A quiet Apple/Notion-style pass: lighter chrome, calmer shadows, tighter
   tables, and softer controls without changing the application structure.
*/
:root {
  --bg:           #F7F7F8;
  --surface:      #FFFFFF;
  --surface-2:    #F4F4F5;
  --border:       #DCDCE0;
  --border-light: #ECECEF;
  --text:         #1C1C1E;
  --text-2:       #3C3C43;
  --text-muted:   #6B6B72;
  --text-hint:    #A1A1AA;
  --red:          #B42318;
  --red-hover:    #8F1D15;
  --red-bg:       #FFF1F0;
  --blue:         #2563EB;
  --blue-hover:   #1D4ED8;
  --blue-bg:      #EFF6FF;
  --green:        #15803D;
  --green-bg:     #ECFDF3;
  --orange:       #B45309;
  --orange-bg:    #FFFBEB;
  --shadow-sm:    0 1px 2px rgba(16,24,40,.05);
  --shadow:       0 6px 18px rgba(16,24,40,.08);
  --shadow-lg:    0 20px 50px rgba(16,24,40,.14);
  --radius-sm:    7px;
  --radius:       9px;
  --radius-lg:    12px;
}

body {
  background:
    linear-gradient(180deg, #FFFFFF 0, #F7F7F8 210px),
    var(--bg);
}

.app-header {
  height: 58px;
  background: rgba(255,255,255,.86);
  border-bottom: 1px solid rgba(220,220,224,.82);
  box-shadow: none;
  backdrop-filter: blur(18px);
}

.app-header .brand-title,
.app-header .user-name { color: var(--text); }
.app-header .brand-subtitle,
.app-header .user-role { color: var(--text-muted); }
.app-header .header-user {
  background: #F6F6F7;
  border-color: var(--border-light);
}
.app-header .btn-secondary {
  background: #F6F6F7;
  color: var(--text-2);
  border-color: var(--border-light);
}
.app-header .btn-secondary:hover:not(:disabled) {
  background: #ECECEF;
  color: var(--text);
}
.app-header .btn-ghost { color: var(--text-muted); }
.app-header .btn-ghost:hover:not(:disabled) {
  background: #F1F1F3;
  color: var(--text);
}
.app-header .badge {
  background: #F4F4F5;
  border-color: var(--border-light);
  color: var(--text-2);
}

.brand-icon,
.logo-icon,
.user-avatar {
  border-radius: 10px;
  background: linear-gradient(180deg, #D92D20, #B42318);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.user-avatar { border-radius: 999px; }

.page-content,
.page-content-wide,
.page-container {
  padding-top: 26px;
}

.page-title {
  font-size: 1.45rem;
  letter-spacing: 0;
}

.card,
.stat-card,
.proc-table-wrap,
.form-section,
.section,
.proc-detail-header,
.login-box,
.modal-box {
  border-color: var(--border-light);
  box-shadow: var(--shadow-sm);
}

.card,
.stat-card,
.form-section,
.section,
.proc-detail-header {
  background: rgba(255,255,255,.96);
}

.stat-card {
  padding: 18px 20px;
}
.stat-label {
  letter-spacing: .04em;
}
.stat-value {
  font-size: 1.75rem;
  letter-spacing: 0;
}

.btn {
  border-radius: 8px;
  box-shadow: none;
}
.btn-primary,
.btn-blue {
  background: #1F6FEB;
  border-color: #1F6FEB;
}
.btn-primary:hover:not(:disabled),
.btn-blue:hover:not(:disabled) {
  background: #195CC4;
  border-color: #195CC4;
}
.btn-secondary {
  background: #FFFFFF;
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: #F2F2F4;
}

.form-control,
.search-input,
.filter-bar select {
  border-width: 1px;
  border-color: #D8D8DE;
  background-color: #FFFFFF;
  border-radius: 8px;
}
.form-control:focus,
.search-input:focus,
.filter-bar select:focus {
  border-color: #7AA7F7;
  box-shadow: 0 0 0 4px rgba(37,99,235,.11);
}

.tab-bar {
  position: sticky;
  top: 58px;
  z-index: 150;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(16px);
  border-top: none;
}
.tab-btn {
  border-bottom-width: 2px;
  letter-spacing: 0;
}

.proc-toolbar {
  top: 58px;
  background: rgba(255,255,255,.9) !important;
  border-bottom-color: var(--border-light) !important;
  box-shadow: none !important;
  backdrop-filter: blur(16px);
}

.proc-table thead th,
.energy-table th {
  background: #F7F7F8;
  color: #70707A;
  letter-spacing: .04em;
}
.proc-table td {
  padding-top: 12px;
  padding-bottom: 12px;
}
.proc-table tbody tr:hover {
  background: #F8FAFF;
}

.badge {
  border-radius: 999px;
  font-weight: 650;
}
.badge-active {
  background: #ECFDF3;
}
.badge-pending {
  background: #FFFAEB;
}
.badge-draft,
.badge-archive {
  background: #F4F4F5;
}

.form-section {
  padding-bottom: 22px;
}
.form-section > .section-title:first-child,
.section-header {
  background: #F8F8FA;
}

.login-page {
  background:
    radial-gradient(circle at top, rgba(37,99,235,.08), transparent 32rem),
    linear-gradient(180deg, #FFFFFF 0, #F7F7F8 100%);
}
.login-box {
  max-width: 440px;
  border-radius: 18px;
}
.login-defaults {
  background: #F8F8FA;
}

.modal-overlay {
  background: rgba(28,28,30,.28);
  backdrop-filter: blur(8px);
}
.modal-box {
  border: 1px solid rgba(255,255,255,.7);
}

/* ══════════════════════════════════════════════════════════════════════════
   BRADY-STYLE PRINT CARD
   ══════════════════════════════════════════════════════════════════════════ */

@media print {
  body { background: #fff !important; }
  .app-header, .page-header .btn, .tabs, .btn, .filter-bar,
  .pagination, #toast-container, #loading-overlay,
  .no-print { display: none !important; }
  .page-content { padding: 0; max-width: 100%; }
  .brady-card { border: 2px solid #000; }
}

/* ── Photo Lightbox ─────────────────────────────────────────────────────── */
#photo-lightbox.lb-open {
  background: rgba(0,0,0,.82) !important;
  backdrop-filter: blur(6px) !important;
}
#photo-lightbox.lb-open #lightbox-img {
  transform: scale(1) !important;
}
#photo-lightbox.lb-open #lightbox-caption {
  opacity: 1 !important;
}
.lb-photo-trigger {
  cursor: zoom-in;
  display: block;
  position: relative;
}
.lb-photo-trigger:hover::after {
  content: '🔍';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: rgba(0,0,0,.25);
  border-radius: 2px;
}

.brady-card {
  background: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11pt;
  color: #000;
  max-width: 860px;
  margin: 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.brady-header {
  display: grid;
  grid-template-columns: 110px 1fr 120px;
  align-items: stretch;
  border-bottom: 2px solid #000;
}

.brady-logo-cell {
  padding: 10px 12px;
  border-right: 1px solid #CCC;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brady-logo-box {
  background: #CC0000;
  color: #fff;
  font-weight: 900;
  font-size: 16pt;
  width: 56px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  letter-spacing: -1px;
}

.brady-title-cell {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brady-main-title {
  font-size: 12pt;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.brady-subtitle {
  font-size: 8pt;
  color: #444;
  margin-top: 2px;
  letter-spacing: .3px;
}

.brady-id-cell {
  padding: 8px 12px;
  border-left: 1px solid #CCC;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #F5F5F5;
  text-align: center;
}

.brady-id-label { font-size: 7pt; text-transform: uppercase; letter-spacing: .5px; color: #555; font-weight: 700; }
.brady-id-value { font-size: 15pt; font-weight: 900; color: #CC0000; line-height: 1; margin-top: 2px; }

.brady-info-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid #CCC;
}

.brady-info-cell {
  padding: 7px 12px;
  border-right: 1px solid #DDD;
}
.brady-info-cell:last-child { border-right: none; }
.brady-info-key { font-size: 7pt; text-transform: uppercase; letter-spacing: .4px; color: #666; font-weight: 700; }
.brady-info-val { font-size: 10pt; font-weight: 600; color: #000; margin-top: 1px; }
.brady-info-val.missing { color: #CC0000; font-weight: 400; font-style: italic; }

.brady-body {
  display: grid;
  grid-template-columns: 240px 1fr;
  border-bottom: 1px solid #CCC;
  min-height: 200px;
}

.brady-photo-cell {
  border-right: 1px solid #CCC;
  overflow: hidden;
  background: #F0F0F0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  min-height: 180px;
}

.brady-photo-cell img { width: 100%; height: 100%; object-fit: cover; }

.brady-photo-placeholder {
  color: #AAA;
  font-size: 9pt;
  text-align: center;
  padding: 16px;
  line-height: 1.5;
}

.brady-energy-cell { display: flex; flex-direction: column; }

.brady-energy-title {
  padding: 6px 12px;
  font-size: 8pt;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .6px;
  background: #1A1A1A;
  color: #FFF;
}

.brady-energy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9pt;
  flex: 1;
}

.brady-energy-table th {
  padding: 5px 10px;
  font-size: 7pt;
  text-transform: uppercase;
  letter-spacing: .4px;
  background: #EFEFEF;
  border-bottom: 1px solid #CCC;
  text-align: left;
  font-weight: 700;
  color: #555;
}

.brady-energy-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #EEE;
  vertical-align: middle;
}
.brady-energy-table tr:last-child td { border-bottom: none; }

.brady-energy-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 9pt;
}

.e-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}

.e-elec  { background: #F59E0B; }
.e-pneu  { background: #06B6D4; }
.e-hydr  { background: #3B82F6; }
.e-steam { background: #EF4444; }
.e-mech  { background: #8B5CF6; }

.brady-caution {
  border-bottom: 1px solid #CCC;
  padding: 8px 14px;
  background: #FFFBEB;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 9pt;
  line-height: 1.5;
}

.brady-caution-label {
  background: #F59E0B;
  color: #000;
  font-weight: 900;
  font-size: 7pt;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 2px 7px;
  border-radius: 3px;
  flex-shrink: 0;
  margin-top: 1px;
}

.brady-steps-section { border-bottom: 1px solid #CCC; }
.brady-steps-section:last-child { border-bottom: none; }

.brady-steps-title {
  padding: 6px 14px;
  font-size: 8pt;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #fff;
}

.brady-steps-title.shutdown { background: #CC0000; }
.brady-steps-title.startup  { background: #1A7F37; }

.brady-steps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 9pt;
}

.brady-steps-table th {
  padding: 5px 10px;
  font-size: 7pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  background: #F5F5F5;
  border-bottom: 1px solid #DDD;
  color: #555;
  text-align: left;
}

.brady-steps-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #EEE;
  vertical-align: top;
  line-height: 1.5;
}
.brady-steps-table tr:last-child td { border-bottom: none; }

.brady-step-num-cell { width: 36px; text-align: center; }

.brady-step-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8pt;
  font-weight: 900;
  color: #fff;
}

.brady-step-circle.shutdown { background: #CC0000; }
.brady-step-circle.startup  { background: #1A7F37; }

.brady-footer {
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 8pt;
  color: #555;
  background: #F5F5F5;
  border-top: 1px solid #CCC;
}

/* ── Brady Link360 Short Form Replica ──────────────────────────────────── */
@page {
  size: letter;
  margin: .25in;
}

@media print {
  html, body {
    width: 8.5in;
    min-height: 11in;
  }
  body {
    margin: 0 !important;
    background: #fff !important;
  }
  #print-view {
    width: 8in;
    margin: 0 auto;
  }
  .brady-card.b360-card {
    width: 8in !important;
    max-width: 8in !important;
    min-height: 10.5in;
    margin: 0 auto !important;
    border: none !important;
    box-shadow: none !important;
  }
}

.brady-card.b360-card {
  width: 8in;
  max-width: 8in;
  min-height: 10.5in;
  margin: 20px auto;
  padding: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  background: #fff;
  color: #000;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12pt;
  line-height: 1.15;
}

.b360-top {
  display: grid;
  grid-template-columns: 1.2in 1fr 1.2in;
  height: .82in;
  margin-bottom: 0;
}

.b360-stripe {
  border-top: 1px solid #E23B2A;
  background:
    repeating-linear-gradient(135deg, #E23B2A 0 14px, #fff 14px 28px);
}
.b360-stripe-left {
  clip-path: polygon(42% 0, 100% 0, 100% 100%, 0 100%);
}
.b360-stripe-right {
  clip-path: polygon(0 0, 58% 0, 100% 100%, 0 100%);
}

.b360-title {
  border-top: 1px solid #E23B2A;
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
}
.b360-title img {
  max-width: .9in;
  max-height: .42in;
  object-fit: contain;
  flex: 0 0 auto;
}
.b360-title strong {
  font-size: 18pt;
  line-height: 1;
  font-weight: 800;
  white-space: nowrap;
  min-width: 0;
}
.b360-logo-fallback {
  align-items: center;
  justify-content: center;
  width: .85in;
  height: .35in;
  background: #CC0000;
  color: #fff;
  font-weight: 900;
  font-size: 10pt;
}

.b360-meta {
  display: grid;
  grid-template-columns: 2.45in 2.75in 2.8in;
  grid-template-rows: .34in .34in;
  border: 1px solid #E23B2A;
  margin-bottom: .09in;
}
.b360-meta > div {
  border-right: 1px solid #E23B2A;
  border-bottom: 1px solid #E23B2A;
  padding: 4px 6px;
}
.b360-meta > div:nth-child(3),
.b360-meta > div:nth-child(4) {
  border-right: none;
}
.b360-id-cell {
  grid-row: 1 / span 2;
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  row-gap: 1px;
}
.b360-id-cell div {
  display: grid;
  grid-template-columns: .72in 1fr;
  align-items: center;
}
.b360-meta span {
  display: block;
  font-size: 6.5pt;
  font-weight: 800;
}
.b360-id-cell span {
  font-size: 10pt;
}
.b360-meta strong {
  display: block;
  font-size: 15pt;
  font-weight: 400;
  text-align: center;
  line-height: 1;
}
.b360-id-cell strong {
  text-align: left;
  font-size: 10pt;
}
.b360-description-cell {
  grid-column: 2 / span 2;
}

.b360-note-row {
  display: grid;
  grid-template-columns: 1.8in 1fr;
  gap: .32in;
  align-items: stretch;
  margin: .05in 0 .1in;
}
.b360-lock-points {
  display: grid;
  grid-template-columns: .67in 1fr;
  height: .54in;
  border: 1px solid #000;
}
.b360-lock-number {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34pt;
  font-weight: 900;
  line-height: 1;
}
.b360-lock-label {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #6E7470;
  color: #fff;
  font-size: 18pt;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}
.b360-note {
  border: 1px solid #000;
  padding: 7px 10px;
  display: grid;
  grid-template-columns: .5in 1fr;
  gap: 8px;
  font-size: 11pt;
}
.b360-note strong {
  color: #E23B2A;
  font-size: 13pt;
}

.b360-process-bar {
  height: .32in;
  color: #fff;
  font-size: 18pt;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #000;
  border-bottom: none;
}
.b360-red { background: #E23B2A; }
.b360-green { background: #188847; }
.b360-process-text {
  border: 1px solid #000;
  padding: 6px;
  min-height: .42in;
  font-size: 12pt;
  line-height: 1.15;
}

.b360-photo-grid {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: .55in;
  align-items: start;
  margin: .15in .32in .13in .32in;
  min-height: 3.25in;
}
.b360-photo-card {
  text-align: center;
}
.b360-photo-title {
  font-size: 13pt;
  margin-bottom: .08in;
  min-height: .2in;
}
.b360-photo-frame {
  position: relative;
  height: 2.8in;
  display: flex;
  align-items: center;
  justify-content: center;
}
.b360-photo-frame img {
  max-width: 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.b360-photo-placeholder {
  height: 2.8in;
  width: 100%;
  border: 1px dashed #999;
  color: #777;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11pt;
}
.b360-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  background: #fff;
  color: #E23B2A;
  border: 1px solid #E23B2A;
  padding: 1px 5px;
  font-size: 10pt;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.b360-pin-default {
  right: .08in;
  top: .22in;
  left: auto;
  transform: none;
}

.b360-energy-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12pt;
  line-height: 1.15;
  margin-top: .02in;
}
.b360-energy-table th,
.b360-energy-table td {
  border: 1px solid #000;
  vertical-align: top;
}
.b360-energy-table th {
  font-size: 13pt;
  font-weight: 900;
  text-align: center;
  padding: 7px 6px;
}
.b360-energy-table td {
  padding: 7px 6px;
  min-height: .68in;
}
.b360-energy-table th:nth-child(1),
.b360-energy-table td:nth-child(1) { width: 25%; }
.b360-energy-table th:nth-child(2),
.b360-energy-table td:nth-child(2) { width: 25%; }
.b360-energy-table th:nth-child(3),
.b360-energy-table td:nth-child(3) { width: 25%; }
.b360-energy-table th:nth-child(4),
.b360-energy-table td:nth-child(4) { width: 25%; }

.b360-energy-source {
  padding: 6px 8px !important;
  font-size: 12pt;
}
.b360-energy-line {
  display: grid;
  grid-template-columns: .45in 1fr;
  gap: 4px;
  margin-bottom: 8px;
}
.b360-energy-code,
.b360-energy-mag {
  margin-left: .58in;
  margin-top: 5px;
}
.b360-energy-code {
  display: inline-block;
  background: #fff;
  color: #000;
  border: 1px solid #000;
  padding: 1px 5px;
  margin-left: .02in;
}

.b360-footer {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  font-size: 8.5pt;
  margin-top: .18in;
  padding: 0 5px;
}
.b360-footer span:nth-child(2) { text-align: center; }
.b360-footer span:nth-child(3) { text-align: right; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .page-content, .page-content-wide, .page-container { padding: 20px 16px; }
  .app-header { padding: 0 16px; height: 56px; }
  .tab-bar { padding: 0 16px; }
  .brand-subtitle { display: none; }
  .user-info { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .login-box { padding: 32px 24px; }
  .form-row-2 { grid-template-columns: 1fr; }
  .form-row-3 { grid-template-columns: 1fr; }
  .brady-header { grid-template-columns: 1fr; }
  .brady-body   { grid-template-columns: 1fr; }
  .brady-info-row { grid-template-columns: repeat(2, 1fr); }
}
