:root {
    --green: #07865f;
    --green-dark: #056c4d;
    --green-soft: #e8f7f1;
    --navy: #182433;
    --navy-2: #223143;
    --text: #1e2937;
    --muted: #6b7785;
    --border: #e1e7ec;
    --bg: #f5f7f9;
    --white: #ffffff;
    --danger: #b23a3a;
    --danger-soft: #fff0f0;
    --shadow: 0 8px 28px rgba(24, 36, 51, .07);
    --radius: 16px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.45;
}
button, input, select { font: inherit; }
a { color: inherit; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 250px;
    display: flex;
    flex-direction: column;
    padding: 22px 14px 82px;
    color: #dce5ec;
    background: linear-gradient(180deg, var(--navy), #14202e);
    z-index: 30;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 10px 22px;
    color: white;
    text-decoration: none;
}
.brand-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--green);
    font-size: 20px;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; }
.brand small { margin-top: 1px; color: #91a1ae; }
.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 4px 22px;
    padding: 12px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 12px;
    background: rgba(255,255,255,.04);
}
.avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 50%;
    background: var(--green);
    color: white;
    font-weight: 800;
}
.user-card strong, .user-card small { display: block; }
.user-card strong { color: white; font-size: 14px; }
.user-card small { color: #91a1ae; font-size: 12px; margin-top: 2px; }
.nav-label {
    margin: 7px 12px 8px;
    color: #758696;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
}
.sidebar-nav {
    display: grid;
    gap: 4px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 3px;
    padding-bottom: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.16) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.16);
    border-radius: 999px;
}
.sidebar-nav a, .logout {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 13px;
    border-radius: 10px;
    color: #cbd6df;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}
.sidebar-nav a:hover, .sidebar-nav a.active { color: white; background: rgba(7, 134, 95, .28); }
.sidebar-nav a.active { box-shadow: inset 3px 0 var(--green); }
.logout {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 14px;
    min-height: 52px;
    margin: 0;
    border-top: 1px solid rgba(255,255,255,.10);
    border-radius: 0;
    padding: 15px 13px 10px;
    color: #dce5ec;
    font-weight: 700;
    background: #14202e;
    z-index: 3;
}
.logout:hover { color: white; }

.main-content { min-height: 100vh; margin-left: 250px; }
.page-shell { max-width: 1400px; margin: 0 auto; padding: 34px 34px 60px; }
.mobile-header { display: none; }

.page-heading { margin-bottom: 24px; }
.page-heading h1 { margin: 3px 0 5px; font-size: 30px; line-height: 1.2; letter-spacing: -.03em; }
.page-heading p { margin: 0; color: var(--muted); }
.split-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.eyebrow { color: var(--green); font-size: 11px; font-weight: 850; letter-spacing: .12em; }
.muted { color: var(--muted); }

.card {
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--white);
    box-shadow: var(--shadow);
}
.card h2 { margin: 0; font-size: 18px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat-card {
    display: flex;
    align-items: center;
    gap: 15px;
    min-height: 125px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: white;
    box-shadow: var(--shadow);
}
.stat-icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 14px; font-size: 22px; }
.stat-icon.green { background: var(--green-soft); }
.stat-icon.blue { background: #edf0ff; }
.stat-icon.orange { background: #fff3df; }
.stat-card span, .stat-card small { display: block; color: var(--muted); }
.stat-card strong { display: block; margin: 2px 0; font-size: 31px; line-height: 1.1; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, .8fr); gap: 18px; margin-bottom: 18px; }
.table-card { padding: 0; overflow: hidden; }
.table-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.text-link { color: var(--green); text-decoration: none; font-size: 13px; font-weight: 750; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 18px; border-bottom: 1px solid #edf1f4; text-align: left; white-space: nowrap; }
th { background: #fbfcfd; color: #7b8793; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdfc; }
.empty-cell { padding: 30px; color: var(--muted); text-align: center; }
.table-action { text-align: right; }

.quick-card { display: grid; align-content: start; gap: 12px; }
.quick-card h2 { margin-bottom: 3px; }
.quick-link { display: flex; align-items: center; gap: 14px; padding: 15px; border: 1px solid var(--border); border-radius: 12px; text-decoration: none; }
.quick-link:hover { border-color: #b8c8c1; transform: translateY(-1px); }
.quick-link b { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: #f0f3f5; }
.quick-link strong, .quick-link small { display: block; }
.quick-link small { margin-top: 2px; color: var(--muted); }
.primary-quick { border-color: var(--green); background: var(--green); color: white; }
.primary-quick b { background: rgba(255,255,255,.16); }
.primary-quick small { color: #d9f3e9; }

.popular-card { margin-bottom: 18px; }
.popular-card .table-header { margin: -22px -22px 18px; }
.ranking-row { display: grid; grid-template-columns: 24px 75px 1fr 30px; align-items: center; gap: 12px; padding: 9px 0; }
.bar-track { height: 7px; overflow: hidden; border-radius: 999px; background: #edf1f3; }
.bar-fill { height: 100%; border-radius: inherit; background: var(--green); }
.empty-state { padding: 25px 0; color: var(--muted); text-align: center; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    font-weight: 750;
    transition: .15s ease;
}
.button:hover { transform: translateY(-1px); }
.button.primary { background: var(--green); color: white; }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { border-color: #cad4da; background: #f5f7f8; color: var(--text); }
.button.ghost { background: transparent; color: var(--muted); }
.button.large { min-height: 52px; font-size: 16px; }
.button.full { width: 100%; }

.repair-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; max-width: 1050px; }
.input-card { padding: 28px; }
.card-title-row { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.card-title-row p { margin: 4px 0 0; color: var(--muted); }
.feature-icon { display: grid; place-items: center; width: 52px; height: 52px; flex: 0 0 52px; border-radius: 14px; background: var(--green-soft); color: var(--green); font-size: 23px; font-weight: 900; }
.feature-icon.neutral { background: #f0f2f5; color: #455363; font-size: 15px; }
.input-label, .field label { display: block; margin-bottom: 7px; font-size: 13px; font-weight: 800; }
.scan-input, .text-input {
    width: 100%;
    border: 1px solid #cbd5db;
    border-radius: 10px;
    background: white;
    color: var(--text);
    outline: none;
}
.scan-input { padding: 15px 16px; font-size: 24px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.manual-input { text-transform: none; }
.text-input { padding: 11px 13px; font-size: 15px; }
.scan-input:focus, .text-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(7, 134, 95, .10); }
.input-help { min-height: 38px; padding: 8px 0 13px; color: var(--muted); font-size: 12px; }

.alert { display: flex; align-items: flex-start; gap: 12px; max-width: 1050px; margin: 0 0 18px; padding: 14px 16px; border-radius: 12px; }
.alert-icon { display: grid; place-items: center; width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%; font-weight: 900; }
.success-alert { border: 1px solid #bde3d4; background: #edf9f4; color: #126446; }
.success-alert .alert-icon { background: var(--green); color: white; }
.error-alert { border: 1px solid #edc4c4; background: var(--danger-soft); color: #8d2c2c; }
.error-alert .alert-icon { background: var(--danger); color: white; }

.confirmation-card { max-width: 700px; padding: 34px; text-align: center; }
.confirmation-check { display: grid; place-items: center; width: 62px; height: 62px; margin: 0 auto 16px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 28px; font-weight: 900; }
.confirmation-card h2 { margin: 5px 0 22px; font-size: 42px; }
.confirmation-details { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 22px; }
.confirmation-details div { padding: 14px; border-radius: 11px; background: #f7f9fa; text-align: left; }
.confirmation-details span, .confirmation-details strong { display: block; }
.confirmation-details span { margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.confirm-button { width: 100%; min-height: 58px; font-size: 17px; }
.cancel-link { display: inline-block; margin-top: 16px; color: var(--muted); font-size: 13px; }

.search-row { display: flex; gap: 10px; }
.search-row .text-input { max-width: 520px; }
.count-pill, .code-pill, .method-pill, .status-pill { display: inline-block; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 750; }
.count-pill, .method-pill { background: #eef2f4; color: #52606d; }
.code-pill { background: var(--green-soft); color: var(--green-dark); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.status-pill.on { background: var(--green-soft); color: var(--green-dark); }
.status-pill.off { background: #f0f1f2; color: #7b838b; }
.danger-link { border: 0; background: transparent; color: var(--danger); cursor: pointer; font-size: 13px; font-weight: 700; }
.small-button { padding: 7px 10px; border: 1px solid #ccd5db; border-radius: 8px; background: white; cursor: pointer; }
.users-grid { display: grid; grid-template-columns: 340px 1fr; gap: 18px; }
.field { margin-bottom: 15px; }

.auth-body { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: radial-gradient(circle at top, #e8f7f1, var(--bg) 42%); }
.auth-shell { width: 100%; max-width: 450px; }
.setup-shell { max-width: 580px; }
.auth-card { padding: 34px; border: 1px solid var(--border); border-radius: 20px; background: white; box-shadow: 0 20px 60px rgba(24,36,51,.12); }
.auth-logo { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 18px; border-radius: 16px; background: var(--green); color: white; font-size: 26px; }
.auth-card h1 { margin: 0 0 6px; font-size: 28px; }
.auth-card > p { margin: 0 0 24px; color: var(--muted); }
.setup-steps { display: grid; gap: 10px; margin: 22px 0; }
.setup-steps div { display: flex; align-items: center; gap: 11px; padding: 11px; border-radius: 10px; background: #f7f9fa; }
.setup-steps b { display: grid; place-items: center; width: 27px; height: 27px; flex: 0 0 27px; border-radius: 50%; background: var(--green); color: white; }
code { padding: 2px 5px; border-radius: 5px; background: #edf1f3; }

@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .users-grid { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
    .mobile-header { position: sticky; top: 0; z-index: 25; display: flex; align-items: center; justify-content: space-between; height: 58px; padding: 0 15px; background: var(--green); color: white; }
    .mobile-brand { color: white; text-decoration: none; font-weight: 800; }
    .menu-button { border: 0; background: transparent; color: white; font-size: 25px; cursor: pointer; }
    .sidebar { transform: translateX(-102%); transition: transform .2s ease; box-shadow: 15px 0 35px rgba(0,0,0,.2); }
    .menu-open .sidebar { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .page-shell { padding: 22px 14px 45px; }
    .split-heading { align-items: flex-start; flex-direction: column; }
    .stats-grid, .repair-grid { grid-template-columns: 1fr; }
    .confirmation-details { grid-template-columns: 1fr; }
    .search-row { flex-wrap: wrap; }
    .search-row .text-input { max-width: none; flex: 1 1 100%; }
    .page-heading h1 { font-size: 26px; }
    .confirmation-card h2 { font-size: 34px; }
}

/* v3 — profilaktiskie remonti, ratu vēsture un telefona QR kamera */
.cart-link{font-weight:800;color:#087d5d;text-decoration:none}.cart-link:hover{text-decoration:underline}
.status-pill{display:inline-flex;padding:6px 10px;border-radius:999px;font-size:12px;font-weight:800}.status-pill.overdue{background:#fff1e8;color:#b84b16}
.compact-stats{grid-template-columns:repeat(3,minmax(0,1fr));margin-bottom:20px}.date-stat{font-size:21px!important}
.settings-card{max-width:760px}.settings-form{display:flex;align-items:end;gap:14px;margin-top:24px}.month-input{max-width:180px}
.timeline-card{max-width:900px}.timeline-item{position:relative;display:flex;gap:16px;padding:16px 4px 16px 28px;border-bottom:1px solid #edf1f4}.timeline-item:last-child{border-bottom:0}.timeline-item:before{content:"";position:absolute;left:9px;top:0;bottom:0;width:2px;background:#dce8e3}.timeline-dot{position:absolute;left:3px;top:22px;width:14px;height:14px;border-radius:50%;background:#07946b;border:3px solid #dff5ed}.timeline-item strong{display:block;font-size:16px}.timeline-item span{display:block;color:#667085;margin-top:4px;font-size:13px}
.warning-quick b{background:#fff1e8!important;color:#b84b16!important}
.camera-button{width:100%;margin-bottom:4px}.or-divider{display:flex;align-items:center;gap:12px;color:#98a2b3;margin:16px 0}.or-divider:before,.or-divider:after{content:"";height:1px;background:#e4e7ec;flex:1}.camera-box{position:relative;background:#0d1117;border-radius:18px;overflow:hidden;margin-bottom:14px;min-height:280px}.camera-box[hidden]{display:none}.camera-box video{width:100%;height:340px;object-fit:cover;display:block}.camera-guide{position:absolute;width:210px;height:210px;left:50%;top:50%;transform:translate(-50%,-50%);border:3px solid #fff;border-radius:20px;box-shadow:0 0 0 999px rgba(0,0,0,.28)}.camera-close{position:absolute;right:12px;bottom:12px;background:#fff!important}
@media(max-width:700px){.repair-grid{grid-template-columns:1fr!important}.camera-button{min-height:58px;font-size:17px}.camera-box video{height:300px}.compact-stats{grid-template-columns:1fr}.settings-form{display:block}.settings-form .button{margin-top:14px;width:100%}.page-heading.split-heading{gap:12px}.page-heading.split-heading>.button{width:100%}}
