/* ============================================================
   COIL DATA BANK — STYLESHEET
   Kuwait Heat Transfer Co
   ============================================================ */

/* ---- FONTS & RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0d1b2a;
  --bg2:        #111f30;
  --bg3:        #16273a;
  --surface:    #ffffff;
  --surface2:   #f4f6f9;
  --surface3:   #eaecf0;
  --border:     #dde1e8;
  --border2:    #c8cdd6;
  --text:       #1a2332;
  --text2:      #4a5568;
  --text3:      #8a96a8;
  --accent:     #00acc1;
  --accent2:    #0097a7;
  --accent-light: #e0f7fa;
  --green:      #2e7d32;
  --green-light:#e8f5e9;
  --amber:      #f59e0b;
  --amber-light:#fffbeb;
  --red:        #c62828;
  --red-light:  #fdecea;
  --navy:       #0d1b2a;
  --sidebar-w:  240px;
  --topbar-h:   56px;
  --radius:     8px;
  --radius-sm:  5px;
  --shadow:     0 2px 8px rgba(0,0,0,.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,.12);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.16);
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--surface2);
  min-height: 100vh;
  line-height: 1.5;
}

a { text-decoration: none; color: var(--accent); }
a:hover { color: var(--accent2); }

/* ============================================================
   LOGIN
   ============================================================ */
.login-body { background: var(--bg); }

.login-page {
  display: flex;
  min-height: 100vh;
}

.login-left {
  width: 420px;
  background: var(--bg);
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-hex {
  font-size: 40px;
  color: var(--accent);
  line-height: 1;
}

.login-brand h1 {
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.login-brand p {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
}

.login-tagline h2 {
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 12px;
}

.login-tagline p {
  color: var(--text3);
  font-size: 15px;
}

.login-dots { display: flex; gap: 8px; }
.login-dots span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); opacity: 0.4;
}
.login-dots span:first-child { opacity: 1; }

.login-right {
  flex: 1;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.login-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.login-card-header { margin-bottom: 28px; }
.login-card-header h3 { font-size: 22px; font-weight: 700; color: var(--text); }
.login-card-header p  { color: var(--text3); margin-top: 4px; }

.login-footer-note { margin-top: 20px; text-align: center; color: var(--text3); }

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 200;
  transition: transform 0.25s ease;
}

.sidebar-header {
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  font-size: 22px;
  color: var(--accent);
}

.logo-name { font-size: 16px; font-weight: 800; color: #fff; letter-spacing: -0.3px; line-height: 1; }
.logo-company { font-size: 10px; color: var(--text3); letter-spacing: 1px; }

.sidebar-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text3);
  font-size: 16px;
  cursor: pointer;
  display: none;
  padding: 4px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 10px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: var(--text3);
  padding: 14px 10px 6px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.6);
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
}

.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(0,172,193,.15); color: var(--accent); }
.nav-icon { font-size: 15px; opacity: 0.8; }

.nav-item-accent {
  background: var(--accent);
  color: #fff !important;
  font-weight: 600;
}
.nav-item-accent:hover { background: var(--accent2); color: #fff; }
.nav-item-accent.active { background: var(--accent2); }

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.06);
  padding: 14px 12px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

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

.user-name  { font-size: 13px; font-weight: 600; color: #fff; line-height: 1.2; }
.user-role  { font-size: 11px; color: var(--text3); }

.logout-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px; color: var(--text3);
  transition: all 0.15s;
  width: 100%;
}
.logout-btn:hover { background: rgba(255,255,255,.06); color: var(--red); }

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 190;
}

/* ---- MAIN CONTENT ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.top-bar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.hamburger span { display: block; width: 20px; height: 2px; background: var(--text); border-radius: 1px; }

.top-bar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.btn-new-top {
  background: var(--accent);
  color: #fff;
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
}
.btn-new-top:hover { background: var(--accent2); color: #fff; }

.page-content { padding: 24px; flex: 1; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  font-family: inherit;
  text-decoration: none;
}

.btn-primary   { background: var(--accent);  color: #fff; }
.btn-primary:hover { background: var(--accent2); color: #fff; }
.btn-secondary { background: var(--navy);    color: #fff; }
.btn-secondary:hover { background: #1a3a55; color: #fff; }
.btn-outline   { background: transparent; color: var(--text); border: 1.5px solid var(--border2); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger    { background: var(--red); color: #fff; }
.btn-sm        { padding: 6px 12px; font-size: 12.5px; }
.btn-full      { width: 100%; justify-content: center; }
.btn:disabled  { opacity: 0.6; cursor: not-allowed; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text2); margin-bottom: 5px; }

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
}

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

.form-control:invalid { border-color: var(--red); }

.fc-sm { padding: 6px 8px; font-size: 12.5px; }

.req { color: var(--red); }
.form-hint { font-size: 11.5px; color: var(--text3); margin-top: 4px; }
.section-hint { font-size: 12.5px; color: var(--text3); margin-bottom: 12px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px 16px;
}
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title { font-size: 14px; font-weight: 700; color: var(--text); }
.card-action { font-size: 12.5px; color: var(--accent); font-weight: 600; }
.card-empty { padding: 24px; text-align: center; color: var(--text3); font-size: 13px; }
.card-full  { grid-column: 1 / -1; }
.card-half  { }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.stats-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

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

.stat-blue  { background: #e3f2fd; color: #1565c0; }
.stat-teal  { background: var(--accent-light); color: var(--accent2); }
.stat-amber { background: var(--amber-light); color: var(--amber); }
.stat-green { background: var(--green-light); color: var(--green); }

.stat-number { font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label  { font-size: 12px; color: var(--text3); margin-top: 3px; }

.quick-actions {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quick-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  color: var(--text);
  font-weight: 500;
  font-size: 13px;
  transition: all 0.15s;
  border: 1px solid var(--border);
}
.quick-btn:hover { background: var(--accent-light); color: var(--accent); border-color: var(--accent); }
.quick-btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.quick-btn-primary:hover { background: var(--accent2); color: #fff; }

.quote-list { padding: 0 4px; }
.quote-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.quote-item:last-child { border-bottom: none; }
.quote-customer { font-size: 12.5px; color: var(--text2); margin-left: 8px; }
.quote-price { font-family: 'IBM Plex Mono', monospace; font-size: 13px; font-weight: 600; color: var(--accent); white-space: nowrap; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  padding: 10px 14px;
  background: var(--surface2);
  color: var(--text3);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  text-align: left;
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}

.data-row { cursor: pointer; transition: background 0.1s; }
.data-row:hover { background: var(--accent-light); }
.data-row:last-child td { border-bottom: none; }
.row-draft { opacity: 0.65; }

.empty-row { text-align: center; color: var(--text3); padding: 32px !important; }
.tbl-action { font-size: 12px; color: var(--accent); font-weight: 600; white-space: nowrap; }
.tbl-action:hover { color: var(--accent2); }
.row-actions { display: flex; gap: 10px; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.badge-secondary { background: #e2e8f0; color: #4a5568; }
.badge-info      { background: #e3f2fd; color: #1565c0; }
.badge-warning   { background: var(--amber-light); color: #92400e; }
.badge-primary   { background: #e8eaf6; color: #3949ab; }
.badge-success   { background: var(--green-light); color: var(--green); }
.badge-dark      { background: #263238; color: #fff; }
.badge-danger    { background: var(--red-light); color: var(--red); }
.badge-draft     { background: #e2e8f0; color: #718096; }

.coil-id-badge {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  background: var(--navy);
  color: var(--accent);
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
}
.coil-id-badge.small { font-size: 10.5px; padding: 2px 6px; }

.photo-count-badge { font-size: 12px; color: var(--text2); }
.price-col { white-space: nowrap; }
.price-tag { font-family: 'IBM Plex Mono', monospace; font-weight: 600; color: var(--accent); font-size: 12.5px; }
.mono { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; }

/* ============================================================
   FILTERS
   ============================================================ */
.filter-bar {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.filter-search { margin-bottom: 10px; }
.search-input  { font-size: 14px; }
.filter-row    { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-input  { min-width: 140px; flex: 1; max-width: 200px; }

.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.results-count { font-size: 13px; color: var(--text2); }
.results-actions { display: flex; gap: 8px; }
.clear-filters { font-size: 12px; color: var(--red); margin-left: 8px; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }
.page-btn {
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ============================================================
   FORM PAGE (new/edit)
   ============================================================ */
.form-page { max-width: 900px; }

.form-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
}

.form-page-header h2 { font-size: 20px; font-weight: 800; }
.coil-id-preview { font-size: 12px; color: var(--text3); margin-top: 4px; }
.coil-id-preview strong { font-family: 'IBM Plex Mono', monospace; color: var(--accent); }
.form-header-actions { display: flex; gap: 10px; flex-shrink: 0; }

.form-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 6px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  overflow-x: auto;
}

.form-tab {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text3);
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.form-tab.active { background: var(--accent); color: #fff; }
.form-tab:hover:not(.active) { background: var(--surface2); color: var(--text); }

.form-tab-content { display: none; }
.form-tab-content.active { display: block; }

.form-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.section-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.form-section-inner { margin-top: 14px; }

.form-actions-bar {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 -24px -24px;
  box-shadow: 0 -2px 12px rgba(0,0,0,.06);
  z-index: 50;
}

/* GPS */
.gps-group .gps-row { display: flex; gap: 8px; align-items: center; }
.gps-map-link { font-size: 12.5px; color: var(--accent); font-weight: 600; }

/* Connections mini table */
.connections-table-wrap { overflow-x: auto; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 8px; }
.mini-table th { padding: 7px 10px; background: var(--surface2); color: var(--text3); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; border: 1px solid var(--border); text-align: left; }
.mini-table td { padding: 6px 8px; border: 1px solid var(--border); }
.btn-del-row { background: none; border: none; color: var(--red); cursor: pointer; font-size: 14px; padding: 2px 6px; border-radius: 3px; }
.btn-del-row:hover { background: var(--red-light); }

/* Upload */
.upload-zone {
  border: 2px dashed var(--border2);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--surface2);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}
.upload-icon { font-size: 36px; margin-bottom: 10px; }
.upload-text { font-size: 15px; font-weight: 600; color: var(--text2); margin-bottom: 4px; }
.upload-hint { font-size: 12px; color: var(--text3); margin-bottom: 14px; }

.file-preview-area { margin-top: 16px; }
.file-preview-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.fp-thumb { width: 48px; height: 48px; border-radius: 4px; overflow: hidden; background: var(--surface2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 24px; }
.fp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.fp-name { font-size: 13px; font-weight: 500; }
.fp-size { font-size: 11px; color: var(--text3); }
.fp-del { margin-left: auto; background: none; border: none; color: var(--red); cursor: pointer; font-size: 16px; padding: 4px 8px; border-radius: 3px; }
.fp-del:hover { background: var(--red-light); }

/* Offline bar */
.offline-bar {
  background: var(--amber);
  color: #fff;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

/* ============================================================
   VIEW PAGE
   ============================================================ */
.view-page { max-width: 1100px; }

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
}

.back-link { font-size: 12.5px; color: var(--text3); display: block; margin-bottom: 6px; }
.back-link:hover { color: var(--accent); }
.view-header h2 { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.view-subtitle { font-size: 13px; color: var(--text3); margin-top: 4px; }
.view-header-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }

.info-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.info-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12.5px;
  color: var(--text2);
}
.info-pill span { font-size: 11px; color: var(--text3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

.view-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.view-col { display: flex; flex-direction: column; gap: 16px; }

.detail-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.detail-card-title {
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 700;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  color: var(--text2);
}
.detail-grid { padding: 4px 0; }
.detail-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row span { color: var(--text3); font-size: 12px; }
.detail-row strong { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; color: var(--text); text-align: right; }

.size-display {
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.size-val  { font-size: 24px; font-weight: 800; font-family: 'IBM Plex Mono', monospace; color: var(--navy); }
.size-sep  { font-size: 20px; color: var(--text3); }
.size-unit { font-size: 12px; color: var(--text3); }

.gps-info { padding: 12px 14px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.remarks-block { padding: 12px 14px; font-size: 13px; color: var(--text2); line-height: 1.6; }

.section-card { margin-bottom: 20px; }

/* Price form inline */
.inline-form {
  padding: 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.status-update-row {
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Photo grid */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  padding: 16px;
}

.photo-item { position: relative; }
.photo-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface2);
  border: 1px solid var(--border);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.2s; }
.photo-thumb:hover img { transform: scale(1.05); }
.photo-pdf {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 28px; color: var(--red);
  gap: 6px; font-size: 30px;
}
.photo-pdf span { font-size: 12px; font-weight: 700; color: var(--red); }
.photo-label { font-size: 11px; font-weight: 600; color: var(--text2); margin-top: 5px; text-align: center; }
.photo-name  { font-size: 10px; color: var(--text3); text-align: center; word-break: break-all; }
.photo-del {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,.5); color: #fff;
  border: none; border-radius: 50%;
  width: 22px; height: 22px;
  font-size: 11px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.2s;
}
.photo-item:hover .photo-del { opacity: 1; }

/* Audit */
.audit-list { padding: 6px 0; }
.audit-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text2);
}
.audit-item:last-child { border-bottom: none; }
.audit-action { font-weight: 700; color: var(--text); text-transform: capitalize; }
.audit-changes { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.audit-change-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
}
.audit-more { font-size: 11px; color: var(--text3); }

/* ============================================================
   ADMIN PAGES
   ============================================================ */
.admin-page { max-width: 1100px; }
.admin-header { margin-bottom: 20px; }
.admin-header h2 { font-size: 20px; font-weight: 800; }
.page-subtitle { font-size: 13px; color: var(--text3); margin-top: 4px; }

.admin-layout { display: grid; grid-template-columns: 200px 1fr; gap: 20px; }

.cat-sidebar {
  display: flex; flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 8px;
  align-self: start;
}

.cat-link {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text2);
  font-weight: 500;
  transition: all 0.15s;
  margin-bottom: 2px;
}
.cat-link:hover { background: var(--surface2); color: var(--text); }
.cat-link.active { background: var(--accent); color: #fff; }

.cat-panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.cat-panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.cat-panel-header h3 { font-size: 15px; font-weight: 700; }

.values-list { padding: 8px; }
.value-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 6px;
  background: var(--surface);
}
.value-row:hover { border-color: var(--border2); }
.value-text { font-size: 13.5px; }
.btn-del-value {
  background: none; border: none; color: var(--text3);
  cursor: pointer; font-size: 16px; padding: 2px 8px;
  border-radius: 3px; transition: all 0.15s;
}
.btn-del-value:hover { background: var(--red-light); color: var(--red); }

.role-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.role-admin { background: #fce4ec; color: #880e4f; }
.role-technician { background: #e3f2fd; color: #1565c0; }
.role-sales { background: #e8f5e9; color: #1b5e20; }
.role-production { background: #fff3e0; color: #e65100; }
.role-viewer { background: #f3e5f5; color: #6a1b9a; }

.mini-scroll-list { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.mini-list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.mini-list-item:last-child { border-bottom: none; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.alert-success { background: var(--green-light); color: var(--green); border: 1px solid #a5d6a7; }
.alert-danger  { background: var(--red-light);   color: var(--red);   border: 1px solid #ef9a9a; }
.alert-close { background: none; border: none; cursor: pointer; font-size: 16px; color: inherit; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal-header {
  padding: 16px 20px;
  font-size: 15px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.modal-header-warn { background: var(--amber-light); }
.modal-body   { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

.duplicate-details {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin: 10px 0;
  font-size: 13px;
}

/* ============================================================
   LIST PAGE
   ============================================================ */
.list-page { }

/* ============================================================
   RESPONSIVE / MOBILE
   ============================================================ */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    transform: translateX(-240px);
    width: 240px;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .sidebar-close { display: flex; }

  .sidebar-overlay.open { display: block; }

  .main-content { margin-left: 0; }

  .hamburger { display: flex; }

  .btn-new-top { display: none; }

  .page-content { padding: 14px; }

  .stats-row { grid-template-columns: repeat(2, 1fr); }

  .dashboard-grid { grid-template-columns: 1fr; }

  .view-grid { grid-template-columns: 1fr; }

  .form-grid { grid-template-columns: 1fr; }
  .form-grid-3 { grid-template-columns: 1fr 1fr; }

  .admin-layout { grid-template-columns: 1fr; }

  .cat-sidebar { flex-direction: row; flex-wrap: wrap; }

  .form-page-header { flex-direction: column; align-items: stretch; }
  .form-header-actions { justify-content: flex-end; }

  .view-header { flex-direction: column; }
  .view-header-actions { justify-content: flex-start; }

  .filter-row { gap: 6px; }
  .filter-input { max-width: 100%; }

  .form-tabs { padding: 4px; }
  .form-tab  { padding: 7px 10px; font-size: 11.5px; }

  .stat-number { font-size: 22px; }

  .results-bar { flex-direction: column; align-items: flex-start; gap: 8px; }

  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }

  .size-val { font-size: 18px; }

  .login-left { display: none; }
  .login-right { padding: 20px; }
  .login-card { padding: 28px 20px; }
}

@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .form-grid-3 { grid-template-columns: 1fr; }
  .form-actions-bar { flex-direction: column; gap: 10px; }
  .form-actions-bar > div { width: 100%; justify-content: flex-end; }
  .top-bar { padding: 0 12px; }
  .info-pills { gap: 6px; }
  .view-header h2 { font-size: 16px; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-center { text-align: center; }
.text-muted  { color: var(--text3); }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 20px; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 12px; }
