*{box-sizing:border-box}
body{margin:0;font-family:Arial,Helvetica,sans-serif;background:#f3f6f9;color:#17202a}
.topbar{background:#172b4d;color:#fff;padding:24px 5%;box-shadow:0 2px 10px rgba(0,0,0,.12)}
.topbar h1{margin:0;font-size:25px;letter-spacing:.4px}.topbar p{margin:7px 0 0;opacity:.8}
.container{width:min(1200px,92%);margin:28px auto 50px}
.tabs{display:flex;gap:8px;margin-bottom:18px}.tab{border:0;background:#dfe5ec;padding:12px 24px;border-radius:8px;cursor:pointer;font-weight:700}.tab.active{background:#172b4d;color:#fff}
.tab-panel{display:none}.tab-panel.active{display:block}
.card{background:#fff;border-radius:12px;padding:24px;margin-bottom:20px;box-shadow:0 3px 15px rgba(20,40,60,.08)}
.section-title{display:flex;justify-content:space-between;align-items:center;margin-bottom:18px}.section-title h2{margin:0;font-size:20px}
.grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}
label,.label{font-size:13px;font-weight:700;color:#46515d}
input,select{width:100%;margin-top:7px;padding:12px;border:1px solid #ccd4dc;border-radius:7px;font-size:15px;background:#fff}
input:focus,select:focus{outline:2px solid #9bb9df;border-color:#477bb7}
.radio-row{display:flex;gap:22px;margin-top:13px}.radio-row label{font-weight:600;color:#27313b}.radio-row input{width:auto;margin:0}
.field-group{padding-top:1px}
.actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:22px}
.btn{border:0;border-radius:7px;padding:11px 17px;font-weight:700;cursor:pointer}.btn.primary{background:#172b4d;color:#fff}.btn.success{background:#198754;color:#fff}.btn.secondary{background:#e7ebef;color:#24303b}.btn.danger{background:#c0392b;color:#fff}.btn.small{padding:8px 12px}
.results-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}.result-card{background:#fff;border-radius:10px;padding:18px;box-shadow:0 3px 12px rgba(20,40,60,.07)}.result-card span{display:block;color:#68737e;font-size:13px;margin-bottom:9px}.result-card strong{font-size:22px}.result-card.highlight{border:2px solid #198754}
.message{padding:11px 14px;border-radius:7px;margin-bottom:16px}.message.success{background:#dff3e7;color:#146c43}.message.error{background:#fde2e1;color:#9b2721}.hidden{display:none}
.table-wrap{overflow:auto}table{width:100%;border-collapse:collapse;min-width:700px}th,td{padding:12px 10px;border-bottom:1px solid #e7ebef;text-align:left;font-size:14px}th{background:#f5f7f9;color:#44515e}td .btn{margin-right:5px}
@media(max-width:850px){.results-grid{grid-template-columns:repeat(2,1fr)}}@media(max-width:600px){.grid{grid-template-columns:1fr}.results-grid{grid-template-columns:1fr}.tabs{flex-wrap:wrap}.tab{flex:1}}

.checkbox-row{display:flex;align-items:center;gap:9px;margin-top:13px;font-weight:600;color:#27313b}.checkbox-row input{width:auto;margin:0}

.search-row{display:flex;gap:10px;align-items:center;margin-bottom:18px}
.search-row input{flex:1;margin-top:0}.search-row select{width:220px;margin-top:0}
.psqca-notice{background:#fff3cd;color:#664d03;border:1px solid #ffecb5;padding:12px 14px;border-radius:8px;margin-bottom:16px;font-weight:700}
@media(max-width:600px){.search-row{flex-direction:column;align-items:stretch}.search-row select{width:100%}}

.optional{font-weight:400;color:#7b8794}.image-preview-wrap{padding-top:1px}.product-preview{display:block;width:90px;height:90px;object-fit:cover;border:1px solid #d7dde3;border-radius:9px;margin-top:7px}.table-product-image{width:48px;height:48px;object-fit:cover;border-radius:7px;border:1px solid #e0e5ea}.no-image{color:#8b949e;font-size:12px}

.table-product-image{cursor:zoom-in;transition:transform .15s ease,box-shadow .15s ease}.table-product-image:hover{transform:scale(1.06);box-shadow:0 3px 10px rgba(0,0,0,.16)}
.image-modal{position:fixed;inset:0;z-index:9999;background:rgba(0,0,0,.82);display:flex;align-items:center;justify-content:center;padding:30px;overflow:auto}
.image-modal.hidden{display:none}
.image-modal-content{max-width:100%;max-height:100%;display:flex;align-items:center;justify-content:center}
.image-modal-content img{width:auto;height:auto;max-width:none;max-height:none;display:block;background:#fff;box-shadow:0 8px 40px rgba(0,0,0,.45)}
.image-modal-close{position:fixed;top:18px;right:24px;z-index:10000;width:46px;height:46px;border:0;border-radius:50%;background:#fff;color:#111;font-size:31px;line-height:42px;cursor:pointer;box-shadow:0 3px 15px rgba(0,0,0,.25)}
.image-modal-close:hover{background:#eceff2}
@media(max-width:700px){.image-modal{padding:70px 15px 20px}.image-modal-content img{max-width:100%;height:auto}}

.selected-product-info{grid-column:1/-1;display:flex;align-items:flex-start;gap:28px;padding:14px 16px;border:1px solid #dfe5eb;border-radius:10px;background:#f8fafc;margin-top:-2px}
.selected-product-info.hidden{display:none}
.selected-product-info>div{display:flex;flex-direction:column;gap:6px}
.selected-product-caption{font-size:12px;font-weight:700;color:#6b7682;text-transform:uppercase;letter-spacing:.04em}
.selected-product-image-wrap.hidden{display:none}
.calculator-product-image{width:80px;height:80px;object-fit:cover;border:1px solid #d7dde3;border-radius:9px;cursor:zoom-in;transition:transform .15s ease,box-shadow .15s ease}
.calculator-product-image:hover{transform:scale(1.05);box-shadow:0 3px 10px rgba(0,0,0,.16)}
@media(max-width:600px){.selected-product-info{flex-direction:column;gap:14px}}

.user-menu{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.user-menu a{text-decoration:none}
.login-page{min-height:100vh;background:#eef2f6}.login-shell{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px}.login-card{width:min(430px,100%);background:#fff;border-radius:14px;padding:30px;box-shadow:0 12px 40px rgba(0,0,0,.10)}.login-card h1{margin:0 0 4px}.login-subtitle{margin:0 0 22px;color:#6b7682}.login-card label{display:block;margin-bottom:15px}.login-btn{width:100%;margin-top:4px}
@media(max-width:700px){.topbar{gap:14px}.user-menu{width:100%}}

.account-bar{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:10px 24px;background:#17212b;color:#fff;border-bottom:1px solid rgba(255,255,255,.08)}
.account-identity{display:flex;align-items:center;gap:10px}.account-identity span{font-size:12px;font-weight:700;padding:4px 8px;border-radius:999px;background:rgba(255,255,255,.13)}
.account-actions{display:flex;align-items:center;gap:8px}.account-actions a{text-decoration:none}
@media(max-width:600px){.account-bar{padding:10px 14px;align-items:flex-start}.account-identity{flex-direction:column;align-items:flex-start;gap:4px}}

.search-row .btn{white-space:nowrap;text-decoration:none;display:inline-flex;align-items:center;justify-content:center}

/* Stage 6: company branding/settings */
.brand-header{display:flex;align-items:center;gap:18px}
.header-logo{display:block;max-width:180px;max-height:78px;width:auto;height:auto;object-fit:contain;flex:0 0 auto}
.app-footer{text-align:center;padding:22px 16px 28px;color:#6b7280;font-size:13px}
.logo-settings-preview{display:flex;align-items:center;gap:18px;padding:16px;border:1px solid #e5e7eb;border-radius:12px;margin:14px 0 18px;background:#fff}
.logo-settings-preview img{max-width:260px;max-height:130px;object-fit:contain;cursor:pointer;border:1px solid #e5e7eb;border-radius:10px;padding:8px;background:#fff}
.settings-logo-form{margin-top:18px}
.settings-help{color:#64748b;margin-top:0}
.empty-logo{padding:18px;border:1px dashed #cbd5e1;border-radius:10px;color:#64748b;margin:14px 0}
.btn.danger{background:#b42318;color:#fff;border-color:#b42318}
@media(max-width:700px){
  .brand-header{align-items:flex-start;gap:12px}
  .header-logo{max-width:105px;max-height:58px}
  .logo-settings-preview{align-items:flex-start;flex-direction:column}
  .logo-settings-preview img{max-width:100%;max-height:150px}
}

/* Static login logo: assets/images/door-logo.png */
.login-static-logo{text-align:center;padding:34px 16px 0}
.login-static-logo img{display:inline-block;width:auto;height:auto;max-width:220px;max-height:120px;object-fit:contain}
@media(max-width:600px){.login-static-logo{padding-top:24px}.login-static-logo img{max-width:170px;max-height:95px}}

/* Compact static logo inside the login card */
.login-static-logo{
  text-align:center;
  margin:0 0 14px;
  padding:0;
}
.login-static-logo img{
  display:block;
  width:auto;
  height:auto;
  max-width:110px;
  max-height:64px;
  object-fit:contain;
  margin:0 auto;
}
@media(max-width:600px){
  .login-static-logo img{
    max-width:90px;
    max-height:54px;
  }
}

/* Server-side table pagination */
.pagination-bar{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;margin-top:16px}
.pagination-info{color:#64748b;font-size:13px}
.pagination-buttons{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.pagination-buttons .btn[disabled]{opacity:.45;cursor:not-allowed}
@media(max-width:700px){.pagination-bar{align-items:flex-start;flex-direction:column}.pagination-buttons{width:100%}}

.audit-toolbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:14px}.audit-toolbar input[type=search]{flex:1;min-width:240px;max-width:520px}.audit-toolbar select{width:auto;min-width:125px}.audit-bulkbar{display:flex;justify-content:space-between;align-items:center;gap:14px;flex-wrap:wrap;margin-bottom:14px;color:#64748b}.pagination{display:flex;align-items:center;justify-content:center;gap:6px;flex-wrap:wrap;margin-top:18px}.pagination a,.pagination span{min-width:34px;height:34px;padding:0 10px;display:inline-flex;align-items:center;justify-content:center;border:1px solid #d8dee8;border-radius:8px;text-decoration:none;color:inherit;background:#fff}.pagination .active{font-weight:700;border-color:#334155;background:#334155;color:#fff}

.history-title-actions,.row-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}

.select-col{width:42px;text-align:center}.select-col input,.product-row-check,.history-row-check,.audit-row-check{width:17px;height:17px;cursor:pointer}.selected-delete-bar{display:flex;justify-content:flex-end;margin:0 0 10px}.btn:disabled{opacity:.5;cursor:not-allowed}

/* Stage 10 checkbox row rendering fix */
td.select-col,th.select-col{width:42px;min-width:42px;max-width:42px;text-align:center;vertical-align:middle;padding-left:8px;padding-right:8px}
td.select-col input[type="checkbox"],th.select-col input[type="checkbox"],.audit-row-check{
  display:inline-block!important;width:17px!important;height:17px!important;min-width:17px!important;
  margin:0!important;padding:0!important;vertical-align:middle;cursor:pointer;
}
