@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800&display=swap');

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --teal: #4ecdc4;
    --lime: #c7f464;
    --ink: #0d1520;
    --panel: #131d2b;
    --panel-2: #182436;
    --text: #ffffff;
    --muted: #8b9bb0;
    --border: rgba(78, 205, 196, 0.12);
    --danger: #ff6b6b;
    --success: #4ecdc4;
    --warning: #ffe66d;
    --info: #6c9cff;
}

body {
    background:
        radial-gradient(circle at top left, rgba(78, 205, 196, 0.14), transparent 28%),
        radial-gradient(circle at bottom right, rgba(199, 244, 100, 0.08), transparent 24%),
        var(--ink);
    color: var(--text);
    font-family: 'Tajawal', sans-serif;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

.sidebar {
    background: rgba(19, 29, 43, 0.96);
    backdrop-filter: blur(10px);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    padding: 24px 16px;
    position: fixed;
    right: 0;
    top: 0;
    width: 250px;
}

.sidebar-logo {
    align-items: center;
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
    padding-bottom: 18px;
}

.logo-circle {
    align-items: center;
    background: linear-gradient(135deg, var(--teal), var(--lime));
    border-radius: 50%;
    box-shadow: 0 8px 22px rgba(78, 205, 196, 0.32);
    color: #07141d;
    display: flex;
    font-size: 18px;
    font-weight: 800;
    height: 44px;
    justify-content: center;
    width: 44px;
}

.nav-item {
    align-items: center;
    border-radius: 12px;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    gap: 10px;
    margin-bottom: 4px;
    padding: 12px 14px;
    transition: 0.2s ease;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(78, 205, 196, 0.1);
    color: var(--text);
}

.nav-button {
    background: transparent;
    border: 0;
    font-family: 'Tajawal', sans-serif;
    text-align: right;
    width: 100%;
}

.main {
    margin-right: 250px;
    padding: 32px;
}

.header {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}

.header h1 {
    font-size: 28px;
    font-weight: 800;
}

.header h1 span {
    color: var(--teal);
}

.header-actions,
.filter-row,
.pagination {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.panel,
.stat-card,
.login-card {
    background: rgba(19, 29, 43, 0.92);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
}

.panel {
    margin-bottom: 24px;
    padding: 24px;
}

.panel-title {
    align-items: center;
    display: flex;
    font-size: 16px;
    font-weight: 700;
    gap: 8px;
    margin-bottom: 18px;
}

.stats-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 28px;
}

.stat-card {
    overflow: hidden;
    padding: 20px;
    position: relative;
}

.stat-value {
    font-size: 30px;
    font-weight: 800;
    margin-bottom: 4px;
}

.stat-label {
    color: var(--muted);
    font-size: 13px;
}

.btn {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    font-weight: 700;
    gap: 8px;
    justify-content: center;
    padding: 10px 18px;
    transition: 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--teal), #39bdb5);
    color: #08131c;
}

.btn-secondary {
    background: var(--panel-2);
    border-color: var(--border);
    color: var(--text);
}

.btn-danger {
    background: rgba(255, 107, 107, 0.12);
    border-color: rgba(255, 107, 107, 0.25);
    color: var(--danger);
}

.btn-success {
    background: rgba(78, 205, 196, 0.12);
    border-color: rgba(78, 205, 196, 0.25);
    color: var(--success);
}

.btn-info {
    background: rgba(108, 156, 255, 0.12);
    border-color: rgba(108, 156, 255, 0.22);
    color: var(--info);
}

.btn-sm {
    font-size: 12px;
    padding: 6px 12px;
}

.form-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-bottom: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

.hint {
    color: var(--muted);
    font-size: 11px;
}

.input,
.select,
.textarea {
    background: #0f1a27;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: 'Tajawal', sans-serif;
    font-size: 14px;
    outline: none;
    padding: 11px 14px;
}

.input:focus,
.select:focus,
.textarea:focus {
    border-color: rgba(78, 205, 196, 0.55);
}

.table-wrap {
    overflow-x: auto;
}

table {
    border-collapse: collapse;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding: 14px 12px;
    text-align: right;
}

th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

tbody tr:hover td {
    background: rgba(78, 205, 196, 0.04);
}

.code-text {
    background: #0d1824;
    border-radius: 8px;
    direction: ltr;
    display: inline-block;
    font-family: 'Courier New', monospace;
    padding: 5px 10px;
}

.badge {
    border-radius: 999px;
    display: inline-flex;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 10px;
}

.badge-active {
    background: rgba(78, 205, 196, 0.12);
    color: var(--success);
}

.badge-unused {
    background: rgba(108, 156, 255, 0.12);
    color: var(--info);
}

.badge-released {
    background: rgba(255, 230, 109, 0.12);
    color: var(--warning);
}

.badge-expired,
.badge-blocked {
    background: rgba(255, 107, 107, 0.12);
    color: var(--danger);
}

.badge-unlinked {
    background: rgba(255, 230, 109, 0.12);
    color: var(--warning);
}

.badge-week,
.badge-month,
.badge-quarter,
.badge-year,
.badge-custom {
    background: rgba(78, 205, 196, 0.1);
    color: var(--teal);
}

.flash-list {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.flash {
    border-radius: 12px;
    padding: 12px 16px;
}

.flash-success {
    background: rgba(78, 205, 196, 0.12);
    color: var(--success);
}

.flash-error {
    background: rgba(255, 107, 107, 0.12);
    color: var(--danger);
}

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

.login-card {
    max-width: 420px;
    padding: 32px;
    width: 100%;
}

.login-card h1 {
    font-size: 30px;
    margin-bottom: 10px;
}

.login-card p {
    color: var(--muted);
    margin-bottom: 24px;
}

.codes-preview {
    background: #0d1824;
    border: 1px dashed var(--border);
    border-radius: 14px;
    margin-top: 20px;
    padding: 18px;
}

.code-list {
    display: grid;
    gap: 8px;
    margin-top: 14px;
    max-height: 320px;
    overflow-y: auto;
}

.code-item {
    align-items: center;
    background: rgba(19, 29, 43, 0.9);
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
}

.code-item-code {
    direction: ltr;
    font-family: 'Courier New', monospace;
}

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

.actions-inline {
    align-items: center;
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

.section-stack {
    display: grid;
    gap: 24px;
}

.detail-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-item {
    background: rgba(15, 26, 39, 0.75);
    border: 1px solid var(--border);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
}

.audit-list {
    display: grid;
    gap: 12px;
}

.audit-item {
    background: rgba(15, 26, 39, 0.75);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
}

.audit-top {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 6px;
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.detail-tag {
    background: rgba(78, 205, 196, 0.08);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text);
    display: inline-flex;
    font-size: 12px;
    gap: 4px;
    padding: 6px 10px;
}

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

    .form-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .sidebar {
        display: none;
    }

    .main {
        margin-right: 0;
        padding: 20px;
    }
}

@media (max-width: 620px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .header {
        align-items: flex-start;
        flex-direction: column;
    }
}
