:root {
    --primary: #1565C0;
    --on-primary: #FFFFFF;
    --primary-container: #BBDEFB;
    --on-primary-container: #0D2B6B;
    --secondary: #605D62;
    --error: #BA1A1A;
    --background: #F8F9FB;
    --surface: #FFFFFF;
    --surface-container-low: #F2F4F8;
    --outline: #D0D8E4;
    --text: #1B1B1F;
    --text-muted: #605D62;
    --radius-md: 12px;
    --radius-lg: 16px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font-family: "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Top bar ─────────────────────────────────────────────────────────── */

.topbar {
    background: var(--primary-container);
    border-bottom: 1px solid var(--outline);
}

.topbar-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--on-primary-container);
}
.brand:hover { text-decoration: none; }

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary);
    color: var(--on-primary);
    font-weight: 700;
    font-size: 14px;
}

.brand-name {
    font-weight: 600;
    font-size: 17px;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar-user {
    font-size: 14px;
    color: var(--on-primary-container);
}

/* ── Layout ──────────────────────────────────────────────────────────── */

.page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 4px;
}

/* ── Cards / list ────────────────────────────────────────────────────── */

.card-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card {
    background: var(--surface-container-low);
    border-radius: var(--radius-lg);
    border: 1px solid var(--outline);
    padding: 16px 18px;
}

.inventory-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.inventory-card:hover {
    background: var(--surface);
    text-decoration: none;
}

.inventory-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--text);
}

.inventory-meta {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 2px;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--primary-container);
    color: var(--on-primary-container);
    font-size: 13px;
    font-weight: 600;
}

/* ── Device table ────────────────────────────────────────────────────── */

.table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--outline);
}

table.devices {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

table.devices th {
    text-align: left;
    background: var(--primary);
    color: var(--on-primary);
    padding: 10px 12px;
    white-space: nowrap;
    position: sticky;
    top: 0;
}

table.devices td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--outline);
    vertical-align: top;
}

table.devices tr:nth-child(even) td {
    background: var(--surface-container-low);
}

table.devices tr:last-child td { border-bottom: none; }

/* ── Buttons ─────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    background: var(--primary);
    color: var(--on-primary);
}
.btn:hover { text-decoration: none; opacity: 0.92; }

.btn-outline {
    background: transparent;
    border-color: var(--primary);
    color: var(--primary);
}

.btn-ghost {
    background: transparent;
    border-color: var(--outline);
    color: var(--text-muted);
}

.btn-ghost-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid var(--outline);
    color: var(--on-primary-container);
    font-size: 14px;
    font-weight: 600;
}
.btn-ghost-link:hover {
    text-decoration: none;
    background: rgba(255, 255, 255, 0.4);
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-form {
    display: flex;
    align-items: center;
    gap: 6px;
}

.inline-input {
    width: 150px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--outline);
    font-size: 13px;
}

.account-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.account-row-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ── Login page ──────────────────────────────────────────────────────── */

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 360px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--outline);
    padding: 32px 28px;
    text-align: center;
}

.login-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--primary);
    color: var(--on-primary);
    font-weight: 700;
    font-size: 20px;
    margin-bottom: 14px;
}

.login-title {
    font-size: 19px;
    font-weight: 600;
    margin: 0 0 4px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0 0 22px;
}

.field {
    text-align: left;
    margin-bottom: 14px;
}

.field label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--outline);
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
}

.field textarea {
    resize: vertical;
    min-height: 80px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.field-error {
    color: var(--error);
    font-size: 12.5px;
    margin-top: 4px;
}

.form-section-title {
    margin: 0 0 14px;
    font-weight: 600;
    font-size: 14px;
    color: var(--primary);
}

.error-message {
    background: #FCE8E6;
    color: var(--error);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13.5px;
    margin-bottom: 14px;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 20px;
}

.back-link {
    display: inline-block;
    margin-bottom: 14px;
    font-size: 14px;
    color: var(--text-muted);
}
