:root {
    --borderColor: rgba(255, 255, 255, 0.12);
    --headerBackgroundColor: #2a3540;
}

#wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid var(--borderColor);
    background: var(--headerBackgroundColor);
}

.page-header h1 {
    margin: 0;
    font-family: var(--settingsFontFamily);
    font-size: 1.4em;
    font-weight: normal;
    color: #ccc;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-email {
    color: #999;
    font-size: 14px;
}

#loginView {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    background: var(--buttonBackgroundColor);
    border: 1px solid var(--borderColor);
    border-radius: 8px;
    padding: 40px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.login-box h2 {
    margin: 0 0 10px 0;
    color: #ccc;
    font-size: 1.8em;
    font-weight: normal;
}

.login-box .subtitle {
    color: #999;
    margin-bottom: 30px;
    font-size: 0.95em;
}

.btn-login {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    margin-top: 10px;
}

.login-footer {
    padding: 20px;
    text-align: center;
    font-size: 13px;
    color: #666;
    border-top: 1px solid var(--borderColor);
}

.forgot-link {
    color: #999;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
}

.forgot-link:hover {
    color: #ccc;
}

#forgotBox {
    display: none;
}

#portalView {
    display: none;
    flex: 1;
    overflow: hidden;
    flex-direction: column;
}

.settings-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.settings-sidebar {
    width: 200px;
    flex-shrink: 0;
    border-right: 1px solid var(--borderColor);
    background: var(--headerBackgroundColor);
    overflow-y: auto;
    padding: 12px 0;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 18px;
    color: #999;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
    border-left: 3px solid transparent;
    user-select: none;
}

.sidebar-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ccc;
}

.sidebar-nav-item.active {
    color: white;
    background: rgba(255, 255, 255, 0.07);
    border-left-color: var(--activeColor);
}

.sidebar-nav-item .nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.sidebar-nav-item.admin-only,
.sidebar-divider.admin-only,
.settings-card.admin-only {
    display: none;
}

#wrapper.is-admin .sidebar-nav-item.admin-only {
    display: flex;
}

#wrapper.is-admin .sidebar-divider.admin-only {
    display: block;
}

#wrapper.is-admin .settings-card.admin-only {
    display: block;
}

.sidebar-divider {
    display: none;
    padding: 14px 18px 4px 18px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #555;
}

.sidebar-divider::before {
    content: '';
    display: block;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    margin-bottom: 10px;
}

.settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
}

.settings-section {
    display: none;
    max-width: 680px;
}

.settings-section.active {
    display: block;
    background-color: rgba(0, 0, 0, 0);
}

.settings-section.wide {
    max-width: 1200px;
}

.settings-section h2 {
    margin: 0 0 4px 0;
    color: #ccc;
    font-size: 1.3em;
    font-weight: 500;
}

.section-description {
    color: #777;
    font-size: 13px;
    margin: 0 0 20px 0;
}

.settings-card {
    background: var(--buttonBackgroundColor);
    border: 1px solid var(--borderColor);
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
}

.settings-card h3 {
    margin: 0 0 10px 0;
    color: #bbb;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 12px;
    border-bottom: 1px solid var(--borderColor);
    padding-bottom: 8px;
    display: flex;
    align-items: center;
}

.license-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.license-status-row:last-child {
    border-bottom: none;
}

.license-status-label {
    color: #999;
    font-size: 14px;
}

.license-status-value {
    color: #ccc;
    font-size: 14px;
    font-weight: 500;
}

.license-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

.license-badge.valid {
    background: rgba(76, 175, 80, 0.15);
    color: #88dd88;
    border: 1px solid #4CAF50;
}

.license-badge.invalid {
    background: rgba(204, 0, 0, 0.15);
    color: #ff8888;
    border: 1px solid #cc0000;
}

.license-badge.expiring {
    background: rgba(255, 165, 0, 0.15);
    color: #ffbb66;
    border: 1px solid #ff8800;
}

.license-info-panel {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 13px;
    line-height: 1.55;
    color: #aaa;
}

.license-info-panel.warning {
    background: rgba(255, 165, 0, 0.08);
    border-color: rgba(255, 136, 0, 0.35);
    color: #ddbb88;
}

.license-info-panel h4 {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 600;
    color: #ccc;
}

.license-info-panel ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

.license-info-panel li {
    margin-bottom: 6px;
}

.license-info-panel li:last-child {
    margin-bottom: 0;
}

.license-info-panel .license-mono {
    color: inherit;
}

.license-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    color: #bbb;
}

.activation-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
}

.activation-table th {
    text-align: left;
    color: #777;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 8px 10px;
    border-bottom: 1px solid var(--borderColor);
}

.activation-table td {
    padding: 10px;
    color: #ccc;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

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

.activation-table th:nth-child(1),
.activation-table td:nth-child(1) {
    width: 28%;
}

.activation-table th:nth-child(2),
.activation-table td:nth-child(2) {
    width: 12%;
}

.activation-table th:nth-child(3),
.activation-table td:nth-child(3),
.activation-table th:nth-child(4),
.activation-table td:nth-child(4) {
    width: 16%;
}

.activation-table th:nth-child(5),
.activation-table td:nth-child(5) {
    width: 28%;
}

.activation-id-cell {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.activation-id-short {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 12px;
    color: #bbb;
    white-space: nowrap;
}

.btn-icon {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #999;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    cursor: pointer;
    line-height: 1.4;
    flex-shrink: 0;
}

.btn-icon:hover {
    color: #ddd;
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-icon.copied {
    color: #8f8;
    border-color: rgba(136, 255, 136, 0.4);
}

.activation-method-badge {
    font-size: 11px;
    padding: 2px 6px;
    display: inline-block;
}

.activation-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
    align-items: center;
}

.activation-actions .btn {
    font-size: 12px;
    padding: 4px 10px;
}

.activation-actions .btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.activation-lock-hint {
    font-size: 11px;
    color: #888;
    max-width: 140px;
    line-height: 1.35;
}

.activations-footer {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.modal-lead {
    color: #999;
    font-size: 13px;
    margin: 0 0 16px;
    line-height: 1.45;
}

.field-hint {
    color: #777;
    font-size: 12px;
    margin: 8px 0 0;
    line-height: 1.4;
}

.billing-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
}

.billing-form .form-row-3 {
    grid-template-columns: 1fr 1.4fr 1fr;
}

@media (max-width: 720px) {
    .billing-form .form-row,
    .billing-form .form-row-3 {
        grid-template-columns: 1fr;
    }
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.users-table th {
    text-align: left;
    color: #666;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 10px 12px;
    border-bottom: 1px solid var(--borderColor);
    background: rgba(255, 255, 255, 0.03);
}

.users-table td {
    padding: 10px 12px;
    color: #ccc;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}

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

.users-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

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

.users-summary {
    color: #777;
    font-size: 13px;
    margin-bottom: 12px;
}

.users-table-scroll {
    overflow-x: auto;
}

.users-table .license-badge {
    font-size: 11px;
    padding: 3px 10px;
    white-space: nowrap;
}

.users-email-cell {
    font-weight: 500;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.users-company-sub {
    margin-top: 2px;
    font-size: 11px;
    font-weight: 400;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.customers-layout {
    display: grid;
    grid-template-columns: minmax(240px, 300px) 1fr;
    gap: 16px;
    min-height: calc(100vh - 220px);
    align-items: stretch;
}

.customers-list-pane {
    background: var(--buttonBackgroundColor);
    border: 1px solid var(--borderColor);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.customers-list-toolbar {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-bottom: 1px solid var(--borderColor);
}

.customers-list-toolbar input[type="search"] {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    padding: 8px 10px;
}

.customers-list-toolbar .btn {
    font-size: 12px;
    padding: 8px 12px;
    flex-shrink: 0;
}

.customers-list {
    overflow-y: auto;
    flex: 1;
}

.customer-list-item {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px 14px;
    cursor: pointer;
    color: inherit;
}

.customer-list-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.customer-list-item.active {
    background: rgba(100, 160, 255, 0.12);
    box-shadow: inset 3px 0 0 #6af;
}

.customer-list-email {
    font-size: 13px;
    font-weight: 500;
    color: #ddd;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.customer-list-meta {
    margin-top: 4px;
    font-size: 11px;
    color: #777;
}

.customer-detail-pane {
    background: var(--buttonBackgroundColor);
    border: 1px solid var(--borderColor);
    border-radius: 8px;
    padding: 20px;
    overflow-y: auto;
    min-height: 0;
}

.customer-detail-empty {
    color: #777;
    font-size: 14px;
    padding: 40px 12px;
    text-align: center;
}

.customer-detail-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.customer-detail-header h3 {
    margin: 0;
    font-size: 1.25em;
    font-weight: normal;
    color: #ccc;
}

.customer-detail-sub {
    margin: 4px 0 0;
    font-size: 13px;
    color: #888;
}

.admin-card {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 14px;
    background: rgba(0, 0, 0, 0.15);
}

.admin-card h4 {
    margin: 0 0 12px;
    font-size: 14px;
    font-weight: 600;
    color: #bbb;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.admin-card-header h4 {
    margin: 0;
}

.license-admin-card {
    border-color: rgba(100, 160, 255, 0.2);
}

.admin-inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.admin-collapse {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    margin-bottom: 14px;
    background: rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.admin-collapse-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 10px 4px 4px;
    border-bottom: 1px solid transparent;
}

.admin-collapse.open .admin-collapse-toolbar {
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

.admin-collapse-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    text-align: left;
    padding: 10px 8px;
    border-radius: 6px;
}

.admin-collapse-head:hover {
    background: rgba(255, 255, 255, 0.04);
}

.admin-collapse-chevron {
    display: inline-block;
    width: 1em;
    color: #888;
    transition: transform 0.15s ease;
}

.admin-collapse.open .admin-collapse-chevron {
    transform: rotate(90deg);
}

.admin-collapse-title {
    font-size: 14px;
    font-weight: 600;
    color: #bbb;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-collapse-actions {
    flex-shrink: 0;
}

.admin-collapse-body {
    display: none;
    padding: 14px 16px 16px;
}

.admin-collapse.open .admin-collapse-body {
    display: block;
}

.admin-collapse-body > .admin-card:last-child {
    margin-bottom: 0;
}

@media (max-width: 900px) {
    .customers-layout {
        grid-template-columns: 1fr;
    }
    .customers-list-pane {
        max-height: 240px;
    }
}

.users-activations-cell.at-limit {
    color: #ffbb66;
    font-weight: 600;
}

.users-date-cell {
    color: #999;
    font-size: 12px;
    white-space: nowrap;
}

.users-table td.expired-date {
    color: #ff8888;
}

.users-install-cell {
    min-width: 280px;
    max-width: 360px;
}

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

.users-install-entry {
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.users-install-id {
    font-size: 11px;
    line-height: 1.45;
    word-break: break-all;
    color: #bbb;
}

.users-install-meta {
    margin-top: 4px;
    font-size: 11px;
    color: #777;
}

.users-install-empty {
    color: #666;
}

.users-actions-cell {
    white-space: nowrap;
}

.spinner {
    display: inline-block;
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 6px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

.activate-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.activate-form .form-group {
    margin-bottom: 0;
}

.activate-form .form-group input {
    font-size: 14px;
}
