:root {
    --bg: #f4f6f9;
    --surface: #ffffff;
    --border: #dfe3e8;
    --text: #1e293b;
    --text-muted: #64748b;
    --primary: #0067b8;
    --primary-hover: #005293;
    --primary-light: #e6f0fa;
    --success: #15803d;
    --success-bg: #dcfce7;
    --warning: #b45309;
    --warning-bg: #fef3c7;
    --danger: #b91c1c;
    --danger-bg: #fee2e2;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* Navbar */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    position: sticky;
    top: 0;
    z-index: 20;
}

.navbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    gap: 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text);
    text-decoration: none;
}

.brand-icon {
    color: var(--primary);
    font-size: 1.3rem;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.45rem 0.85rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.92rem;
    transition: all 0.15s ease;
}

.nav-links a:hover {
    color: var(--text);
    background: var(--bg);
}

.nav-links a.active {
    color: var(--primary);
    background: var(--primary-light);
    font-weight: 600;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-badge {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Main Content */
.main-content {
    flex: 1;
    padding-top: 1.75rem;
    padding-bottom: 2.5rem;
}

.footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 1rem 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
}

.card-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.card-subtitle {
    margin: 0.2rem 0 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Login Box */
.auth-wrapper {
    max-width: 420px;
    margin: 3.5rem auto;
}

.auth-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-header h1 {
    font-size: 1.45rem;
    margin: 0.5rem 0 0.25rem;
}

.auth-header p {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.92rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text);
}

.form-control,
select.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="search"] {
    width: 100%;
    padding: 0.55rem 0.75rem;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
select.form-control:focus,
input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 103, 184, 0.15);
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-row > .form-group {
    flex: 1;
    min-width: 220px;
    margin-bottom: 0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

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

.btn-outline:hover {
    background: var(--bg);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #991b1b;
}

.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.83rem;
}

.btn-block {
    width: 100%;
}

/* Alerts */
.alert {
    padding: 0.85rem 1rem;
    border-radius: 6px;
    margin-bottom: 1.25rem;
    font-size: 0.92rem;
    border: 1px solid transparent;
}

.alert-error {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: #fecaca;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success);
    border-color: #bbf7d0;
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: #fde68a;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow);
}

.stat-label {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 600;
}

.stat-value {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text);
    margin-top: 0.25rem;
}

/* Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

table.data-table th,
table.data-table td {
    padding: 0.75rem 0.9rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

table.data-table th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

table.data-table tbody tr:hover {
    background-color: #f8fafc;
}

table.data-table tfoot th,
table.data-table tfoot td {
    background: #f1f5f9;
    font-weight: 700;
    border-top: 2px solid var(--border);
}

.text-right {
    text-align: right !important;
}

.text-muted {
    color: var(--text-muted);
}

/* License Badges */
.license-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.license-badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary-hover);
    border: 1px solid #cce0f5;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-neutral {
    display: inline-block;
    background: #f1f5f9;
    color: var(--text-muted);
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
}

.badge-success {
    display: inline-block;
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid #bbf7d0;
    padding: 0.16rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-warning {
    display: inline-block;
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid #fde68a;
    padding: 0.16rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-danger {
    display: inline-block;
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid #fecaca;
    padding: 0.16rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.term-pill {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    font-size: 0.84rem;
}

.term-pill + .term-pill {
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px dashed var(--border);
}

/* Progress bar for license allocation */
.usage-bar-wrap {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.usage-bar {
    flex: 1;
    height: 8px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
    min-width: 70px;
}

.usage-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 999px;
}

.usage-bar-fill.over {
    background: var(--danger);
}

.usage-bar-fill.full {
    background: var(--warning);
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

@media print {
    body {
        background: #fff;
    }
    .no-print {
        display: none !important;
    }
    .card {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
    }
    .container {
        max-width: 100%;
        padding: 0;
    }
}

