:root {
    --bg-body: #f8fafc;
    --bg-gradient-start: #f1f5f9;
    --bg-gradient-end: #e2e8f0;

    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-card-hover: rgba(255, 255, 255, 0.95);

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    --border-color: rgba(226, 232, 240, 0.8);
    --border-hover: rgba(203, 213, 225, 1);

    --status-running-bg: #dcfce7;
    --status-running-text: #15803d;
    --status-running-border: #bbf7d0;

    --status-stopped-bg: #fee2e2;
    --status-stopped-text: #b91c1c;
    --status-stopped-border: #fecaca;

    --status-idle-bg: #f1f5f9;
    --status-idle-text: #475569;
    --status-idle-border: #e2e8f0;

    --accent-laser: #0ea5e9;
    --accent-punch: #f59e0b;
}

body {
    background-color: var(--bg-body);
    background-image: radial-gradient(circle at 50% 0%, #ffffff, var(--bg-body));
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
}

/* Bootstrap Overrides for Light Mode */
.text-muted {
    color: var(--text-secondary) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

.bg-light {
    background-color: #ffffff !important;
}

.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header Styling */
.page-header {
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    border: 1px solid var(--border-color);
    padding: 1.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

/* Grid Layout */
.machine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 2rem;
}

/* Card Styling */
.machine-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border-radius: 24px;
    border: 1px solid var(--border-color);
    padding: 1.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.machine-card:hover {
    transform: translateY(-5px);
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
}

/* Top Accent Line */
.machine-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--card-accent), transparent);
    opacity: 0.6;
}

/* Icon & Header */
.machine-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.machine-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    color: var(--card-accent);
    font-size: 1.75rem;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

/* Status Badges */
.status-badge {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.025em;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border: 1px solid transparent;
    text-transform: uppercase;
}

.status-running {
    background-color: var(--status-running-bg);
    color: var(--status-running-text);
    border-color: var(--status-running-border);
}

.status-stopped {
    background-color: var(--status-stopped-bg);
    color: var(--status-stopped-text);
    border-color: var(--status-stopped-border);
}

.status-idle {
    background-color: var(--status-idle-bg);
    color: var(--status-idle-text);
    border-color: var(--status-idle-border);
}

/* Pulse Animation */
.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.5);
    }
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: #f8fafc;
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.stat-item {
    text-align: center;
    position: relative;
}

.stat-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: -0.25rem;
    top: 20%;
    height: 60%;
    width: 1px;
    background: var(--border-color);
}

.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    font-weight: 600;
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

/* Alarm Section */
.alarm-section {
    border-top: 1px solid var(--border-color);
    padding-top: 1.25rem;
    margin-top: auto;
}

.alarm-list {
    max-height: 160px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.alarm-list::-webkit-scrollbar {
    width: 4px;
}

.alarm-list::-webkit-scrollbar-track {
    background: transparent;
}

.alarm-list::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 4px;
}

.alarm-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border: 1px solid transparent;
    gap: 1rem;
    margin-bottom: 0.5rem;
    background: #ffffff;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.alarm-item:hover {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.alarm-text {
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.alarm-time {
    white-space: nowrap;
    font-weight: 600;
    opacity: 0.7;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

/* Utilities */
.text-accent {
    color: var(--card-accent);
}