/* ===== CSS Variables ===== */
:root {
    --bg-primary: #0f0f14;
    --bg-secondary: #1a1a24;
    --bg-card: #22222e;
    --bg-hover: #2a2a3a;
    --accent: #ff6b35;
    --accent-hover: #ff8555;
    --accent-glow: rgba(255, 107, 53, 0.3);
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b7b;
    --border: #333344;
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #f87171;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --glass: rgba(34, 34, 46, 0.7);
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s ease;
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== Layout ===== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
}

.logo-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #ff9966);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-menu {
    flex: 1;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    width: 100%;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--accent), #ff8855);
    color: white;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.nav-icon {
    font-size: 1.2rem;
}

/* ===== Top Bar ===== */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 32px;
    background: rgba(26, 26, 46, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    margin: -32px -32px 32px -32px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.top-bar-center {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 20px;
    overflow: hidden;
}

.stock-ticker {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    animation: tickerPulse 2s infinite ease-in-out;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: var(--transition);
    min-width: 250px;
    justify-content: center;
}

.stock-ticker .ticker-content {
    display: inline-block;
    margin-left: 8px;
}

.stock-ticker:hover {
    background: rgba(255, 71, 87, 0.2);
    transform: scale(1.02);
}

.stock-ticker::before {
    content: '⚠️ Kritik Stok:';
    font-weight: 800;
}

@keyframes tickerPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(255, 71, 87, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0);
    }
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-details {
    text-align: right;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 32px;
    background: var(--bg-primary);
    min-height: 100vh;
}

.content-section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.content-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    margin-bottom: 24px;
    display: none;
    /* Hidden as titles moved to top-bar */
}

.date-display {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ===== Filter Indicator ===== */
.header-with-filter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.filter-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--accent);
    animation: fadeIn 0.3s ease;
}

.filter-badge {
    background: var(--accent);
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.btn-text-only {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-text-only:hover {
    color: var(--accent);
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--accent);
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 24px;
    box-shadow: var(--shadow);
}

.stat-icon {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--bg-hover), var(--bg-card));
    padding: 16px;
    border-radius: var(--radius-md);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== Recent Activity ===== */
.recent-activity h2 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.activity-list {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
}

.activity-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-item:hover {
    background: var(--bg-hover);
}

.activity-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.activity-customer {
    font-weight: 600;
    color: var(--text-primary);
}

.activity-service {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.activity-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.empty-message {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
}

/* ===== Search Box ===== */
.search-box {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
}

.search-box input {
    flex: 1;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

/* ===== Buttons ===== */
.btn-primary {
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--accent), #ff8855);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--accent-glow);
}

.btn-secondary {
    padding: 16px 32px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ===== Form Styles ===== */
.record-form {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    max-width: 800px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-group label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 14px 16px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.form-group select {
    cursor: pointer;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    grid-column: span 2;
    display: flex;
    gap: 16px;
    margin-top: 16px;
}

/* ===== Records Table Styles ===== */
.records-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.records-search-box {
    display: flex;
    gap: 10px;
    flex: 1;
    max-width: 600px;
}

.records-search-box input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
}

.records-search-box input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.records-search-box .btn-primary {
    padding: 12px 24px;
    font-size: 0.95rem;
}

.records-table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    overflow-x: auto;
}

.records-table {
    width: 100%;
    border-collapse: collapse;
}

/* Compact Table Style */
.records-table.compact th,
.records-table.compact td {
    padding: 10px 16px;
    font-size: 0.9rem;
}

.records-table.compact .btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

/* Compact Table Style */
.records-table.compact th,
.records-table.compact td {
    padding: 10px 16px;
    font-size: 0.9rem;
}

.records-table.compact .btn-small {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.records-table th,
.records-table td {
    padding: 16px 20px;
    text-align: left;
}

.records-table th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.records-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.records-table tbody tr:last-child {
    border-bottom: none;
}

.records-table tbody tr:hover {
    background: var(--bg-hover);
}

.records-table td {
    color: var(--text-primary);
}

.btn-view {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid var(--accent);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-view:hover {
    background: var(--accent);
    color: white;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    transition: var(--transition);
    z-index: 10;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-header {
    position: relative;
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
}

.modal-header h2 {
    font-size: 1.5rem;
}

.customer-code-badge {
    background: var(--accent);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
}

.customer-info-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.info-item {
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.info-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.info-value {
    font-weight: 600;
    color: var(--text-primary);
}

.service-history h3 {
    font-size: 1.1rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
}

.history-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.history-type {
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 4px;
}

.history-notes {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ===== Search Results ===== */
.search-results {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
    cursor: pointer;
}

.result-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.result-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.result-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.result-details {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        width: 80px;
    }

    .logo-text,
    .nav-label {
        display: none;
    }

    .logo {
        justify-content: center;
        padding: 20px;
    }

    .nav-item {
        justify-content: center;
        padding: 14px;
    }

    .main-content {
        margin-left: 80px;
        padding: 20px;
    }

    .record-form {
        grid-template-columns: 1fr;
    }

    .form-group.full-width {
        grid-column: span 1;
    }

    .form-actions {
        grid-column: span 1;
        flex-direction: column;
    }

    .customer-info-grid {
        grid-template-columns: 1fr 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .modal-tabs {
        flex-wrap: wrap;
    }

    .modal-tab {
        flex: 1;
        min-width: 100px;
    }
}

/* ===== Large Modal ===== */
.modal.modal-large {
    max-width: 800px;
}

/* ===== Modal Tabs ===== */
.modal-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}

.modal-tab {
    flex: 1;
    padding: 16px 20px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-bottom: 3px solid transparent;
}

.modal-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: var(--bg-secondary);
}

.modal-tab span {
    font-size: 1.1rem;
}

/* ===== Modal Tab Content ===== */
.modal-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.modal-tab-content.active {
    display: block;
}

/* ===== Customer Stats ===== */
.customer-stats {
    margin-top: 24px;
}

.customer-stats h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.customer-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.mini-stat {
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    text-align: center;
}

.mini-stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
}

.mini-stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== Modal Form ===== */
.modal-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ===== Materials & Operations ===== */
.materials-container,
.operations-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.material-row,
.operation-row {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr 1fr auto;
    gap: 6px;
    align-items: center;
}

.operation-row {
    grid-template-columns: 3fr 1fr auto;
}

.material-row input,
.material-row select,
.operation-row input {
    padding: 8px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.78rem;
    min-width: 0;
}

.material-row select {
    cursor: pointer;
    appearance: auto;
}

.material-row input:focus,
.material-row select:focus,
.operation-row input:focus {
    outline: none;
    border-color: var(--accent);
}

.btn-remove-material,
.btn-remove-operation {
    width: 30px;
    height: 30px;
    min-width: 30px;
    background: var(--danger);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-remove-material:hover,
.btn-remove-operation:hover {
    background: #ef4444;
    transform: scale(1.1);
}

.btn-add-material,
.btn-add-operation {
    padding: 10px 16px;
    background: transparent;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-add-material:hover,
.btn-add-operation:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(255, 107, 53, 0.1);
}

/* ===== Form Total ===== */
.form-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.total-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

/* ===== History Filter ===== */
.history-filter {
    margin-bottom: 16px;
}

.history-filter select {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
}

/* ===== Enhanced History Item ===== */
.history-item {
    background: var(--bg-card);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    cursor: pointer;
    transition: var(--transition);
}

.history-item:hover {
    background: var(--bg-hover);
    border-left-color: var(--accent-hover);
    transform: translateX(4px);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.history-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.history-km {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    padding: 2px 8px;
    border-radius: 4px;
}

.history-total {
    font-weight: 600;
    color: var(--success);
    font-size: 0.9rem;
}

/* ===== Status Badges ===== */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.pending {
    background: rgba(251, 191, 36, 0.2);
    color: var(--warning);
}

.status-badge.in-progress {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.status-badge.completed {
    background: rgba(74, 222, 128, 0.2);
    color: var(--success);
}

/* ===== Service Detail Modal ===== */
.service-date-badge {
    background: var(--bg-card);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.service-detail-info {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-muted);
}

.detail-value {
    font-weight: 500;
    color: var(--text-primary);
}

.service-detail-section {
    margin-bottom: 24px;
}

.service-detail-section h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.materials-list,
.operations-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.material-item,
.operation-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.material-name,
.operation-name {
    color: var(--text-primary);
}

.material-details,
.operation-price {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.service-notes-text {
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-style: italic;
}

/* ===== Total Breakdown ===== */
.service-total-section {
    margin-bottom: 24px;
}

.total-breakdown {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--border);
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    color: var(--text-secondary);
}

.breakdown-row.total {
    border-top: 2px solid var(--border);
    margin-top: 8px;
    padding-top: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
}

/* ===== Service Actions ===== */
.service-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-danger {
    padding: 12px 24px;
    background: var(--danger);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-danger:hover {
    background: #ef4444;
    transform: translateY(-2px);
}

.service-actions .btn-primary,
.service-actions .btn-secondary {
    padding: 12px 24px;
    font-size: 0.9rem;
}

/* ===== Navigation Divider ===== */
.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
}

/* ===== Stock Management ===== */
.stock-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: center;
}

.stock-search input {
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    width: 300px;
    font-size: 0.95rem;
}

.stock-search input:focus {
    outline: none;
    border-color: var(--accent);
}

.stock-alerts {
    margin-bottom: 20px;
}

.stock-alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid var(--warning);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    color: var(--warning);
}

.stock-table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    overflow-x: auto;
    /* Mobil uyumluluk */
}

.stock-table {
    width: 100%;
    border-collapse: collapse;
}

.stock-table th,
.stock-table td {
    padding: 14px 20px;
    text-align: left;
}

.stock-table th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.stock-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.stock-table tbody tr:hover {
    background: var(--bg-hover);
}

.stock-low {
    color: var(--danger);
    font-weight: 600;
}

.stock-ok {
    color: var(--success);
}

.stock-actions-cell {
    display: flex;
    gap: 8px;
}

.btn-stock-edit,
.btn-stock-add,
.btn-stock-remove {
    padding: 6px 12px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-stock-edit {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.btn-stock-edit:hover {
    background: var(--accent);
    color: white;
}

.btn-stock-add {
    background: rgba(74, 222, 128, 0.2);
    color: var(--success);
}

.btn-stock-add:hover {
    background: var(--success);
    color: white;
}

.btn-stock-remove {
    background: rgba(248, 113, 113, 0.2);
    color: var(--danger);
}

.btn-stock-remove:hover {
    background: var(--danger);
    color: white;
}

/* ===== Reports ===== */
.report-period {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.report-period label {
    color: var(--text-secondary);
}

.report-period select {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    cursor: pointer;
}

.report-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.report-card {
    background: var(--glass);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.report-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    border-color: var(--accent);
}

.report-icon {
    font-size: 2rem;
    background: linear-gradient(135deg, var(--bg-hover), var(--bg-card));
    padding: 14px;
    border-radius: var(--radius-md);
}

.report-info {
    display: flex;
    flex-direction: column;
}

.report-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.report-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.report-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 24px;
}

.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.chart-container h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1rem;
}

.chart-bars {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chart-bar-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chart-bar-label {
    width: 120px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: right;
}

.chart-bar-container {
    flex: 1;
    height: 28px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.chart-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #ff9966);
    border-radius: var(--radius-sm);
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ===== Reminders ===== */
.reminder-settings {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 24px;
}

.reminder-setting {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.reminder-setting label {
    color: var(--text-secondary);
}

.reminder-setting input {
    width: 80px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    text-align: center;
}

.reminder-setting span {
    color: var(--text-muted);
}

.reminder-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.reminder-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--warning);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.reminder-info h4 {
    color: var(--text-primary);
    margin-bottom: 4px;
}

.reminder-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.reminder-meta {
    display: flex;
    align-items: center;
    gap: 16px;
}

.reminder-days {
    background: var(--warning);
    color: #1a1a24;
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
}

.reminder-due {
    background: var(--danger);
}

/* ===== Settings ===== */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.settings-card h3 {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-form .btn-primary {
    margin-top: 8px;
    padding: 12px 24px;
}

.data-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.data-actions .btn-secondary,
.data-actions .btn-danger {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
}

.import-label {
    display: flex !important;
    cursor: pointer;
}

/* ===== Print Preview ===== */
.print-preview {
    background: white;
    color: #1a1a1a;
    padding: 40px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-family: 'Inter', sans-serif;
}

.print-header {
    text-align: center;
    border-bottom: 2px solid #333;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.print-header h1 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 4px;
}

.print-header p {
    color: #666;
    font-size: 0.9rem;
}

.print-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.print-info-block h3 {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.print-info-block p {
    color: #333;
    margin-bottom: 4px;
}

.print-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.print-table th,
.print-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
    color: #1a1a1a !important;
    /* Explicitly set color for table cells */
}

.print-table th {
    background: #f5f5f5;
    font-weight: 600;
    color: #333;
}

.print-table .text-right {
    text-align: right;
    color: #1a1a1a !important;
}

.print-totals {
    text-align: right;
    border-top: 2px solid #333;
    padding-top: 16px;
}

.print-totals p {
    margin-bottom: 4px;
    color: #666;
}

.print-totals .grand-total {
    font-size: 1.25rem;
    font-weight: 700;
    color: #333;
}

.print-footer {
    text-align: center;
    color: #999;
    font-size: 0.8rem;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.print-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

@media print {
    body * {
        visibility: hidden;
    }

    .print-preview,
    .print-preview * {
        visibility: visible;
    }

    .print-preview {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        padding: 20px;
        background: white !important;
        color: #1a1a1a !important;
    }

    .print-preview * {
        color: #1a1a1a !important;
        background: transparent !important;
    }

    .print-table th {
        background: #f5f5f5 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ===== Maintenance Schedule ===== */
.schedule-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.schedule-form-container h3,
.schedule-list-container h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.schedule-item {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.schedule-item:hover {
    transform: translateX(4px);
    border-color: var(--accent);
}

.schedule-item-info h4 {
    font-size: 0.95rem;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.schedule-item-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.schedule-item-info .schedule-meta {
    margin-top: 4px;
    font-weight: 600;
    color: var(--warning);
}

.schedule-item-actions {
    display: flex;
    gap: 8px;
}

.btn-schedule-done {
    background: rgba(74, 222, 128, 0.2);
    color: var(--success);
    border: none;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
}

.btn-schedule-done:hover {
    background: var(--success);
    color: white;
}

.btn-schedule-delete {
    background: rgba(248, 113, 113, 0.2);
    color: var(--danger);
    border: none;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    transition: var(--transition);
}

.btn-schedule-delete:hover {
    background: var(--danger);
    color: white;
}

@media (max-width: 768px) {
    .schedule-container {
        grid-template-columns: 1fr;
    }
}

/* Dashboard Reminder Badges */
.badge-type {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: middle;
}

.reminder-item.reminder-manual {
    border-left: 4px solid var(--warning);
}

.reminder-manual .badge-type {
    background: rgba(251, 191, 36, 0.2);
    color: var(--warning);
}

.reminder-item .badge-type {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent);
}

/* ===== Login Screen ===== */
.login-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.login-container {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.login-logo {
    margin-bottom: 32px;
}

.login-logo-icon {
    font-size: 3rem;
    margin-bottom: 8px;
    filter: drop-shadow(0 0 10px var(--accent));
}

.login-logo h1 {
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.login-form .form-group {
    text-align: left;
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.login-form input {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 1rem;
    transition: var(--transition);
}

.login-form input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.btn-login {
    width: 100%;
    background: var(--accent);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-login:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.4);
}

.login-error {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 20px;
    display: none;
    /* Shown via JS */
}

.forgot-password {
    display: block;
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-decoration: none;
    transition: var(--transition);
}

.forgot-password:hover {
    color: var(--accent);
}

.login-footer {
    margin-top: 32px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 20px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* User Profile in Top Bar */
.user-name {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.user-role {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.btn-logout {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-logout:hover {
    background: #ef4444;
    color: white;
}

/* Loader Animation */
.btn-loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Stock Ticker Styles */
.stock-ticker {
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    animation: tickerPulse 2s infinite ease-in-out;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.stock-ticker:hover {
    background: rgba(255, 71, 87, 0.2);
    transform: scale(1.02);
}

.stock-ticker::before {
    content: '⚠️ Kritik Stok:';
    opacity: 0.8;
}

@keyframes tickerPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(255, 71, 87, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0);
    }
}

/* Notification System */
#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification {
    background: var(--surface);
    color: var(--text-main);
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-left: 4px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 250px;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.notification.active {
    transform: translateX(0);
}

.notification.success {
    border-left-color: var(--success);
}

.notification.danger {
    border-left-color: var(--danger);
}

.notification.warning {
    border-left-color: var(--warning);
}

.notification.info {
    border-left-color: var(--primary);
}

/* Modern Expertise Table Styles */
#expertise .section-actions {
    margin-bottom: 25px;
}

.modern-row td {
    padding: 16px 12px !important;
    vertical-align: middle;
}

.file-no {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent);
    font-weight: 600;
}

.vehicle-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.plate-badge {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    width: fit-content;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.model-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.expert-info {
    display: flex;
    flex-direction: column;
}

.expert-info strong {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.expert-info span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.date-cell {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Action Buttons */
.btn-action-view,
.btn-action-delete {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-action-view:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.btn-action-delete:hover {
    background: var(--danger);
    border-color: var(--danger);
    transform: translateY(-2px);
}

/* Ensure the Expertise table header is clean */
#expertise table.data-table thead th {
    background: rgba(255, 255, 255, 0.02);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    padding: 15px 12px;
}

/* Stock Brand Badges */
.brand-tag {
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid rgba(0, 150, 255, 0.2);
}

/* New styling for material selection */
/* Material Row Styling */
.material-row {
    display: grid;
    grid-template-columns: 1.5fr 2fr 0.5fr 0.8fr auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.material-brand,
.material-name {
    width: 100%;
    padding: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    height: 42px;
    /* Fixed height for consistency */
}

/* Ensure placeholder/default options look correct */
.material-brand option,
.material-name option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.material-qty,
.material-price {
    height: 42px;
}

.btn-remove-material {
    height: 42px;
    width: 32px;
    border-radius: var(--radius-sm);
}

/* Mobile responsive */
@media (max-width: 600px) {
    .material-row {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 10px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 8px;
    }
}


/* ===== Compact Stock Accordion UI ===== */
.stock-view-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 10px 0;
}

.brand-group {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition);
}

.brand-group.active {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
}

.brand-header {
    background: var(--bg-secondary);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

.brand-header:hover {
    background: var(--bg-hover);
}

.brand-header h2 {
    font-size: 1.1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.brand-header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.brand-stats {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 10px;
    border-radius: 12px;
}

.brand-arrow {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.brand-group.active .brand-arrow {
    transform: rotate(180deg);
}

.brand-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease;
    background: var(--bg-card);
}

.brand-group.active .brand-content {
    max-height: 2000px;
    /* Large enough for many products */
}

/* Compact Table inside Accordion */
.stock-compact-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.stock-compact-table th {
    text-align: left;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.stock-compact-table td {
    padding: 10px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.stock-compact-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.compact-category {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
}

.compact-stock-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
}

.compact-stock-badge.low {
    background: rgba(248, 113, 113, 0.1);
    color: var(--danger);
}

.compact-stock-badge.ok {
    background: rgba(74, 222, 128, 0.1);
    color: var(--success);
}

.compact-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.compact-actions button {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.compact-actions .btn-edit {
    width: auto;
    padding: 0 10px;
    font-size: 0.75rem;
}

.compact-actions button:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.compact-actions .btn-add:hover {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.compact-actions .btn-remove:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.compact-actions .btn-edit:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ===== Modern Section Headers ===== */
.section-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.section-search input {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    width: 320px;
    font-size: 0.9rem;
    transition: var(--transition);
}

.section-search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255, 107, 69, 0.1);
}

/* Role Groups (Based on Brand Groups) */
/* Role Groups - Static Layout */
.role-group {
    background: var(--glass);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.role-header {
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--border);
}

.role-header h2 {
    font-size: 0.95rem;
    margin: 0;
    font-weight: 600;
    color: var(--accent);
}

.role-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.role-stats {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 10px;
}

.role-arrow {
    display: none;
}

.role-content {
    background: var(--bg-card);
    display: block !important;
}



.user-compact-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.user-compact-table th {
    text-align: left;
    padding: 10px 24px;
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.user-compact-table td {
    padding: 12px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
}

.user-compact-table tr:last-child td {
    border-bottom: none;
}

.user-compact-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.badge-system {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-super {
    background: rgba(255, 107, 69, 0.1);
    color: var(--accent);
    border: 1px solid rgba(255, 107, 69, 0.2);
}

.badge-firm {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-personnel {
    background: rgba(156, 163, 175, 0.1);
    color: #9ca3af;
    border: 1px solid rgba(156, 163, 175, 0.2);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner-container {
    text-align: center;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ===== Diagnostic Console ===== */
.debug-console {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 400px;
    height: 300px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--accent);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    z-index: 10000;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.debug-header {
    background: var(--accent);
    color: white;
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 11px 11px 0 0;
}

.debug-logs {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #cbd5e1;
    scroll-behavior: smooth;
}

.debug-line {
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 2px;
    word-break: break-all;
}

.debug-line.error {
    color: #f87171;
}

.debug-line.success {
    color: #4ade80;
}

.debug-line.info {
    color: #60a5fa;
}

.btn-debug-action {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    margin-left: 4px;
}

.btn-debug-action:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-toggle-debug {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-size: 1.2rem;
    transition: transform 0.2s;
}

.btn-toggle-debug:hover {
    transform: scale(1.1);
}

/* ===== Custom Branding & Sidebar Customization ===== */
.user-custom-logo-container {
    padding: 15px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.user-logo {
    max-width: 100%;
    max-height: 80px;
    object-fit: contain;
}

.sidebar-footer-logo {
    margin-top: auto;
    padding: 20px;
    border-top: 1px solid var(--border);
}

.logo-small {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.7;
}

.logo-icon-small {
    font-size: 1.2rem;
}

.logo-text-small {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ===== License Management UI ===== */
.row-warning {
    background-color: rgba(251, 191, 36, 0.1) !important;
}

.row-danger {
    background-color: rgba(248, 113, 113, 0.1) !important;
}

.badge-warning {
    background: #fbbf24;
    color: #000;
}

.badge-danger {
    background: #f87171;
    color: #fff;
}

/* Admin Only visibility helper */
.admin-only {
    /* controlled by JS, but default to flex if shown */
    display: none;
}

/* User Logo Gallery */
.user-logo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.logo-card {
    background: var(--bg-card);
    border-radius: 10px;
    padding: 0.75rem;
    text-align: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
}

.logo-preview-box {
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    overflow: hidden;
    border: 2px dashed rgba(255, 255, 255, 0.05);
}

.logo-preview-box img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
}

.logo-card-name {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.1rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.logo-card-username {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.logo-card-actions {
    margin-top: auto;
    width: 100%;
}

.btn-logo-edit {
    width: 100%;
    padding: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logo-edit:hover {
    background: var(--accent);
    color: white;
}

/* Modal Logo Preview */
.logo-preview-area {
    margin: 15px 0;
    width: 100%;
    height: 100px;
    background: rgba(0, 0, 0, 0.2);
    border: 2px dashed var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.logo-preview-area img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

/* User Profile Image fix */
.user-logo {
    max-width: 100%;
    max-height: 40px;
    object-fit: contain;
}

/* ===== Service Photo Upload ===== */
.photo-upload-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 8px;
}

.photo-upload-section h4 {
    margin-bottom: 4px;
    font-size: 1rem;
}

.photo-upload-area {
    margin-bottom: 12px;
}

.photo-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px 16px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-secondary);
    text-align: center;
}

.photo-upload-label:hover {
    border-color: var(--accent);
    background: rgba(255, 107, 53, 0.05);
    color: var(--accent);
}

.upload-icon {
    font-size: 2rem;
}

.upload-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Photo Preview Grid (in upload modal) */
.photo-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
}

.photo-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}

.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 22px;
    height: 22px;
    background: rgba(248, 113, 113, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.photo-preview-remove:hover {
    background: var(--danger);
    transform: scale(1.1);
}

/* Photo Upload Progress */
.photo-upload-progress {
    margin-top: 12px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-hover);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #ff8855);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== Service Photos Gallery (in detail modal) ===== */
.service-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.service-photo-thumb {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.service-photo-thumb:hover {
    border-color: var(--accent);
    transform: scale(1.05);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.service-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== Photo Lightbox ===== */
.photo-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 2.5rem;
    cursor: pointer;
    padding: 4px 14px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    z-index: 2001;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--danger);
}

.lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

@media (max-width: 768px) {

    /* Layout & Sidebar */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        padding: 16px !important;
    }

    .top-bar {
        margin: -16px -16px 20px -16px !important;
        padding: 10px 16px !important;
    }

    /* Hamburger Menu Button */
    .mobile-menu-toggle {
        display: flex !important;
        flex-direction: column;
        justify-content: space-between;
        width: 30px;
        height: 20px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
        margin-right: 15px;
        z-index: 1001;
    }

    .mobile-menu-toggle span {
        width: 100%;
        height: 3px;
        background-color: var(--text-primary);
        border-radius: 2px;
        transition: var(--transition);
    }

    /* Sidebar Overlay */
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(4px);
        z-index: 99;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    .stat-card {
        padding: 16px !important;
    }

    .stat-value {
        font-size: 1.5rem !important;
    }

    /* Top Bar Elements */
    #page-title {
        font-size: 1.2rem !important;
    }

    .top-bar-center {
        display: none !important;
        /* Hide ticker on very small screens or adjust */
    }

    .user-profile .user-details {
        display: none !important;
    }

    /* Forms & Modals */
    .record-form,
    .customer-info-grid,
    .form-row {
        grid-template-columns: 1fr !important;
    }

    .modal {
        width: 95% !important;
        padding: 10px !important;
    }

    .modal-body {
        padding: 16px !important;
    }

    /* Tables */
    .records-table-container {
        border-radius: var(--radius-md);
        box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.2);
    }

    .records-table th,
    .records-table td {
        padding: 12px 10px !important;
        font-size: 0.85rem !important;
        white-space: nowrap;
    }
}

/* Base style for toggle button (hidden on desktop) */
.mobile-menu-toggle {
    display: none;
}


.history-item {
    cursor: pointer;
    transition: var(--transition);
}

.history-item:hover {
    background: var(--bg-hover) !important;
    transform: translateX(4px);
    border-color: var(--accent) !important;
}