:root {
  --blue:#2563eb; --blue-soft:#dbeafe; --green:#15803d; --green-soft:#dcfce7;
  --red:#dc2626; --red-soft:#fee2e2; --amber:#b45309; --amber-soft:#fef3c7;
  --navy:#0b1739; --bg:#f4f7fb; --card:#fff; --border:#e2e8f0;
  --text:#0f172a; --muted:#64748b; --shadow:0 8px 28px rgba(15,23,42,.08);
}
* { box-sizing:border-box; }
body { margin:0; font-family:system-ui,-apple-system,"Segoe UI",sans-serif; background:var(--bg); color:var(--text); }
button,input,select,textarea { font:inherit; }
button { cursor:pointer; }
[hidden] { display:none !important; }
.login-view { min-height:100vh; display:grid; place-items:center; padding:24px; }
.login-card { width:min(420px,100%); padding:28px; border:1px solid var(--border); border-radius:18px; background:#fff; box-shadow:var(--shadow); }
.login-card h1 { margin:0 0 8px; font-size:24px; }
.login-card p { margin:0 0 20px; color:var(--muted); font-size:13px; line-height:1.5; }
.field { min-width:0; }
.field label { display:block; margin-bottom:5px; color:#475569; font-size:12px; font-weight:650; }
.field input,.field select,.field textarea { width:100%; min-height:40px; padding:8px 10px; border:1px solid #cbd5e1; border-radius:9px; background:#fff; color:var(--text); }
.field textarea { resize:vertical; }
.login-card .field { margin-top:13px; }
.btn { min-height:38px; border:0; border-radius:9px; padding:8px 14px; font-weight:700; }
.btn-primary { background:var(--blue); color:#fff; }
.btn-secondary { background:#e8eef7; color:#334155; }
.btn-danger { background:var(--red); color:#fff; }
.btn-small { min-height:32px; padding:5px 10px; font-size:12px; }
.login-card .btn { width:100%; margin-top:18px; }
.error { min-height:20px; margin-top:10px; color:var(--red); font-size:13px; }
.app-shell { min-height:100vh; display:grid; grid-template-columns:230px minmax(0,1fr); }
.sidebar { position:sticky; top:0; height:100vh; padding:22px 14px; background:var(--navy); color:#cbd5e1; }
.brand { margin:0 10px 24px; color:#fff; font-size:17px; font-weight:850; }
.sidebar a { display:block; margin:4px 0; padding:10px 12px; border-radius:9px; color:#b8c4dc; text-decoration:none; font-size:13px; font-weight:650; }
.sidebar a:hover,.sidebar a.active { background:rgba(59,130,246,.18); color:#fff; }
.main-col { min-width:0; }
.topbar { min-height:64px; display:flex; align-items:center; justify-content:space-between; gap:16px; padding:10px 24px; border-bottom:1px solid var(--border); background:#fff; }
.product-name { font-weight:800; }
.topbar-right { display:flex; align-items:center; gap:10px; }
.avatar { width:34px; height:34px; display:grid; place-items:center; border-radius:50%; background:var(--blue-soft); color:#1d4ed8; font-weight:850; }
.content { max-width:1500px; margin:0 auto; padding:24px; }
.page-head { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:18px; }
.page-head h1 { margin:0 0 5px; font-size:25px; }
.page-head p { margin:0; color:var(--muted); font-size:13px; }
.filters { display:grid; grid-template-columns:minmax(180px,1.4fr) repeat(3,minmax(130px,1fr)) minmax(190px,1.3fr) auto; gap:12px; align-items:end; margin-bottom:16px; padding:15px; border:1px solid var(--border); border-radius:14px; background:#fff; box-shadow:0 4px 16px rgba(15,23,42,.04); }
.summary-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-bottom:16px; }
.summary-card { padding:15px; border:1px solid var(--border); border-radius:13px; background:#fff; }
.summary-card span { color:var(--muted); font-size:12px; }
.summary-card strong { display:block; margin-top:6px; font-size:25px; }
.table-card { overflow:hidden; border:1px solid var(--border); border-radius:14px; background:#fff; box-shadow:var(--shadow); }
.table-tools { display:flex; justify-content:space-between; gap:12px; align-items:center; padding:13px 15px; border-bottom:1px solid var(--border); }
.status { color:var(--muted); font-size:13px; }
.search { width:min(320px,100%); min-height:38px; padding:8px 10px; border:1px solid #cbd5e1; border-radius:9px; }
.table-scroll { overflow:auto; }
table { width:100%; border-collapse:collapse; min-width:1050px; }
th,td { padding:11px 12px; border-bottom:1px solid #edf2f7; text-align:left; vertical-align:top; font-size:12px; }
th { position:sticky; top:0; background:#f8fafc; color:#475569; font-size:11px; text-transform:uppercase; letter-spacing:.03em; }
tbody tr:hover { background:#f8fbff; }
.device-name { font-weight:750; }
.muted { color:var(--muted); }
.badge { display:inline-flex; align-items:center; border-radius:99px; padding:4px 8px; font-size:11px; font-weight:750; white-space:nowrap; }
.badge-pending { background:var(--amber-soft); color:var(--amber); }
.badge-approved { background:var(--green-soft); color:var(--green); }
.badge-error { background:var(--red-soft); color:var(--red); }
.badge-ok { background:var(--blue-soft); color:#1d4ed8; }
.row-actions { display:flex; gap:6px; flex-wrap:wrap; }
.empty { padding:42px 20px; color:var(--muted); text-align:center; }
.drawer-backdrop { position:fixed; inset:0; z-index:30; background:rgba(15,23,42,.38); }
.drawer { position:fixed; z-index:31; top:0; right:0; width:min(680px,100%); height:100vh; display:flex; flex-direction:column; background:#f8fafc; box-shadow:-14px 0 40px rgba(15,23,42,.2); }
.drawer-head { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; padding:18px 20px; border-bottom:1px solid var(--border); background:#fff; }
.drawer-head h2 { margin:0 0 5px; font-size:19px; }
.drawer-head p { margin:0; color:var(--muted); font-size:12px; }
.drawer-body { overflow:auto; padding:16px 20px 30px; }
.entry-card { margin-bottom:11px; padding:14px; border:1px solid var(--border); border-radius:12px; background:#fff; }
.entry-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.entry-title { font-weight:750; }
.entry-meta { display:grid; gap:5px; margin-top:9px; color:#475569; font-size:12px; line-height:1.45; }
.photos { display:flex; gap:9px; overflow:auto; margin-top:11px; padding-bottom:4px; }
.photo { width:112px; height:92px; flex:none; object-fit:cover; border:1px solid var(--border); border-radius:9px; background:#e2e8f0; }
.drawer-actions { display:flex; gap:8px; padding:13px 20px; border-top:1px solid var(--border); background:#fff; }
.tabs { display:flex; gap:7px; margin-bottom:14px; border-bottom:1px solid var(--border); }
.tab-button { border:0; border-bottom:3px solid transparent; padding:10px 14px; background:transparent; color:var(--muted); font-weight:750; }
.tab-button.active { border-bottom-color:var(--blue); color:var(--blue); }
.tab-panel[hidden] { display:none; }
.plan-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:13px; }
.plan-card { padding:16px; border:1px solid var(--border); border-radius:14px; background:#fff; box-shadow:0 5px 18px rgba(15,23,42,.05); }
.plan-card-head { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; }
.plan-card h3 { margin:0 0 5px; font-size:15px; }
.plan-card p { min-height:36px; margin:8px 0; color:var(--muted); font-size:12px; line-height:1.5; }
.plan-meta { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; margin:12px 0; }
.plan-metric { padding:9px; border-radius:9px; background:#f8fafc; }
.plan-metric span { display:block; color:var(--muted); font-size:10px; }
.plan-metric strong { display:block; margin-top:3px; font-size:16px; }
.progress { height:8px; overflow:hidden; border-radius:99px; background:#e2e8f0; }
.progress span { display:block; height:100%; background:var(--green); }
.plan-footer { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:12px; }
.modal-backdrop { position:fixed; inset:0; z-index:40; display:grid; place-items:center; padding:20px; background:rgba(15,23,42,.45); }
.modal { width:min(520px,100%); max-height:90vh; overflow:auto; padding:20px; border-radius:15px; background:#fff; box-shadow:0 20px 60px rgba(15,23,42,.3); }
.modal h2 { margin:0 0 6px; font-size:20px; }
.modal p { margin:0 0 16px; color:var(--muted); font-size:12px; }
.modal-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:18px; }
.plan-editor { width:min(1080px,100%); }
.editor-head { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.editor-head h2 { margin:0 0 4px; }
.icon-button { width:34px; height:34px; border:0; border-radius:50%; background:#eef2f7; color:#475569; font-size:23px; line-height:1; }
.editor-grid { display:grid; grid-template-columns:2fr repeat(3,1fr); gap:12px; margin-top:17px; }
.editor-description { grid-column:1/-2; }
.check-field { display:flex; align-items:center; gap:8px; align-self:end; min-height:40px; color:#334155; font-size:12px; font-weight:700; }
.check-field input { width:17px; height:17px; }
.template-section-head { display:flex; align-items:flex-end; justify-content:space-between; gap:12px; margin:22px 0 9px; }
.template-section-head h3 { margin:0 0 3px; font-size:15px; }
.template-section-head p { margin:0; }
.template-table-wrap { overflow:auto; border:1px solid var(--border); border-radius:10px; }
.template-table { min-width:930px; }
.template-table td { padding:8px; vertical-align:middle; }
.template-table input,.template-table select { width:100%; min-height:36px; padding:6px 7px; border:1px solid #cbd5e1; border-radius:7px; background:#fff; }
.template-order { display:flex; align-items:center; gap:4px; }
.template-order button { width:25px; height:25px; padding:0; border:0; border-radius:6px; background:#eef2f7; color:#475569; }
.template-actions { white-space:nowrap; }
.template-actions button { border:0; background:transparent; color:var(--red); font-weight:750; }
.detail-meta-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:9px; margin-bottom:14px; }
.detail-meta-item { padding:10px; border:1px solid var(--border); border-radius:9px; background:#fff; }
.detail-meta-item span { display:block; color:var(--muted); font-size:10px; }
.detail-meta-item strong { display:block; margin-top:3px; font-size:12px; }
.detail-fields { grid-template-columns:1fr; margin-top:0; }
.detail-fields .editor-description { grid-column:1; }
.warning-box { margin-bottom:12px; padding:11px; border:1px solid #fecaca; border-radius:9px; background:var(--red-soft); color:#b91c1c; font-size:12px; font-weight:650; }
.evidence-section,.history-section { margin-top:20px; }
.evidence-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(130px,1fr)); gap:10px; }
.evidence-card { position:relative; overflow:hidden; border:1px solid var(--border); border-radius:10px; background:#fff; }
.evidence-card img { width:100%; height:110px; display:block; object-fit:cover; background:#e2e8f0; }
.evidence-card button { position:absolute; top:5px; right:5px; width:25px; height:25px; border:0; border-radius:50%; background:rgba(15,23,42,.78); color:#fff; }
.file-button { position:relative; overflow:hidden; display:inline-flex; align-items:center; }
.file-button input { position:absolute; inset:0; opacity:0; cursor:pointer; }
.history-section h3 { margin:0 0 9px; font-size:15px; }
.history-list { display:grid; gap:8px; }
.history-item { padding:10px 12px; border-left:3px solid #cbd5e1; border-radius:0 8px 8px 0; background:#fff; font-size:12px; }
.history-item strong { display:block; margin-bottom:3px; }
.history-item span { color:var(--muted); }
.assets-filters { grid-template-columns:minmax(190px,1.3fr) minmax(180px,1.2fr) minmax(150px,.8fr) minmax(190px,1fr) auto; }
.energy-filters { grid-template-columns:minmax(200px,1.4fr) repeat(3,minmax(145px,1fr)) auto; }
.materials-filters { grid-template-columns:minmax(190px,1.3fr) repeat(3,minmax(135px,.8fr)) minmax(170px,1fr) auto; }
.adhoc-filters { grid-template-columns:minmax(190px,1.3fr) repeat(3,minmax(135px,.8fr)) minmax(180px,1fr) auto; }
.incident-filters { grid-template-columns:minmax(190px,1.3fr) repeat(3,minmax(135px,.8fr)) minmax(180px,1fr) auto; }
.docs-filters { grid-template-columns:minmax(220px,1.4fr) minmax(180px,.8fr) minmax(240px,1.2fr) auto; }
.asset-status { margin:0 0 10px; }
.asset-editor-grid { grid-template-columns:1fr 2fr; }
.asset-editor-grid .check-field { grid-column:2; }
.device-editor-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.status-overdue { color:var(--red); font-weight:750; }
.status-done { color:var(--green); font-weight:750; }
@media (max-width:1100px) {
  .filters { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .summary-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:760px) {
  .app-shell { display:block; }
  .sidebar { position:static; width:auto; height:auto; padding:12px; }
  .brand { margin:2px 8px 10px; }
  .sidebar a { display:inline-block; }
  .topbar,.content { padding:14px; }
  .filters { grid-template-columns:1fr 1fr; }
  .filters .field:first-child,.filters .field:last-child { grid-column:1/-1; }
  .summary-grid { grid-template-columns:1fr 1fr; }
  .table-tools,.page-head { align-items:stretch; flex-direction:column; }
  .search { width:100%; }
  .editor-grid { grid-template-columns:1fr 1fr; }
  .editor-name,.editor-description { grid-column:1/-1; }
  .check-field { grid-column:1/-1; }
  .assets-filters { grid-template-columns:1fr 1fr; }
}
