:root{--bg:#f4f7fb;--card:#fff;--text:#111827;--muted:#6b7280;--primary:#4f46e5;--primary2:#06b6d4;--border:#e5e7eb;--danger:#ef4444;--ok:#10b981;--warn:#f59e0b}
*{box-sizing:border-box}body{margin:0;font-family:Inter,Segoe UI,Arial,sans-serif;background:var(--bg);color:var(--text)}
a{text-decoration:none;color:inherit}.sidebar{position:fixed;left:0;top:0;bottom:0;width:270px;background:#0f172a;color:#e5e7eb;padding:22px;z-index:5}
.brand{display:flex;gap:12px;align-items:center;margin-bottom:28px}.brand .logo{width:44px;height:44px;border-radius:14px;background:linear-gradient(135deg,var(--primary),var(--primary2));display:grid;place-items:center;font-weight:800;color:#fff}.brand span{display:block;font-size:12px;color:#94a3b8}
nav a{display:block;padding:12px 14px;border-radius:12px;color:#cbd5e1;margin-bottom:6px}nav a:hover{background:#1e293b;color:#fff}
.main{margin-left:270px}.topbar{height:86px;background:rgba(255,255,255,.88);backdrop-filter:blur(12px);border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;padding:0 28px;position:sticky;top:0;z-index:3}
.topbar h1{font-size:22px;margin:0}.topbar p{margin:4px 0 0;color:var(--muted);font-size:13px}.profile{display:flex;align-items:center;gap:16px}.profile a{background:#111827;color:#fff;padding:9px 14px;border-radius:11px}
.menu-btn{display:none;border:0;background:#111827;color:white;border-radius:10px;padding:9px 12px}.content{padding:28px}.grid{display:grid;grid-template-columns:repeat(4,1fr);gap:18px}.card{background:var(--card);border:1px solid var(--border);border-radius:20px;padding:22px;box-shadow:0 14px 35px rgba(15,23,42,.05)}
.stat b{font-size:32px}.stat span{display:block;color:var(--muted);font-size:14px;margin-top:5px}.toolbar{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-bottom:18px;flex-wrap:wrap}.btn{border:0;background:linear-gradient(135deg,var(--primary),var(--primary2));color:#fff;padding:11px 16px;border-radius:12px;font-weight:700;cursor:pointer;display:inline-block}.btn.secondary{background:#111827}.btn.light{background:#eef2ff;color:#3730a3}.btn.danger{background:var(--danger)}
.table-wrap{overflow:auto;background:#fff;border:1px solid var(--border);border-radius:18px}table{width:100%;border-collapse:collapse;min-width:900px}th,td{text-align:left;padding:14px 16px;border-bottom:1px solid var(--border);font-size:14px}th{background:#f8fafc;color:#475569;font-size:12px;text-transform:uppercase;letter-spacing:.04em}tr:hover td{background:#fbfdff}
.badge{display:inline-flex;padding:6px 10px;border-radius:99px;font-size:12px;font-weight:800}.badge.ok{background:#ecfdf5;color:#047857}.badge.info{background:#eff6ff;color:#1d4ed8}.badge.warn{background:#fffbeb;color:#b45309}.badge.danger{background:#fef2f2;color:#b91c1c}.badge.muted{background:#f3f4f6;color:#4b5563}
.form{display:grid;grid-template-columns:repeat(2,1fr);gap:16px}.field label{display:block;font-size:13px;color:#475569;font-weight:700;margin-bottom:7px}.field input,.field select,.field textarea{width:100%;border:1px solid var(--border);border-radius:12px;padding:12px;background:#fff;font-size:14px}.field.full{grid-column:1/-1}.actions{grid-column:1/-1;display:flex;gap:12px}.alert{padding:13px 16px;border-radius:14px;margin-bottom:18px}.alert.success{background:#ecfdf5;color:#047857}.alert.error{background:#fef2f2;color:#b91c1c}
.stat-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: 0.2s ease;
    cursor: pointer;
}

.stat-link:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.12);
}
.count-link {
    display: inline-flex;
    min-width: 48px;
    height: 34px;
    padding: 0 12px;
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    color: #0f172a;
    font-weight: 700;
    text-decoration: none;
    transition: 0.2s ease;
}
#inventoryAiWidget {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99999;
    font-family: Inter, Segoe UI, Arial, sans-serif;
}

#inventoryAiToggle {
    width: 64px;
    height: 64px;
    border: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    color: #ffffff;
    font-size: 26px;
    cursor: pointer;
    box-shadow: 0 18px 45px rgba(79, 70, 229, 0.38);
    transition: 0.2s ease;
}

#inventoryAiToggle:hover {
    transform: translateY(-3px) scale(1.03);
}

#inventoryAiPanel {
    display: none;
    position: absolute;
    right: 0;
    bottom: 82px;
    width: 410px;
    max-width: calc(100vw - 32px);
    height: 590px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    box-shadow: 0 30px 90px rgba(15, 23, 42, 0.28);
    overflow: hidden;
}

#inventoryAiWidget.open #inventoryAiPanel {
    display: flex;
    flex-direction: column;
}

.inventory-ai-header {
    padding: 16px;
    background: linear-gradient(135deg, #0f172a, #1e293b);
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.inventory-ai-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.inventory-ai-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    display: grid;
    place-items: center;
    font-size: 20px;
}

.inventory-ai-header strong {
    display: block;
    font-size: 15px;
}

.inventory-ai-header small {
    display: block;
    color: #cbd5e1;
    font-size: 12px;
    margin-top: 3px;
}

#inventoryAiClose {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 10px;
    background: rgba(255,255,255,0.12);
    color: #ffffff;
    cursor: pointer;
}

#inventoryAiMessages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.inventory-ai-message {
    display: flex;
    gap: 9px;
    max-width: 94%;
}

.inventory-ai-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.inventory-ai-message.bot {
    align-self: flex-start;
}

.msg-avatar {
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 13px;
}

.inventory-ai-message.bot .msg-avatar {
    background: #e0f2fe;
    color: #0369a1;
}

.inventory-ai-message.user .msg-avatar {
    background: #ede9fe;
    color: #5b21b6;
}

.msg-content {
    padding: 11px 13px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.45;
    overflow-x: auto;
}

.inventory-ai-message.bot .msg-content {
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #e5e7eb;
    border-top-left-radius: 4px;
}

.inventory-ai-message.user .msg-content {
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    color: #ffffff;
    border-top-right-radius: 4px;
}

.inventory-ai-quick {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    padding: 10px 12px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
}

.inventory-ai-quick button {
    border: 0;
    background: #eef2ff;
    color: #3730a3;
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}

.inventory-ai-quick button:hover {
    background: #ddd6fe;
}

#inventoryAiForm {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
}

#inventoryAiInput {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 12px 13px;
    font-size: 13px;
    outline: none;
}

#inventoryAiInput:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

#inventoryAiForm button {
    width: 46px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    color: #ffffff;
    cursor: pointer;
}

.typing-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #64748b;
    border-radius: 50%;
    animation: typingBounce 1s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.7);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.msg-content table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    background: #ffffff;
    font-size: 11px;
    min-width: 520px;
}

.msg-content th,
.msg-content td {
    padding: 7px 8px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    font-size: 11px;
}

.msg-content th {
    background: #f1f5f9;
    color: #475569;
}

.msg-content p {
    margin: 0 0 8px;
}

.msg-content ul,
.msg-content ol {
    margin: 8px 0;
    padding-left: 18px;
}

.msg-content code {
    background: #f1f5f9;
    padding: 2px 4px;
    border-radius: 5px;
    font-size: 12px;
}

@media (max-width: 560px) {
    #inventoryAiWidget {
        right: 16px;
        bottom: 16px;
    }

    #inventoryAiToggle {
        width: 58px;
        height: 58px;
        font-size: 23px;
    }

    #inventoryAiPanel {
        width: calc(100vw - 32px);
        height: 540px;
        bottom: 74px;
    }
}
.count-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.count-link.success {
    background: #dcfce7;
    color: #166534;
}

.count-link.primary {
    background: #dbeafe;
    color: #1d4ed8;
}

.count-link.danger {
    background: #fee2e2;
    color: #b91c1c;
}

.count-link.muted {
    background: #e5e7eb;
    color: #374151;
}
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-box {
    width: 100%;
    max-width: 560px;
    background: #ffffff;
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.25);
}

.modal-box h3 {
    margin-top: 0;
    margin-bottom: 18px;
    color: #0f172a;
}

.modal-box textarea {
    min-height: 130px;
    resize: vertical;
}

.asset-summary {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
}

.asset-summary div {
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 14px;
}

.asset-summary small {
    display: block;
    color: #64748b;
    font-size: 12px;
    margin-bottom: 6px;
}

.asset-summary strong {
    display: block;
    color: #0f172a;
    font-size: 14px;
}

.btn.small {
    padding: 7px 10px;
    font-size: 12px;
    border-radius: 9px;
}
.sidebar nav a {
    position: relative;
    display: block;
    padding: 12px 16px;
    margin: 4px 10px;
    border-radius: 12px;
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 500;
    transition: 0.2s ease;
}
.alert.warning {
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
}
.sidebar nav a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sidebar nav a.active {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: #ffffff;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.35);
}

.sidebar nav a.active::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 10px;
    bottom: 10px;
    width: 4px;
    border-radius: 20px;
    background: #ffffff;
}
.btn.danger {
    background: #dc2626;
    color: #ffffff;
}

.btn.danger:hover {
    background: #b91c1c;
}

@media (max-width: 900px) {
    .asset-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 520px) {
    .asset-summary {
        grid-template-columns: 1fr;
    }
}
.action-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(74px, 1fr));
    gap: 8px;
    min-width: 170px;
    max-width: 220px;
}

.action-btn {
    border: 0;
    outline: none;
    min-height: 34px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    text-align: center;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: 0.18s ease;
    white-space: nowrap;
}

.action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
}

.action-return {
    background: linear-gradient(135deg, var(--primary), var(--primary2));
    color: #ffffff;
}

.action-history {
    background: #eef2ff;
    color: #3730a3;
}

.action-repair {
    background: #111827;
    color: #ffffff;
}

.action-faulty {
    background: #fee2e2;
    color: #b91c1c;
}
.sort-link {
    color: #475569;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}

.sort-link:hover {
    color: var(--primary);
}
.action-faulty:hover {
    background: #fecaca;
}
.action-view {
    background: #eef2ff;
    color: #3730a3;
}

.action-edit {
    background: #111827;
    color: #ffffff;
}
.action-available {
    background: #dcfce7;
    color: #166534;
}
@media (max-width: 700px) {
    .action-group {
        grid-template-columns: 1fr;
        min-width: 120px;
    }
}
.auth-page{min-height:100vh;display:grid;place-items:center;background:radial-gradient(circle at top left,#dbeafe,#f8fafc 45%,#eef2ff)}.login-card{width:min(440px,92vw);background:#fff;border-radius:26px;padding:34px;box-shadow:0 30px 80px rgba(15,23,42,.14);border:1px solid #e8edf5}.login-card h1{margin:0 0 8px}.login-card p{color:var(--muted);margin-bottom:24px}
.kv{display:grid;grid-template-columns:200px 1fr;gap:8px;padding:9px 0;border-bottom:1px dashed #e5e7eb}.timeline{border-left:3px solid #e5e7eb;padding-left:18px}.timeline .item{position:relative;margin-bottom:18px}.timeline .item:before{content:"";position:absolute;left:-27px;top:4px;width:13px;height:13px;background:var(--primary);border-radius:50%}
@media(max-width:900px){.sidebar{transform:translateX(-100%);transition:.25s}.open .sidebar{transform:none}.main{margin-left:0}.menu-btn{display:block}.grid{grid-template-columns:repeat(2,1fr)}.form{grid-template-columns:1fr}.topbar{padding:0 16px}.profile span{display:none}}
@media(max-width:560px){.grid{grid-template-columns:1fr}.content{padding:16px}.topbar h1{font-size:18px}}
