/* Native cross-page fade (View Transitions API, Chrome/Edge 126+) - a plain
   multi-page app gets a smooth fade between full page loads for free.
   Unsupported browsers just ignore this and navigate as before. */
@view-transition {
    navigation: auto;
}

/* ==========================================================================
   GLOBAL VARIABLES & THEMING (Cyber-Dark & Glow Purple)
   ========================================================================== */
:root {
    --bg-base: #0b0d13;           /* Dark slate black background */
    --bg-surface: #141824;        /* Lighter dark surface for cards/containers */
    --bg-input: #1a1f30;          /* Distinct dark fill for form inputs */

    --accent-primary: #7c3aed;    /* Core vivid purple */
    --accent-secondary: #a855f7;  /* Light violet, used for hover/accent states */

    --text-main: #f8fafc;         /* Bright off-white for high legibility */
    --text-muted: #94a3b8;        /* Slate gray for secondary text */

    /* Status Colors (Optimized for Dark Backgrounds) */
    --success-border: #10b981;
    --success-text: #34d399;
    --success-bg: rgba(16, 185, 129, 0.12);

    --danger-border: #ef4444;
    --danger-text: #f87171;
    --danger-bg: rgba(239, 68, 68, 0.12);

    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;

    --border-color: #262f45;      /* Low-contrast border for clean gridlines */
}

/* Base Body Reset */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

/* Custom Scrollbar for Premium Feel */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-base);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--border-radius-sm);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* ==========================================================================
   NAVIGATION LAYER
   ========================================================================== */
.navbar {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}
.nav-container {
    max-width: 1340px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.navbar h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-main);
    white-space: nowrap;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}
.nav-links a {
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 10px 14px;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ==========================================================================
   LAYOUT CONTAINERS & CARDS
   ========================================================================== */
.admin-container, .dashboard-container {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 24px;
    box-sizing: border-box;
}

.admin-card, .dashboard-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 28px;
    margin-bottom: 32px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}
.admin-card h3, .dashboard-card h3 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.3px;
}
.section-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: -10px;
    margin-bottom: 24px;
}

/* ==========================================================================
   FORMS & INPUT ARCHITECTURE
   ========================================================================== */
.login-form {
    max-width: 100%;
}
/* Admin forms lay out their fields as a responsive grid (same auto-fit
   idiom as .app-grid/.machine-grid) instead of one field per full-width
   row - a 7-field form like "add material" would otherwise be a long
   vertical scroll. */
.admin-form {
    max-width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 4px 20px;
    align-items: start;
}
.admin-form > button {
    grid-column: 1 / -1;
    justify-self: start;
    margin-top: 4px;
}
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}
.admin-form .form-group {
    margin-bottom: 16px;
}
.form-group label {
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-muted);
}
/* Applied globally (not just inside .form-group) so every input/select in
   the app - including the inline per-row edit forms in admin tables - gets
   the same dark theming instead of falling back to the browser's default
   white control. Deliberately doesn't set width/box-sizing here - table-row
   inputs rely on their own (often narrower, e.g. .material-price-input)
   sizing; .form-group below still owns the "full-width form field" look. */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="tel"],
input[type="search"],
textarea,
select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 14px;
    border-radius: var(--border-radius-sm);
    font-size: 0.95rem;
    outline: none;
    box-sizing: border-box;
    font-family: inherit;
    transition: all 0.2s ease;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
}
input:focus, textarea:focus, select:focus {
    border-color: var(--accent-secondary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}
select {
    /* Custom chevron to replace the browser's native (light-themed) arrow,
       which otherwise stays white/light and clashes with the dark fill. */
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}
select option {
    background-color: var(--bg-input);
    color: var(--text-main);
}
/* File pickers otherwise render as an unstyled OS-native control - jarring
   light-gray button against this dark theme. */
input[type="file"] {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-muted);
    padding: 8px;
    font-size: 0.85rem;
    cursor: pointer;
}
input[type="file"]::file-selector-button {
    background-color: var(--accent-primary);
    color: var(--text-main);
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 8px 14px;
    margin-right: 12px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}
input[type="file"]::file-selector-button:hover {
    background-color: var(--accent-secondary);
}
input[type="checkbox"], input[type="radio"] {
    accent-color: var(--accent-primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0;
}
.checkbox-group {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin: 24px 0;
}
.checkbox-group label {
    margin-bottom: 0;
    cursor: pointer;
    text-transform: none;
    letter-spacing: normal;
}

/* ==========================================================================
   BUTTON INTERACTION STATES
   ========================================================================== */
button, .btn {
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
}

.btn-submit, .btn-primary {
    background-color: var(--accent-primary);
    color: var(--text-main);
    padding: 12px 24px;
    border-radius: var(--border-radius-sm);
}
.btn-submit:hover, .btn-primary:hover {
    background-color: var(--accent-secondary);
    transform: translateY(-1px);
}

/* Secondary Button Framework */
.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--text-muted);
}

/* Wiki-style content edit pencil (see partials/editable.html, static/js/inline_edit.js) */
.edit-pencil-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--accent-secondary);
    opacity: 0.85;
    margin-left: 6px;
}
.edit-pencil-btn:hover {
    color: #fff;
    opacity: 1;
}

/* Action Log Deletion Buttons (Red Alert Theme) */
.btn-delete, .btn-logout {
    background-color: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger-text);
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
}
.btn-delete:hover {
    background-color: var(--danger-border);
    color: #ffffff;
    border-color: var(--danger-border);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}
.btn-logout:hover {
    background-color: rgba(239, 68, 68, 0.15);
}

/* ==========================================================================
   TABLES & DATA LAYOUTS
   ========================================================================== */
.table-responsive {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background-color: rgba(0, 0, 0, 0.1);
}
.users-table, .data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.92rem;
}
.users-table th, .data-table th {
    background-color: rgba(255, 255, 255, 0.02);
    padding: 16px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}
.users-table td, .data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
}
.users-table tr:last-child td, .data-table tr:last-child td {
    border-bottom: none;
}
.users-table tr:hover td, .data-table tr:hover td {
    background-color: rgba(255, 255, 255, 0.01);
}
.username-cell strong {
    color: var(--text-main);
}

/* ==========================================================================
   BADGES & UI STATUS ANCHORS
   ========================================================================== */
.badge {
    padding: 4px 12px;
    border-radius: var(--border-radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-block;
}
.badge-admin {
    background-color: rgba(124, 58, 237, 0.15);
    color: #c084fc;
    border: 1px solid rgba(124, 58, 237, 0.3);
}
.badge-user {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}
.badge-worker {
    background-color: rgba(23, 162, 184, 0.15);
    color: #17a2b8;
    border: 1px solid rgba(23, 162, 184, 0.3);
}

/* Session role indicator shown in the navbar (e.g. "СЕСИЯ: АДМИНИСТРАТОР") -
   matches the same pill shape as the .badge classes above, since it's used
   the same way just outside the users table. Color is set inline per use. */
.user-badge {
    padding: 6px 14px;
    border-radius: var(--border-radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-block;
    border: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.03);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Alias for the navbar brand heading - the gradient text styling already
   comes from the ".navbar h2" element selector, this class just exists so
   templates can target the brand text directly if needed later. */
.nav-logo {
    margin: 0;
}
.nav-logo-link {
    text-decoration: none;
    display: block;
}

/* Utility Positioning Hooks */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 0.85rem; }
.no-data { padding: 40px !important; color: var(--text-muted); font-style: italic; }

/* ==========================================================================
   DYNAMIC NOTIFICATION BANNERS (Flashed Alerts)
   ========================================================================== */
.flash-messages {
    margin-bottom: 24px;
    width: 100%;
}
.alert {
    padding: 14px 20px;
    border-radius: var(--border-radius-md);
    margin-bottom: 14px;
    font-size: 0.92rem;
    font-weight: 600;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    animation: slideDownFadeIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Green Status Rulesets */
.alert-success {
    background-color: var(--success-bg);
    color: var(--success-text);
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.05);
}

/* Red Status Rulesets */
.alert-danger {
    background-color: var(--danger-bg);
    color: var(--danger-text);
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.05);
}

/* ==========================================================================
   MODAL FLUIDITY (quick-create modals - order_create.html, product_edit.html,
   admin_delivery_notes.html, detail_dxf_dashboard.html)
   ========================================================================== */
/* These modals are plain `<div id="...Modal" style="display:none">` overlays
   toggled from JS via style.display = 'flex'/'none' (see openQuickXModal()/
   closeQuickXModal() in each template) - not a shared class. Animating on
   the [id$="Modal"] attribute selector means every one of them gets a fade/
   pop-in for free, no JS or template changes needed: switching a child's
   display from none to flex always restarts its CSS animation. */
@keyframes modalOverlayFadeIn {
    from { background-color: rgba(0, 0, 0, 0); }
}
@keyframes modalBoxPopIn {
    from { opacity: 0; transform: translateY(8px) scale(0.97); }
}
div[id$="Modal"] {
    animation: modalOverlayFadeIn 0.2s ease;
}
div[id$="Modal"] > .admin-card {
    animation: modalBoxPopIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Keyframe Render Mechanics */
@keyframes slideDownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   DXF EXTENSION SPECIFIC SECTIONS (Drag & Drop Zone Layouts)
   ========================================================================== */
.upload-dropzone {
    border: 2px dashed var(--border-color);
    padding: 40px 20px;
    border-radius: var(--border-radius-lg);
    text-align: center;
    background-color: rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    cursor: pointer;
}
.upload-dropzone:hover {
    border-color: var(--accent-secondary);
    background-color: rgba(124, 58, 237, 0.02);
}

/* ==========================================================================
   PUBLIC LANDING PAGE (index.html)
   ========================================================================== */

/* Extra nav-bar elements only used on the public landing page: section
   links (placeholders for now) and the login/register call-to-action pair. */
.nav-section-links {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-right: 16px;
    flex-wrap: nowrap;
}
.nav-section-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 600;
    transition: color 0.2s ease;
}
.nav-section-links a:hover {
    color: var(--text-main);
}
/* Small purple divider between each nav item, sitting mid-gap. */
.nav-section-links > *:not(:first-child) {
    position: relative;
}
.nav-section-links > *:not(:first-child)::before {
    content: '';
    position: absolute;
    left: -2px;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 18px;
    background: var(--accent-secondary);
    opacity: 0.4;
}
.nav-cta-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.nav-cta-buttons a {
    text-decoration: none;
    white-space: nowrap;
}

/* Hero / intro strip above the app grid */
.hero-section {
    padding: 56px 0 40px;
    text-align: center;
}
.hero-section h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin: 0 0 12px;
    color: var(--text-main);
}
.hero-section p {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 560px;
    margin: 0 auto;
}

/* App/machine card grid - DMG MORI-style layout: title, short description,
   arrow link, adapted to this project's dark/purple theme instead of a
   white reskin, so it stays visually consistent with the rest of the app. */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    padding-bottom: 64px;
}
.app-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 28px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s ease, transform 0.2s ease;
    text-decoration: none;
    color: inherit;
}
.app-card:hover {
    border-color: var(--accent-secondary);
    transform: translateY(-2px);
}
.app-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius-sm);
    background: rgba(124, 58, 237, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    color: var(--accent-secondary);
}
.app-card h3 {
    margin: 0 0 10px;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--text-main);
}
.app-card p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    flex-grow: 1;
}
.app-card-arrow {
    margin-top: 24px;
    display: inline-flex;
    align-items: center;
    color: var(--accent-secondary);
}
.app-card-arrow svg {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.app-card:hover .app-card-arrow svg {
    transform: translateX(4px);
}
/* ==========================================================================
   NAVBAR DROPDOWN SYSTEM
   ========================================================================== */
.dropdown {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    white-space: nowrap;
}

.dropdown-arrow {
    font-size: 0.65rem;
    transition: transform 0.2s ease;
    color: var(--text-muted);
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    min-width: 220px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    padding: 8px 0;
    margin-top: 8px;
}

/* Pseudo-element to bridge the gap so the hover state doesn't break instantly */
.dropdown-content::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 0;
    width: 100%;
    height: 12px;
}

.dropdown-content a {
    color: var(--text-muted) !important;
    padding: 12px 20px !important;
    text-decoration: none;
    display: block !important;
    transition: all 0.2s ease !important;
    text-align: left;
    border-radius: 0 !important;
    font-weight: 500 !important;
}

.dropdown-content a:hover {
    background-color: var(--bg-input) !important;
    color: var(--text-main) !important;
    padding-left: 24px !important;
}

.dropdown:hover .dropdown-content,
.dropdown:focus-within .dropdown-content {
    display: block;
}

.dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
    color: var(--accent-secondary);
}

/* Grouped variant (see partials/navbar.html's "Управление" menu) - plain
   section labels, not links, to break up a long flat list of pages. */
.dropdown-content-grouped {
    max-height: 80vh;
    overflow-y: auto;
}
.dropdown-group-label {
    padding: 10px 20px 4px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    opacity: 0.7;
}
.dropdown-content-grouped > .dropdown-group-label:first-child {
    padding-top: 4px;
}
.dropdown-home-link {
    font-weight: 700 !important;
    color: var(--text-main) !important;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px !important;
    margin-bottom: 4px;
}

/* ==========================================================================
   PROFESSIONAL CNC MACHINE SHOWCASE CARDS
   ========================================================================== */
.machine-section {
    margin-top: 40px;
    padding-bottom: 80px;
}

.machine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 32px;
    margin-top: 32px;
}

.machine-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.machine-card:hover {
    border-color: var(--accent-secondary);
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(124, 58, 237, 0.15);
}

.machine-img-container {
    width: 100%;
    height: 220px;
    overflow: hidden;
    background-color: var(--bg-base);
    border-bottom: 1px solid var(--border-color);
}

.machine-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.machine-card:hover .machine-img-container img {
    transform: scale(1.04);
    opacity: 1;
}

.machine-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-grow: 1;
}

.machine-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.machine-text {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}
/* ==========================================================================
   DMG MORI INSPIRED MODERN INDUSTRIAL STYLING
   ========================================================================== */

.dmg-container {
    max-width: 1340px;
    margin: 0 auto;
    padding: 40px 24px;
}

/* --- Hero Layout --- */
.dmg-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    padding: 60px 0 80px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.hero-content {
    flex: 1 1 auto;
    min-width: 0;
}

.hero-poster-link {
    flex: 0 0 auto;
    display: block;
}

.hero-poster {
    display: block;
    width: 420px;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
    transition: transform 0.2s ease;
}

.hero-poster-link:hover .hero-poster {
    transform: translateY(-4px);
}

.hero-tag {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--accent-secondary);
    margin-bottom: 16px;
}

.hero-tag span {
    color: var(--text-main);
    background-color: rgba(124, 58, 237, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 4px;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.1;
    color: var(--text-main);
    margin-bottom: 24px;
}

.text-glow {
    color: var(--accent-secondary);
}

.hero-lead {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 720px;
    line-height: 1.7;
    margin-bottom: 48px;
}

/* --- Technical Mini-Metrics --- */
.hero-stats {
    display: flex;
    gap: 60px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-num {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    font-family: monospace;
    border-bottom: 2px solid var(--accent-primary);
    width: fit-content;
    padding-bottom: 2px;
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* --- Showcase Section Structure --- */
.dmg-showcase-section {
    margin-top: 60px;
}

.section-header-dmg {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 40px;
    gap: 20px;
}

.dmg-section-title {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-main);
    margin: 0;
}

.dmg-line-decorative {
    flex-grow: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0.08) 0%, transparent 100%);
    margin-bottom: 8px;
}

/* --- The Machine Cards Grid --- */
.dmg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.dmg-card {
    background-color: var(--bg-surface);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-md); /* Keeps your exact smooth rounding rule */
    padding: 30px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
}

.dmg-card:hover {
    border-color: rgba(168, 85, 247, 0.4);
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 30px rgba(124, 58, 237, 0.05);
}

.dmg-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding-bottom: 14px;
    margin-bottom: 16px;
}

.dmg-card-series {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.dmg-card-num {
    font-size: 0.85rem;
    font-weight: 700;
    font-family: monospace;
    color: rgba(255, 255, 255, 0.2);
}

.dmg-card-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 20px 0;
}

/* --- Rounded Image Mask --- */
.dmg-card-img-wrap {
    width: 100%;
    height: 200px;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    margin-bottom: 24px;
    background-color: var(--bg-base);
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.dmg-card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.75;
    transition: transform 0.5s ease, opacity 0.5s ease;
}

.dmg-card:hover .dmg-card-img-wrap img {
    transform: scale(1.05);
    opacity: 0.95;
}

/* --- Structured Specs Layout --- */
.dmg-card-specs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background-color: rgba(255, 255, 255, 0.02);
    padding: 16px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 20px;
    border-left: 3px solid var(--accent-primary);
}

.spec-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.spec-name {
    color: var(--text-muted);
}

.spec-val {
    color: var(--text-main);
    font-weight: 600;
}

.dmg-card-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

/* --- Site Footer (public marketing pages) --- */
.site-footer {
    border-top: 1px solid var(--border-color);
    margin-top: 60px;
    padding: 48px 24px 24px;
}
.footer-container {
    max-width: 1340px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
}
.footer-col p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.7;
    margin: 6px 0;
}
.footer-col a {
    color: var(--text-muted);
    text-decoration: none;
}
.footer-col a:hover {
    color: var(--accent-secondary);
}
.footer-col-title {
    display: block;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 10px;
}
.footer-bottom {
    max-width: 1340px;
    margin: 40px auto 0;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 0.8rem;
}
@media (max-width: 640px) {
    .footer-container {
        grid-template-columns: 1fr;
    }
}

/* --- Simple content sections (About / Contact pages) --- */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-top: 32px;
}
.info-card {
    background-color: var(--bg-surface);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-md);
    padding: 24px;
}
.info-card h3 {
    margin: 0 0 12px 0;
    color: var(--text-main);
    font-size: 1.05rem;
}
.info-card p, .info-card a {
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.7;
    text-decoration: none;
}
.info-card a:hover {
    color: var(--accent-secondary);
}
.prose p {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.8;
    max-width: 780px;
}
.map-embed {
    width: 100%;
    height: 360px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    margin-top: 32px;
}
.map-embed iframe {
    width: 100%;
    height: 100%;
    border: 0;
}
.competency-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 32px;
}
.competency-item {
    background-color: rgba(255, 255, 255, 0.02);
    border-left: 3px solid var(--accent-primary);
    border-radius: var(--border-radius-sm);
    padding: 16px 20px;
    color: var(--text-main);
    font-size: 0.92rem;
    font-weight: 600;
}

/* Active Link Accent indicator */
.active-nav-link {
    color: var(--text-main) !important;
    position: relative;
}
.active-nav-link::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--accent-secondary);
}

/* ==========================================================================
   RESPONSIVE NAVIGATION (hamburger menu on small screens)
   ========================================================================== */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    padding: 0;
}
.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-main);
    margin: 0 auto;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 640px) {
    .admin-container, .dashboard-container {
        padding: 0 12px;
        margin: 24px auto;
    }
    .admin-card, .dashboard-card {
        padding: 16px;
    }
    .material-price-input {
        width: 80px;
    }
    .users-table th, .data-table th,
    .users-table td, .data-table td {
        padding: 10px;
        font-size: 0.85rem;
    }
}

@media (max-width: 900px) {
    .dmg-hero {
        flex-direction: column;
        align-items: flex-start;
    }
    .hero-poster {
        width: 280px;
    }
    .nav-toggle {
        display: flex;
    }
    .nav-container {
        flex-wrap: wrap;
    }
    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        margin-top: 16px;
        padding-top: 16px;
        border-top: 1px solid var(--border-color);
    }
    .nav-links.open {
        display: flex;
    }
    .nav-section-links {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
        margin-right: 0;
    }
    .nav-section-links > *:not(:first-child)::before {
        display: none;
    }
    .nav-cta-buttons {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .nav-cta-buttons .user-badge {
        text-align: center;
    }
    /* The hover-based dropdown doesn't work on touch devices anyway (see
       :focus-within fallback), and nesting it inside a column-flex mobile
       menu looks broken - just always expand it inline on small screens. */
    .dropdown-content {
        position: static;
        display: block;
        box-shadow: none;
        border: none;
        background: none;
        padding-left: 12px;
        transform: none;
        margin-top: 8px;
    }
    .dropdown-content::before {
        display: none;
    }
}