/* ═══════════════════════════════════════════════════
   授权管理系统 v3.0 — 统一样式
   纯浅色极简风格 (Linear/Notion inspired)
   ═══════════════════════════════════════════════════ */

:root {
    --primary: #4f6ef7;
    --primary-light: #eef1fe;
    --primary-dark: #3b54d4;
    --success: #22c55e;
    --success-light: #f0fdf4;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --info: #3b82f6;
    --info-light: #eff6ff;

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    --bg-page: #f5f6fa;
    --bg-white: #ffffff;
    --bg-light: #f8fafc;

    --border: #e8ecf1;
    --border-light: #f0f2f5;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);

    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;

    --sidebar-width: 220px;
    --topbar-height: 56px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Courier New', monospace;

    --transition: 150ms ease;
}

/* ═══════════════════════════════════════════════════
   Reset & Base
   ═══════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: var(--font);
    font-size: 0.925rem;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-page);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    letter-spacing: -0.02em;
}

code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--primary);
    background: var(--primary-light);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
}

hr {
    border-color: var(--border);
    opacity: 1;
}

/* ═══════════════════════════════════════════════════
   Layout
   ═══════════════════════════════════════════════════ */

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

/* Sidebar */
#sidebar-wrapper {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-white);
    border-right: 1px solid var(--border-light);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 1.25rem 1.25rem;
    height: var(--topbar-height);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.sidebar-logo-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius);
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-logo-text {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.sidebar-logo-version {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0.75rem;
}

.sidebar-nav-group {
    padding: 0.75rem 0.75rem 0.375rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.06em;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition);
    cursor: pointer;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.sidebar-nav-item:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.sidebar-nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    border-left-color: var(--primary);
}

.sidebar-nav-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition);
}

.sidebar-user:hover { background: var(--bg-light); }

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-user-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.sidebar-user-role {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Page Content */
#page-content-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin var(--transition);
    min-height: 100vh;
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.3rem;
    padding: 0.25rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.topbar-toggle:hover {
    color: var(--text-primary);
    background: var(--bg-light);
}

.topbar-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Content */
.page-content {
    padding: 1.5rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

/* ═══════════════════════════════════════════════════
   Cards
   ═══════════════════════════════════════════════════ */

.card {
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
    margin-bottom: 1.25rem;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-light);
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body { padding: 1.25rem; }
.card-footer {
    background: transparent;
    border-top: 1px solid var(--border-light);
    padding: 0.875rem 1.25rem;
}

.card-stat {
    border-left: 4px solid var(--primary);
}

.card-stat-success { border-left-color: var(--success); }
.card-stat-warning { border-left-color: var(--warning); }
.card-stat-danger  { border-left-color: var(--danger); }
.card-stat-info    { border-left-color: var(--info); }

/* ═══════════════════════════════════════════════════
   Tables
   ═══════════════════════════════════════════════════ */

.table {
    color: var(--text-primary);
    font-size: 0.875rem;
    margin-bottom: 0;
}

.table thead th {
    background: var(--bg-page);
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.table tbody tr:hover { background: var(--bg-light); }

.table-sm thead th,
.table-sm tbody td { padding: 0.5rem 0.75rem; }

/* ═══════════════════════════════════════════════════
   Buttons
   ═══════════════════════════════════════════════════ */

.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    transition: all var(--transition);
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

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

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

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

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

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

.btn-outline-secondary:hover {
    background: var(--bg-light);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

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

.btn-outline-danger:hover {
    background: var(--danger);
    color: white;
}

.btn-light {
    background: var(--bg-light);
    border-color: var(--border);
    color: var(--text-primary);
}

.btn-light:hover {
    background: var(--border);
    border-color: var(--text-muted);
}

.btn-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.625rem 1.5rem;
    font-size: 1rem;
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.btn-group .btn:last-child {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ═══════════════════════════════════════════════════
   Forms
   ═══════════════════════════════════════════════════ */

.form-label {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 0.375rem;
}

.form-control, .form-select {
    border-color: var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control-sm, .form-select-sm {
    font-size: 0.8125rem;
    padding: 0.3rem 0.5rem;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

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

/* ═══════════════════════════════════════════════════
   Badges
   ═══════════════════════════════════════════════════ */

.badge {
    font-weight: 500;
    padding: 0.3em 0.6em;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
}

.badge-soft-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-soft-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-soft-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-soft-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-soft-info {
    background: var(--info-light);
    color: var(--info);
}

/* ═══════════════════════════════════════════════════
   Alerts
   ═══════════════════════════════════════════════════ */

.alert {
    border: none;
    border-radius: var(--radius);
    padding: 0.875rem 1.125rem;
    font-size: 0.9rem;
}

.alert-success {
    background: var(--success-light);
    color: #166534;
}

.alert-danger {
    background: var(--danger-light);
    color: #991b1b;
}

.alert-warning {
    background: var(--warning-light);
    color: #92400e;
}

.alert-info {
    background: var(--info-light);
    color: #1e40af;
}

/* ═══════════════════════════════════════════════════
   Pagination
   ═══════════════════════════════════════════════════ */

.pagination {
    gap: 4px;
}

.page-link {
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
    background: transparent;
}

.page-link:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.page-item.active .page-link {
    background: var(--primary);
    color: white;
    border-radius: var(--radius-sm);
}

.page-item.disabled .page-link {
    color: var(--text-muted);
    background: transparent;
}

/* ═══════════════════════════════════════════════════
   Dropdown
   ═══════════════════════════════════════════════════ */

.dropdown-menu {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 0.375rem;
}

.dropdown-item {
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    transition: all var(--transition);
}

.dropdown-item:hover {
    background: var(--bg-light);
}

.dropdown-item.text-danger:hover {
    background: var(--danger-light);
}

/* ═══════════════════════════════════════════════════
   Modals & Offcanvas
   ═══════════════════════════════════════════════════ */

.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
}

.modal-body { padding: 1.25rem; }

.modal-footer {
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--border-light);
}

.offcanvas {
    border: none;
    box-shadow: var(--shadow-lg);
}

.offcanvas-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
}

/* ═══════════════════════════════════════════════════
   Progress
   ═══════════════════════════════════════════════════ */

.progress {
    border-radius: 100px;
    background: var(--border-light);
    height: 6px;
}

.progress-bar {
    border-radius: 100px;
}

.progress-bar-primary { background: var(--primary); }
.progress-bar-success { background: var(--success); }
.progress-bar-warning { background: var(--warning); }
.progress-bar-danger  { background: var(--danger); }

/* ═══════════════════════════════════════════════════
   Code Display
   ═══════════════════════════════════════════════════ */

.code-block {
    font-family: var(--font-mono);
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.85rem;
    word-break: break-all;
    user-select: all;
}

/* ═══════════════════════════════════════════════════
   Utilities
   ═══════════════════════════════════════════════════ */

.text-primary    { color: var(--primary) !important; }
.text-secondary  { color: var(--text-secondary) !important; }
.text-muted      { color: var(--text-muted) !important; }
.text-success    { color: var(--success) !important; }
.text-danger     { color: var(--danger) !important; }
.text-warning    { color: var(--warning) !important; }

.bg-primary      { background: var(--primary) !important; }
.bg-primary-light { background: var(--primary-light) !important; }
.bg-page         { background: var(--bg-page) !important; }

.fw-semibold { font-weight: 600; }
.fs-7 { font-size: 0.8125rem; }
.fs-8 { font-size: 0.75rem; }

.border-light-2 { border-color: var(--border-light) !important; }

.shadow-soft { box-shadow: var(--shadow-sm); }

.rounded-lg { border-radius: var(--radius-lg); }

/* ═══════════════════════════════════════════════════
   Empty State
   ═══════════════════════════════════════════════════ */

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    color: var(--text-muted);
    opacity: 0.5;
}

.empty-state h5 {
    margin: 0.5rem 0;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

/* ═══════════════════════════════════════════════════
   Toast Container
   ═══════════════════════════════════════════════════ */

.toast-container-custom {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 1060;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast-custom {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    min-width: 240px;
    max-width: 400px;
    animation: slideInRight 0.25s ease;
    border: 1px solid var(--border);
}

.toast-custom.success { border-left: 3px solid var(--success); }
.toast-custom.error   { border-left: 3px solid var(--danger); }
.toast-custom.warning { border-left: 3px solid var(--warning); }
.toast-custom.info    { border-left: 3px solid var(--info); }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* ═══════════════════════════════════════════════════
   Loading Spinner
   ═══════════════════════════════════════════════════ */

.loading-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-muted);
    gap: 0.75rem;
}

/* ═══════════════════════════════════════════════════
   Login Page
   ═══════════════════════════════════════════════════ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f6fa 0%, #e8ecf1 100%);
}

.login-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
}

.login-card h2 {
    text-align: center;
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.login-card .subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

/* ═══════════════════════════════════════════════════
   Auth Generate Page
   ═══════════════════════════════════════════════════ */

.auth-form-section {
    padding: 1rem;
    border-radius: var(--radius);
    background: var(--bg-light);
    margin-bottom: 1rem;
}

.auth-form-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.feature-checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.feature-checkbox-btn {
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--bg-white);
    color: var(--text-secondary);
    user-select: none;
}

.feature-checkbox-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.feature-checkbox-btn.selected {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 500;
}

/* ═══════════════════════════════════════════════════
   Customer Management
   ═══════════════════════════════════════════════════ */

.customer-list-item {
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--bg-white);
    padding: 1rem 1.25rem;
    margin-bottom: 0.5rem;
    transition: all var(--transition);
}

.customer-list-item:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.customer-list-item .customer-name {
    font-weight: 600;
    color: var(--text-primary);
}

.customer-list-item .customer-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.customer-expand-row {
    background: var(--bg-light);
    border: 1px solid var(--border-light);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 1rem 1.25rem;
    display: none;
}

.customer-expand-row.show { display: block; }

/* ═══════════════════════════════════════════════════
   History Page
   ═══════════════════════════════════════════════════ */

.stat-card {
    text-align: center;
    padding: 1rem;
}

.stat-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ═══════════════════════════════════════════════════
   Filter Bar
   ═══════════════════════════════════════════════════ */

.filter-bar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-bar .form-control,
.filter-bar .form-select {
    max-width: 220px;
}

.filter-bar .search-input {
    max-width: 300px;
}

/* ═══════════════════════════════════════════════════
   Dashboard Charts
   ═══════════════════════════════════════════════════ */

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* ═══════════════════════════════════════════════════
   Animations
   ═══════════════════════════════════════════════════ */

.animate-fade-in {
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════ */

@media (max-width: 768px) {
    :root {
        --sidebar-width: 0px;
    }

    #sidebar-wrapper {
        transform: translateX(-220px);
        width: 220px;
    }

    body.sidebar-open #sidebar-wrapper {
        transform: translateX(0);
    }

    #page-content-wrapper {
        margin-left: 0 !important;
    }

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

    .filter-bar .form-control,
    .filter-bar .form-select,
    .filter-bar .search-input {
        max-width: 100%;
        flex: 1;
    }

    .login-card {
        margin: 1rem;
        padding: 1.5rem;
    }
}

@media (max-width: 576px) {
    .topbar { padding: 0 0.75rem; }
    .page-content { padding: 1rem; }
    .card-body { padding: 0.875rem; }
}

/* Company -> city -> machine management */
.workspace-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.workspace-heading h1 {
  margin: 0 0 5px;
  font-size: 1.65rem;
  letter-spacing: -.03em;
}

.workspace-heading p {
  margin: 0;
  color: var(--text-muted, #64748b);
}

.company-summary {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
}

.company-summary > div {
  min-width: 140px;
  padding: 16px 22px;
  border-right: 1px solid #e2e8f0;
}

.company-summary > div:last-child { border-right: 0; }
.company-summary span { display: block; color: #64748b; font-size: .78rem; }
.company-summary strong { display: block; margin-top: 3px; font-size: 1.35rem; }

.company-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.company-toolbar .search-input { max-width: 460px; }
.company-toolbar .form-select { width: 150px; }

.company-list {
  overflow: hidden;
  border: 1px solid #dfe5ee;
  border-radius: 12px;
  background: #fff;
}

.company-row { position: relative; border-bottom: 1px solid #e8edf4; }
.company-row:last-child { border-bottom: 0; }
.company-row.expanded { background: #fbfcff; }

.company-row-main {
  display: grid;
  grid-template-columns: 24px minmax(220px, 1fr) 190px 70px;
  align-items: center;
  gap: 16px;
  width: calc(100% - 270px);
  min-height: 78px;
  padding: 14px 8px 14px 20px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.company-disclosure { color: #64748b; transition: transform .18s ease; }
.company-row.expanded .company-disclosure { transform: rotate(90deg); }
.company-identity strong, .company-identity small { display: block; }
.company-identity strong { font-size: .98rem; }
.company-identity small { margin-top: 4px; color: #64748b; }

.company-usage span { display: block; margin-bottom: 7px; font-size: .8rem; color: #475569; }
.company-usage i, .city-progress {
  display: block;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf5;
}
.company-usage b, .city-progress b { display: block; height: 100%; background: #356ae6; }

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: .78rem;
  white-space: nowrap;
}
.status-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #94a3b8; }
.status-dot.active::before { background: #16a36a; }
.status-dot.inactive::before { background: #dc5b5b; }

.company-actions {
  position: absolute;
  top: 22px;
  right: 18px;
  display: flex;
  gap: 7px;
}

.company-detail { display: none; padding: 0 20px 20px 60px; }
.company-detail.open { display: block; }
.company-detail-loading, .company-empty { padding: 20px; color: #64748b; text-align: center; }

.city-section {
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid #e1e7ef;
  border-radius: 10px;
  background: #fff;
}

.city-section > header {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) 140px auto auto;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 10px 14px;
}
.city-section > header strong { margin: 0 9px 0 7px; }
.city-section > header span { color: #64748b; font-size: .78rem; }

.machine-list { display: none; border-top: 1px solid #e8edf4; background: #f8fafc; }
.machine-list.open { display: block; }
.machine-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1.35fr) 78px 128px;
  align-items: center;
  gap: 16px;
  min-height: 68px;
  padding: 10px 16px;
  border-bottom: 1px solid #e8edf4;
}
.machine-row:last-child { border-bottom: 0; }
.machine-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.machine-main > i { color: #356ae6; font-size: 1.2rem; }
.machine-main strong, .machine-main code { display: block; overflow: hidden; text-overflow: ellipsis; }
.machine-main code { margin-top: 3px; color: #64748b; font-size: .75rem; }
.machine-licenses { display: flex; flex-wrap: wrap; gap: 6px; }
.machine-license {
  display: inline-flex;
  gap: 8px;
  padding: 5px 8px;
  border: 1px solid #dbe4f0;
  border-radius: 6px;
  background: #fff;
  color: #24457f;
  font-size: .75rem;
  text-decoration: none;
}
.machine-license small { color: #64748b; }
.machine-actions { display: flex; }
.machine-actions .btn { padding: .25rem .4rem; white-space: nowrap; }

@media (max-width: 900px) {
  .company-row-main {
    grid-template-columns: 22px minmax(0, 1fr) 70px;
    width: 100%;
    padding-right: 150px;
  }
  .company-usage { display: none; }
  .company-actions { top: 20px; }
  .company-actions .btn:first-child { display: none; }
  .company-detail { padding-left: 16px; padding-right: 16px; }
  .city-section > header { grid-template-columns: 1fr auto; }
  .city-progress { display: none; }
  .machine-row { grid-template-columns: 1fr auto; }
  .machine-licenses { grid-column: 1 / -1; }
  .machine-actions { grid-column: 2; grid-row: 1; }
}

@media (max-width: 576px) {
  .workspace-heading { align-items: flex-start; }
  .workspace-heading p { display: none; }
  .company-summary { overflow: hidden; }
  .company-summary > div { flex: 1; min-width: 0; padding: 12px 10px; }
  .company-toolbar { flex-direction: column; }
  .company-toolbar .search-input, .company-toolbar .form-select { width: 100%; max-width: none; }
  .company-row-main { grid-template-columns: 18px minmax(0, 1fr); padding: 14px 120px 14px 12px; }
  .company-row-main .status-dot { display: none; }
  .company-actions { right: 10px; }
  .company-actions .btn:nth-child(2) { display: none; }
  .company-detail { padding: 0 8px 12px; }
  .city-section > header { grid-template-columns: 1fr auto; gap: 6px; }
  .city-section > header .btn-link { display: none; }
}

/* ═══════════════════════════════════════════════════
   Authorization workspace — 2026 redesign
   ═══════════════════════════════════════════════════ */

:root {
    --primary: #315cf6;
    --primary-light: #edf2ff;
    --primary-dark: #2448ce;
    --text-primary: #172033;
    --text-secondary: #667085;
    --text-muted: #98a2b3;
    --bg-page: #f4f6f8;
    --bg-light: #f8fafc;
    --border: #e2e7ef;
    --border-light: #edf0f4;
    --sidebar-width: 224px;
    --topbar-height: 64px;
    --radius: 10px;
    --radius-lg: 14px;
}

body {
    background: var(--bg-page);
    color: var(--text-primary);
    font-size: 14px;
}

#sidebar-wrapper {
    background: #0d1526;
    border-right: 0;
    padding: 0 12px;
}

.sidebar-logo {
    height: 72px;
    padding: 16px 10px;
    border-color: rgba(255, 255, 255, 0.08);
}

.sidebar-logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #315cf6;
    box-shadow: 0 8px 18px rgba(49, 92, 246, 0.3);
}

.sidebar-logo-text { color: #fff; font-size: 15px; }
.sidebar-logo-version { color: #71809a; }
.sidebar-nav { padding: 16px 0; }

.sidebar-nav-group {
    padding: 18px 12px 8px;
    color: #68758c;
    font-size: 10px;
    letter-spacing: 0.12em;
}

.sidebar-nav-item {
    min-height: 42px;
    padding: 10px 12px;
    border: 0;
    border-radius: 9px;
    color: #9ba8bc;
    font-size: 13px;
}

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

.sidebar-nav-item.active {
    background: #1a2841;
    color: #fff;
    border: 0;
    box-shadow: inset 3px 0 #5b7cff;
}

.sidebar-nav-item.active i { color: #7f9aff; }
.sidebar-footer { border-color: rgba(255, 255, 255, 0.08); }
.sidebar-user-name { color: #fff; }
.sidebar-user-role { color: #71809a; }
.sidebar-user:hover { background: rgba(255, 255, 255, 0.05); }
.sidebar-user-avatar { background: #1f3150; color: #a9bcff; }

.topbar {
    height: var(--topbar-height);
    padding: 0 28px;
    background: rgba(255, 255, 255, 0.96);
    border-color: var(--border);
}

.topbar-title {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}

.topbar-quick-action {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    padding: 0 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
}

.topbar-quick-action:hover {
    border-color: #c6d0e0;
    color: var(--primary);
    background: var(--bg-light);
}

.page-content {
    width: 100%;
    max-width: 1600px;
    min-width: 0;
    margin: 0 auto;
    padding: 28px 32px 48px;
}

#page-content-wrapper,
.workbench-panel {
    min-width: 0;
}

.btn {
    min-height: 38px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 4px 10px rgba(49, 92, 246, 0.18);
}

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

.form-control,
.form-select {
    min-height: 40px;
    border-color: var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 13px;
}

.form-control:focus,
.form-select:focus {
    border-color: #7b98ff;
    box-shadow: 0 0 0 3px rgba(49, 92, 246, 0.1);
}

.workbench-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    margin: 2px 0 24px;
}

.workbench-heading h1 {
    margin: 0 0 6px;
    font-size: 25px;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -0.035em;
}

.workbench-heading p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.active-context {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 42px;
    margin-bottom: 16px;
    padding: 8px 12px;
    border: 1px solid #cfdbff;
    border-radius: 9px;
    background: #f3f6ff;
    color: #38519a;
}

.active-context a { margin-left: auto; font-weight: 600; }

.workbench-summary {
    display: flex;
    align-items: center;
    min-height: 76px;
    margin-bottom: 16px;
    padding: 0 22px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #fff;
}

.summary-item {
    display: flex;
    align-items: baseline;
    gap: 12px;
    min-width: 150px;
    padding: 0 24px;
    border-right: 1px solid var(--border-light);
}

.summary-item:first-child { padding-left: 0; }
.summary-item:last-child { border: 0; }
.summary-item span { color: var(--text-secondary); font-size: 12px; }
.summary-item strong { font-size: 24px; letter-spacing: -0.04em; }
.summary-success strong { color: #16845b; }

.workbench-panel {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: #fff;
    box-shadow: 0 8px 28px rgba(16, 24, 40, 0.04);
}

.workbench-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 66px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-light);
}

.status-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-tab {
    min-height: 34px;
    padding: 6px 11px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.status-tab:hover { background: var(--bg-light); color: var(--text-primary); }
.status-tab.active { background: var(--primary-light); color: var(--primary); }

.toolbar-fields {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    flex: 1;
}

.toolbar-fields .form-select {
    width: 150px;
    min-height: 38px;
}

.workbench-search {
    display: flex;
    align-items: center;
    width: min(300px, 42vw);
    min-height: 38px;
    padding: 0 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    background: #fff;
}

.workbench-search:focus-within {
    border-color: #7b98ff;
    box-shadow: 0 0 0 3px rgba(49, 92, 246, 0.1);
}

.workbench-search input {
    width: 100%;
    padding: 0 0 0 9px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
}

.workbench-search input::placeholder { color: #9aa4b2; }

.workbench-table-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 18px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: 11px;
}

.workbench-table > :not(caption) > * > * { box-shadow: none; }

.workbench-table thead th {
    padding: 10px 14px;
    border: 0;
    border-bottom: 1px solid var(--border);
    background: #f8f9fb;
    color: #7c8798;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.045em;
}

.workbench-table tbody td {
    height: 76px;
    padding: 12px 14px;
    border-color: var(--border-light);
    vertical-align: middle;
}

.workbench-row { cursor: pointer; transition: background 120ms ease; }
.workbench-row:hover { background: #f8faff; }
.workbench-row:focus-within { background: #f4f7ff; }

.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 7px;
    border-radius: 50%;
    vertical-align: 1px;
}

.status-dot-success {
    background: #17a673;
    box-shadow: 0 0 0 3px #e8f7f1;
}

.status-dot-muted { background: #aab2bf; box-shadow: 0 0 0 3px #f0f2f4; }
.status-text { color: #4d596a; font-size: 12px; font-weight: 600; white-space: nowrap; }
.cell-primary { display: block; color: var(--text-primary); font-size: 12px; font-weight: 600; }
.cell-secondary { display: block; margin-top: 3px; color: var(--text-secondary); font-size: 11px; }
.cell-tertiary { display: block; margin-top: 3px; color: var(--text-muted); font-size: 10px; }
.cell-tertiary i { margin-right: 3px; }

.scope-preview span {
    display: block;
    color: #344054;
    font-size: 12px;
    font-weight: 600;
}

.scope-preview small { color: var(--text-muted); font-size: 10px; }

.expiry-permanent {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #16845b;
    font-size: 12px;
    font-weight: 600;
}

.row-action-primary,
.row-action-menu {
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.row-action-primary { padding: 6px 9px; color: var(--primary); }
.row-action-menu { width: 30px; height: 30px; padding: 0; }
.row-action-primary:hover,
.row-action-menu:hover { background: var(--primary-light); color: var(--primary); }

.dropdown-menu {
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(16, 24, 40, 0.12);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 36px;
    border-radius: 7px;
    font-size: 12px;
}

.dropdown-item i { width: 16px; color: #7f8998; }

.workbench-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 62px;
    padding: 12px 18px;
    border-top: 1px solid var(--border-light);
    color: var(--text-secondary);
    font-size: 11px;
}

.pagination-actions { display: flex; gap: 8px; }

.workbench-empty {
    display: flex;
    min-height: 420px;
    padding: 60px 20px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.empty-icon {
    display: grid;
    width: 52px;
    height: 52px;
    margin-bottom: 18px;
    place-items: center;
    border-radius: 14px;
    background: var(--primary-light);
    color: var(--primary);
    font-size: 23px;
}

.workbench-empty h2 { margin: 0 0 8px; font-size: 17px; }
.workbench-empty p { max-width: 360px; margin: 0 0 20px; color: var(--text-secondary); font-size: 12px; }

.auth-detail-drawer { width: min(420px, 100vw) !important; border-left: 1px solid var(--border); }
.auth-detail-drawer .offcanvas-header { min-height: 78px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.drawer-kicker { color: var(--text-muted); font-size: 10px; font-weight: 700; letter-spacing: 0.1em; }
.auth-detail-drawer .offcanvas-title { margin-top: 2px; font-size: 19px; }
.auth-detail-drawer .offcanvas-body { padding: 0; }

.drawer-identity {
    padding: 22px;
    border-bottom: 1px solid var(--border-light);
    background: #fbfcfe;
}

.drawer-project { color: var(--primary); font-size: 11px; font-weight: 700; }
.drawer-identity h3 { margin: 9px 0 6px; font-size: 17px; word-break: break-all; }
.drawer-identity p { margin: 0; color: var(--text-secondary); font-size: 12px; }
.drawer-copy-actions { display: flex; gap: 8px; margin-top: 18px; }

.drawer-copy-actions button {
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #fff;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
}

.drawer-section { padding: 20px 22px; border-bottom: 1px solid var(--border-light); }
.drawer-section h4 { margin: 0 0 15px; font-size: 12px; font-weight: 700; }
.drawer-section label { display: block; margin: 14px 0 6px; color: var(--text-muted); font-size: 10px; font-weight: 600; }

.detail-list { margin: 0; }
.detail-list > div { display: flex; justify-content: space-between; gap: 20px; padding: 9px 0; }
.detail-list dt { color: var(--text-secondary); font-size: 11px; font-weight: 500; }
.detail-list dd { margin: 0; text-align: right; color: var(--text-primary); font-size: 11px; font-weight: 600; }

.limit-strip { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: 10px; }
.limit-strip > div { padding: 14px; }
.limit-strip > div + div { border-left: 1px solid var(--border); }
.limit-strip span { display: block; color: var(--text-muted); font-size: 10px; }
.limit-strip strong { margin-right: 4px; font-size: 22px; }
.limit-strip small { color: var(--text-secondary); }

.detail-tags { display: flex; flex-wrap: wrap; gap: 5px; min-height: 24px; }
.detail-tags .badge,
.detail-tags [class*="badge"] {
    padding: 5px 7px;
    border-radius: 5px;
    background: #f0f3f8 !important;
    color: #536075 !important;
    font-size: 10px;
    font-weight: 600;
}

.detail-remark { margin: 0; color: var(--text-secondary); font-size: 12px; line-height: 1.7; }

.drawer-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    background: #fff;
}

.drawer-footer .btn-primary { margin-left: auto; }
.drawer-delete { width: 38px; height: 38px; border: 0; border-radius: 8px; background: transparent; color: #c4444e; }
.drawer-delete:hover { background: #fff1f2; }

/* Issue / edit page: same visual system, existing behavior unchanged. */
.license-issue-page .page-content { max-width: 1180px; }
.license-issue-page .page-header h1 { font-size: 24px; }
.license-issue-page .card {
    border-color: var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 28px rgba(16, 24, 40, 0.04);
}
.license-issue-page .card:hover { box-shadow: 0 8px 28px rgba(16, 24, 40, 0.04); }
.license-issue-page .card-header { padding: 18px 22px; }
.license-issue-page .card-body { padding: 24px; }
.license-issue-page .auth-form-section-title { color: var(--text-primary); font-size: 12px; letter-spacing: 0; }

@media (max-width: 1100px) {
    .workbench-toolbar { align-items: stretch; flex-direction: column; }
    .toolbar-fields { justify-content: flex-start; }
    .workbench-table { min-width: 980px; }
}

@media (max-width: 768px) {
    .page-content { padding: 20px 16px 36px; }
    .topbar { padding: 0 16px; }
    .topbar-quick-action span { display: none; }
    .workbench-heading h1 { font-size: 22px; }
    .workbench-summary { overflow-x: auto; padding: 0 16px; }
    .summary-item { min-width: 128px; padding: 0 16px; }
    .workbench-toolbar { padding: 12px; }
    .status-tabs { overflow-x: auto; }
    .status-tab { white-space: nowrap; }
    .toolbar-fields { align-items: stretch; flex-direction: column; }
    .workbench-search,
    .toolbar-fields .form-select { width: 100%; }
    .workbench-table-meta span:last-child { display: none; }
    .workbench-table {
        min-width: 0;
        width: 100%;
        table-layout: fixed;
    }
    .workbench-table th:nth-child(3),
    .workbench-table td:nth-child(3),
    .workbench-table th:nth-child(4),
    .workbench-table td:nth-child(4),
    .workbench-table th:nth-child(6),
    .workbench-table td:nth-child(6) {
        display: none;
    }
    .workbench-table th:nth-child(1),
    .workbench-table td:nth-child(1) { width: 66px; }
    .workbench-table th:nth-child(5),
    .workbench-table td:nth-child(5) { width: 92px; }
    .workbench-table th:nth-child(7),
    .workbench-table td:nth-child(7) { width: 70px; }
    .workbench-table .cell-primary,
    .workbench-table .cell-secondary {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .row-action-menu { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
