/* ============================================
   FABLAB ZUG - MAKER STYLE GUI
   Industrial / Workshop Aesthetic
   ============================================ */

/* ---------- CSS Variables (Theme) ---------- */
:root {
    /* Maker palette - dark workshop */
    --bg-primary: #0F1117;
    --bg-secondary: #161922;
    --bg-card: #1C1F2E;
    --bg-card-hover: #242838;
    --bg-input: #12141D;
    --bg-sidebar: #12141D;
    --bg-topbar: #0F1117;

    --text-primary: #E8E9ED;
    --text-secondary: #8B8FA3;
    --text-muted: #5C6078;
    --text-inverse: #0F1117;

    --accent: #F59E0B;
    --accent-hover: #D97706;
    --accent-dim: #F59E0B22;
    --accent-glow: #F59E0B33;

    --border: #2A2D3E;
    --border-hover: #3D4158;
    --border-focus: #F59E0B;

    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 20px var(--accent-glow);

    --sidebar-width: 260px;
    --topbar-height: 60px;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Space Mono', monospace;

    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light theme */
[data-theme="light"] {
    --bg-primary: #F3F4F6;
    --bg-secondary: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-card-hover: #F9FAFB;
    --bg-input: #F3F4F6;
    --bg-sidebar: #FFFFFF;
    --bg-topbar: #FFFFFF;

    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;

    --border: #E5E7EB;
    --border-hover: #D1D5DB;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

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

a {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: 0.92rem;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem;
    outline: none;
    transition: border var(--transition), box-shadow var(--transition);
    width: 100%;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9' fill='none' stroke='%238B8FA3' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.8rem center;
    padding-right: 2.2rem;
}

.hidden { display: none !important; }

/* ---------- Splash Screen ---------- */
.splash {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.splash.fade-out {
    opacity: 0;
    visibility: hidden;
}

.splash-content {
    text-align: center;
}

.gear-icon {
    animation: spin 3s linear infinite;
    margin-bottom: 1.5rem;
    color: var(--accent);
}

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

.splash h1 {
    font-family: var(--font-mono);
    font-size: 2.2rem;
    letter-spacing: 0.15em;
    color: var(--text-primary);
    margin-bottom: 2rem;
}

.splash h1 span {
    color: var(--accent);
}

.splash-bar {
    width: 200px;
    height: 3px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
    margin: 0 auto 1rem;
}

.splash-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 3px;
    animation: loadBar 1.8s ease-in-out forwards;
}

@keyframes loadBar {
    0% { width: 0%; }
    50% { width: 60%; }
    100% { width: 100%; }
}

.splash-text {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

/* ---------- App Layout ---------- */
.app {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: var(--topbar-height) 1fr;
    min-height: 100vh;
}

/* ---------- Top Bar ---------- */
.topbar {
    grid-column: 1 / -1;
    background: var(--bg-topbar);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

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

.sidebar-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
}

.sidebar-toggle span {
    width: 20px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 2px;
    transition: var(--transition);
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.brand-badge {
    width: 36px;
    height: 36px;
    background: var(--accent);
    color: var(--text-inverse);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand-text strong {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.12em;
}

.brand-text span {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--accent);
    letter-spacing: 0.15em;
}

.topbar-center {
    flex: 1;
    max-width: 480px;
    margin: 0 2rem;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 0.8rem;
    color: var(--text-muted);
}

.search-box input {
    padding-left: 2.4rem;
    background: var(--bg-secondary);
    border-color: transparent;
    border-radius: var(--radius-xl);
    font-size: 0.85rem;
}

.search-box input:focus {
    border-color: var(--accent);
    background: var(--bg-card);
}

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

.status-led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 6px var(--success);
    animation: pulse-led 2s ease-in-out infinite;
}

@keyframes pulse-led {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.topbar-btn {
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: var(--transition);
}

.topbar-btn:hover {
    color: var(--accent);
    background: var(--accent-dim);
}

.lang-selector {
    display: flex;
    gap: 2px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.lang-btn {
    padding: 0.25rem 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    border-radius: 4px;
    color: var(--text-muted);
    transition: var(--transition);
}

.lang-btn.active {
    background: var(--accent);
    color: var(--text-inverse);
}

.lang-btn:hover:not(.active) {
    color: var(--text-primary);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.user-menu:hover {
    background: var(--bg-secondary);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

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

.user-dropdown {
    position: absolute;
    top: calc(var(--topbar-height) - 4px);
    right: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 200;
    overflow: hidden;
}

.user-dropdown a {
    display: block;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    transition: var(--transition);
}

.user-dropdown a:hover {
    background: var(--accent-dim);
    color: var(--accent);
}

.user-dropdown hr {
    border: none;
    border-top: 1px solid var(--border);
}

.logout-link { color: var(--danger) !important; }

/* ---------- Sidebar ---------- */
.sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: 1rem 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition);
}

.sidebar-section {
    padding: 0.5rem 0;
}

.sidebar-label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    color: var(--text-muted);
    padding: 0.8rem 1.2rem 0.4rem;
    text-transform: uppercase;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.2rem;
    margin: 1px 0.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--text-secondary);
    transition: var(--transition);
    position: relative;
}

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

.nav-item.active {
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 500;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    bottom: 25%;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}

/* ---------- Nav Group (Accordion Sidebar) ---------- */
.nav-group {
    display: flex;
    flex-direction: column;
}

.nav-parent {
    justify-content: flex-start;
}

.nav-parent .nav-chevron {
    margin-left: auto;
    transition: transform var(--transition);
    opacity: 0.5;
    flex-shrink: 0;
}

.nav-group.open .nav-chevron {
    transform: rotate(180deg);
}

.nav-children {
    display: none;
    flex-direction: column;
    background: rgba(0,0,0,0.15);
}

.nav-group.open .nav-children {
    display: flex;
}

.nav-child {
    padding-left: 2.75rem !important;
    font-size: 0.82rem !important;
}

/* ---------- Responsible Grid (Maschinenkacheln) ---------- */
.resp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.resp-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color var(--transition);
}

.resp-card:hover {
    border-color: var(--border-hover);
}

.resp-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}

.resp-card-header:hover {
    background: var(--bg-card-hover);
}

.resp-card-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.resp-card-header .resp-group {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 400;
}

.resp-card-header .resp-count {
    font-size: 0.72rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 0.1rem 0.45rem;
    border-radius: 99px;
    font-weight: 600;
}

.resp-card-body {
    padding: 0.75rem 1rem;
}

.resp-person {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
}

.resp-person:last-child {
    border-bottom: none;
}

.resp-person-info {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
}

.resp-person-name {
    font-size: 0.85rem;
    font-weight: 500;
}

.resp-person-email {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.resp-empty {
    text-align: center;
    padding: 0.5rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.resp-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.5rem;
    background: none;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: var(--transition);
}

.resp-add-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.nav-badge {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
    background: var(--accent);
    color: var(--text-inverse);
    padding: 0.1rem 0.4rem;
    border-radius: 20px;
    letter-spacing: 0.05em;
    margin-left: auto;
}

.sidebar-footer {
    margin-top: auto;
    padding: 1rem 1.2rem;
    border-top: 1px solid var(--border);
}

.sidebar-version {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

/* ---------- Content Area ---------- */
.content {
    padding: 1.5rem 2rem;
    overflow-y: auto;
    max-height: calc(100vh - var(--topbar-height));
}

/* Pages */
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease; }

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

/* ---------- Welcome Banner ---------- */
.welcome-banner {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-card-hover));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--accent-glow), transparent 70%);
    pointer-events: none;
}

.welcome-text h1 {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.highlight { color: var(--accent); }

.welcome-text p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.welcome-stats {
    display: flex;
    gap: 2.5rem;
    z-index: 1;
}

.quick-stat {
    text-align: center;
}

.stat-value {
    display: block;
    font-family: var(--font-mono);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}

/* ---------- Section Header ---------- */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.section-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
}

.section-actions {
    display: flex;
    gap: 0.4rem;
}

.filter-chip {
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-xl);
    font-size: 0.78rem;
    font-weight: 500;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: var(--transition);
}

.filter-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.filter-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-inverse);
}

/* ---------- Machine Grid ---------- */
.machgroup-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.machgroup-tile {
    position: relative;
    width: 160px;
    height: 120px;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: transform 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
}

.machgroup-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    border-color: var(--accent);
}

.machgroup-tile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.machgroup-tile-placeholder {
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.machgroup-tile-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.4rem 0.6rem;
    background: linear-gradient(transparent, rgba(0,0,0,0.75));
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

.machine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.machine-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}

.machine-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.machine-status {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-xl);
    z-index: 2;
    letter-spacing: 0.02em;
}

.machine-status.online {
    background: #10B98122;
    color: #10B981;
}

.machine-status.busy {
    background: #F59E0B22;
    color: #F59E0B;
}

.machine-status.maintenance {
    background: #EF444422;
    color: #EF4444;
}

.machine-img {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--bg-card-hover), var(--bg-card));
    min-height: 130px;
}

.machine-img-placeholder {
    color: var(--accent);
    opacity: 0.7;
    transition: var(--transition);
}

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

.machine-img-placeholder.resin { color: #8B5CF6; }
.machine-img-placeholder.laser { color: #EF4444; }
.machine-img-placeholder.fiber { color: #3B82F6; }
.machine-img-placeholder.cnc { color: #10B981; }
.machine-img-placeholder.vinyl { color: #EC4899; }
.machine-img-placeholder.copier { color: #6B7280; }
.machine-img-placeholder.sand { color: #D97706; }

.machine-img:has(.machine-img-real) {
    padding: 0;
    overflow: hidden;
}

.machine-img-real {
    width: 100%;
    height: 100%;
    object-fit: cover;
    max-height: 180px;
    min-height: 130px;
    transition: var(--transition);
}

.machine-card:hover .machine-img-real {
    transform: scale(1.05);
}

.machine-info {
    padding: 0.8rem 1.2rem;
}

.machine-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.15rem;
}

.machine-group {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    letter-spacing: 0.03em;
}

.machine-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.meta-item {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.meta-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-muted);
}

.machine-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1.2rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--accent);
    transition: var(--transition);
}

.machine-card:hover .machine-action {
    background: var(--accent-dim);
}

/* ---------- Page Headers ---------- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-header > div {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.page-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
}

.back-btn {
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: var(--transition);
}

.back-btn:hover {
    background: var(--bg-card);
    color: var(--accent);
}

.page-actions {
    display: flex;
    gap: 0.6rem;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.85rem;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: var(--text-inverse);
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-twint {
    background: #00B4E6;
    border: none;
    color: #fff;
    font-weight: 600;
    padding: 0.6rem 1.4rem;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    font-size: 1rem;
}
.btn-twint:hover {
    background: #0099c6;
    color: #fff;
}

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

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

.icon-btn {
    padding: 0.35rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: var(--transition);
}

.icon-btn:hover {
    color: var(--accent);
    background: var(--accent-dim);
}

.icon-btn.danger:hover {
    color: var(--danger);
    background: #EF444422;
}

/* ---------- Cards ---------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.2rem 1.5rem;
}

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

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.card-badge {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-xl);
    background: var(--bg-secondary);
    color: var(--text-muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.card-badge.accent {
    background: var(--accent-dim);
    color: var(--accent);
}

/* ---------- Form Layout ---------- */
.form-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 1.5rem;
    align-items: start;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.input-with-icon {
    position: relative;
}

.input-with-icon svg {
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.input-with-icon input {
    padding-left: 2.3rem;
}

textarea {
    resize: vertical;
    min-height: 70px;
}

.checkbox-label {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text-primary);
    padding: 0.4rem 0;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.radio-group {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    align-items: center;
    white-space: nowrap;
}

/* ---------- Cost Card ---------- */
.cost-card {
    position: sticky;
    top: 1.5rem;
}

.cost-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.cost-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.cost-value {
    font-family: var(--font-mono);
    font-weight: 500;
    color: var(--text-primary);
}

.cost-row.discount .cost-value {
    color: var(--success);
}

.cost-divider {
    height: 1px;
    background: var(--border);
    margin: 0.3rem 0;
}

.cost-row.total {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.cost-row.total .cost-value {
    font-size: 1.2rem;
    color: var(--accent);
}

.cost-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1.2rem;
}

.cost-actions .btn {
    flex: 1;
    justify-content: center;
}

/* ---------- Twint ---------- */
.twint-section {
    text-align: center;
}

.twint-placeholder {
    display: inline-block;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.2rem;
    color: #FFFFFF;
    background: #000000;
    padding: 0.5rem 1.5rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.8rem;
    letter-spacing: 0.1em;
}

.twint-section p {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.twint-min {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.6rem;
    padding: 0.3rem;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}

.info-card {
    margin-top: 1rem;
}

/* ---------- Filter Card ---------- */
.filter-card {
    margin-bottom: 1.2rem;
}

.filter-grid {
    display: flex;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
}

.filter-grid .form-group {
    flex: 1;
    min-width: 150px;
}

.filter-grid .filter-actions {
    flex: 0;
}

/* ---------- Summary Row ---------- */
.summary-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.summary-card.highlight {
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
}

.summary-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.summary-icon.time { background: #3B82F622; color: #3B82F6; }
.summary-icon.machine { background: #F59E0B22; color: #F59E0B; }
.summary-icon.material { background: #10B98122; color: #10B981; }
.summary-icon.total { background: #8B5CF622; color: #8B5CF6; }

.summary-value {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    display: block;
    line-height: 1.2;
}

.summary-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.summary-card.highlight .summary-value {
    color: var(--accent);
}

/* ---------- Data Tables ---------- */
.table-card {
    padding: 0;
    overflow: hidden;
}

.table-filter-bar {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.filter-input {
    width: 100%;
    max-width: 360px;
    padding: 0.4rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
}

.filter-input:focus {
    outline: none;
    border-color: var(--accent);
}

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

.filter-select {
    padding: 0.4rem 0.75rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* ---------- Inline Editing (Labels) ---------- */
.inline-editable {
    cursor: text;
    position: relative;
}

.inline-editable:hover {
    background: rgba(245, 158, 11, 0.06);
}

.inline-editable:hover::after {
    content: '✎';
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    opacity: 0.35;
    pointer-events: none;
}

.inline-edit-input {
    width: 100%;
    padding: 2px 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--accent);
    border-radius: 3px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: inherit;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.inline-edit-input:focus {
    outline: none;
}

.inline-saved {
    background: rgba(16, 185, 129, 0.15) !important;
    transition: background 1.2s ease;
}

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table thead {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.data-table th {
    padding: 0.7rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    white-space: nowrap;
    user-select: none;
}

.data-table th.sortable {
    cursor: pointer;
    transition: var(--transition);
}

.data-table th.sortable:hover {
    color: var(--accent);
}

.data-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table tbody tr {
    transition: var(--transition);
}

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

.data-table .num {
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.83rem;
}

.data-table .bold {
    font-weight: 600;
}

.data-table .discount {
    color: var(--success);
}

.data-table .actions-col {
    text-align: right;
    white-space: nowrap;
}

.user-chip {
    font-size: 0.8rem;
    padding: 0.15rem 0.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
}

.order-num {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
}

.material-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--dot-color);
    margin-right: 0.3rem;
    vertical-align: middle;
}

/* Tags */
.tag {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-xl);
    letter-spacing: 0.02em;
}

.tag-3d { background: #F59E0B22; color: #F59E0B; }
.tag-laser { background: #EF444422; color: #EF4444; }
.tag-cnc { background: #10B98122; color: #10B981; }
.tag-role { background: #3B82F622; color: #3B82F6; }
.tag-team { background: #8B5CF622; color: #8B5CF6; }
.tag-company { background: #EC489922; color: #EC4899; }

.bool-icon {
    font-size: 0.78rem;
}

.bool-icon.false { color: var(--text-muted); }
.bool-icon.true { color: var(--success); }

.status-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-xl);
}

.status-badge.online { background: #10B98122; color: #10B981; }
.status-badge.busy { background: #F59E0B22; color: #F59E0B; }
.status-badge.maintenance { background: #EF444422; color: #EF4444; }
.status-badge.pending { background: #3B82F622; color: #3B82F6; }

/* ---------- Member Grid ---------- */
.member-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1rem;
}

.member-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.2rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: var(--transition);
}

.member-card:hover {
    border-color: var(--border-hover);
}

.member-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.member-info {
    flex: 1;
    min-width: 0;
}

.member-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
}

.member-email {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.member-tags {
    display: flex;
    gap: 0.3rem;
    margin-top: 0.3rem;
}

.member-stats {
    text-align: right;
    font-size: 0.82rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.member-stats strong {
    color: var(--text-primary);
}

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    font-size: 1.4rem;
    color: var(--text-muted);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
}

.modal-footer-right {
    display: flex;
    gap: 0.6rem;
    margin-left: auto;
}

/* Booking success animation */
.success-checkmark {
    margin: 0.5rem auto 0;
}

.success-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: successCircle 0.6s ease forwards;
}

.success-check {
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: successCheck 0.4s 0.4s ease forwards;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@keyframes successCircle {
    to { stroke-dashoffset: 0; }
}

@keyframes successCheck {
    to { stroke-dashoffset: 0; }
}

/* Record detail view */
.detail-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
}

.detail-row.total {
    padding-top: 0.6rem;
    font-size: 1.1em;
}

.detail-label {
    color: var(--text-muted);
    font-size: 0.9em;
}

.detail-value {
    font-weight: 500;
}

.detail-value.bold {
    font-weight: 700;
}

.detail-value.discount {
    color: var(--success);
}

.detail-divider {
    height: 1px;
    background: var(--border);
    margin: 0.3rem 0;
}

/* Clickable table rows */
.clickable-row {
    cursor: pointer;
}

.clickable-row:hover td {
    background: var(--bg-card-hover);
}

/* ---------- Toast ---------- */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-md);
    padding: 0.8rem 1.2rem;
    font-size: 0.88rem;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    max-width: 360px;
}

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

@keyframes fadeOut {
    to { opacity: 0; transform: translateY(10px); }
}

.toast-success {
    border-color: var(--success);
    border-left-color: var(--success);
}

.toast-error {
    border-color: var(--danger);
    border-left-color: var(--danger);
    color: var(--danger);
}

/* ---------- Split View (Master-Detail) ---------- */
.split-view {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1rem;
    height: calc(100vh - var(--topbar-height) - 140px);
    min-height: 500px;
}

.split-master {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.split-master-header {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

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

.split-master-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
    border-left: 3px solid transparent;
}

.split-master-item:hover {
    background: var(--bg-card-hover);
}

.split-master-item.active {
    background: var(--accent-dim);
    border-left-color: var(--accent);
}

.split-master-item .machine-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.split-master-item .machine-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.split-master-item .machine-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.split-master-item .machine-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.maint-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.5rem;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 600;
}

.maint-badge-ok      { background: #10B98118; color: var(--success); }
.maint-badge-warnung { background: #F59E0B18; color: var(--warning); }
.maint-badge-defekt  { background: #EF444418; color: var(--danger); }
.maint-badge-none    { background: var(--bg-secondary); color: var(--text-muted); }

.maint-badge-dot {
    width: 6px; height: 6px; border-radius: 50%;
}
.maint-badge-ok .maint-badge-dot      { background: var(--success); }
.maint-badge-warnung .maint-badge-dot { background: var(--warning); }
.maint-badge-defekt .maint-badge-dot  { background: var(--danger); }
.maint-badge-none .maint-badge-dot    { background: var(--text-muted); }

/* ---------- Autocomplete ---------- */
.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    max-height: 240px;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}

.autocomplete-list:empty {
    display: none;
}

.autocomplete-item {
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: var(--bg-card-hover);
}

.autocomplete-empty {
    color: var(--text-muted);
    font-style: italic;
    cursor: default;
}

.autocomplete-empty:hover {
    background: none;
}

.next-due-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.1rem 0.4rem;
    border-radius: 99px;
    font-size: 0.65rem;
    font-weight: 600;
    border: 1px solid;
    white-space: nowrap;
}

/* Detail Panel */
.split-detail {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow-y: auto;
}

.split-detail-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 1rem;
    padding: 2rem;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.detail-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

.detail-header .detail-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.detail-actions {
    display: flex;
    gap: 0.5rem;
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-bottom: 1px solid var(--border);
}

.stat-box {
    padding: 0.75rem 1rem;
    text-align: center;
    border-right: 1px solid var(--border);
}

.stat-box:last-child {
    border-right: none;
}

.stat-box .stat-value {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-box .stat-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.1rem;
}

/* ---------- Dashboard Maintenance ---------- */
.dashboard-maintenance {
    margin-top: 1.5rem;
}

.dashboard-maint-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--warning);
    margin-bottom: 0.75rem;
}

.dashboard-maint-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}

.dashboard-maint-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    transition: background var(--transition), border-color var(--transition);
}

.dashboard-maint-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.dashboard-maint-name {
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 0.25rem;
}

.dashboard-maint-due {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 600;
}

.dashboard-maint-status {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* ---------- Heatmap ---------- */
.heatmap-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.heatmap-machine {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.heatmap-machine-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

.heatmap-machine-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.heatmap-machine-total {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
}

.heatmap-scroll {
    overflow-x: auto;
    padding: 0.75rem 1rem;
}

.heatmap-machine.heatmap-dragging {
    opacity: 0.4;
}

.heatmap-machine.heatmap-dragover {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.heatmap-svg rect {
    transition: opacity 0.15s;
}

.heatmap-svg rect:hover {
    opacity: 0.75;
    stroke: var(--accent) !important;
    stroke-width: 1.5 !important;
}

.heatmap-legend {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.3rem;
    padding: 0.5rem 0;
}

.heatmap-legend-cell {
    width: 13px;
    height: 13px;
    border-radius: 2px;
    border: 0.5px solid var(--border);
}

/* ---------- Schedule Rules Bar ---------- */
.schedule-rules-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.schedule-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

.schedule-tag:hover {
    border-color: var(--info);
    background: var(--bg-card-hover);
}

.schedule-tag-disabled {
    opacity: 0.4;
}

.schedule-tag-icon {
    font-size: 0.9rem;
}

.schedule-tag-type {
    font-weight: 600;
    color: var(--info);
}

.schedule-tag-interval {
    color: var(--text-secondary);
}

.schedule-tag-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0 0.15rem;
    margin-left: 0.1rem;
    transition: color var(--transition);
}

.schedule-tag-delete:hover {
    color: var(--danger);
}

/* Type tags */
.type-tag {
    display: inline-block;
    padding: 0.12rem 0.45rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .form-layout {
        grid-template-columns: 1fr;
    }
    .form-sidebar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }
    .info-card { margin-top: 0; }
}

@media (max-width: 900px) {
    .split-view {
        grid-template-columns: 1fr;
        height: auto;
    }
    .split-master {
        max-height: 300px;
    }
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .summary-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .welcome-banner {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }
    .welcome-stats {
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .app {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        top: var(--topbar-height);
        left: 0;
        bottom: 0;
        width: var(--sidebar-width);
        z-index: 99;
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: flex;
    }

    .content {
        padding: 1rem;
        max-height: calc(100vh - var(--topbar-height));
    }

    .topbar-center { display: none; }

    .user-name { display: none; }

    .form-layout {
        grid-template-columns: 1fr;
    }

    .form-sidebar {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .summary-row {
        grid-template-columns: 1fr;
    }

    .machine-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .filter-grid {
        flex-direction: column;
    }

}

@media (max-width: 480px) {
    .machine-grid {
        grid-template-columns: 1fr;
    }

    .member-grid {
        grid-template-columns: 1fr;
    }

    .lang-selector { display: none; }
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ---------- Selection ---------- */
::selection {
    background: var(--accent);
    color: var(--text-inverse);
}

/* ---------- Login View ---------- */
.login-view {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
    padding: 1rem;
}

.login-view.hidden { display: none; }

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

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo h1 {
    font-family: var(--font-mono);
    font-size: 1.6rem;
    letter-spacing: 0.15em;
    color: var(--text-primary);
    margin-top: 0.75rem;
}

.login-logo h1 span {
    color: var(--accent);
}

.login-error {
    background: #EF444422;
    color: var(--danger);
    border: 1px solid #EF444444;
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.login-btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

.login-btn-loading { display: inline-flex; align-items: center; gap: 0.5rem; }

.spinner-small {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Guest login */
.login-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.2rem 0 0.8rem;
    color: var(--text-muted);
    font-size: 0.85em;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.guest-login-btn {
    width: 100%;
    padding: 0.75rem;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-flash {
    animation: btnFlash 0.4s ease;
}

@keyframes btnFlash {
    0%   { transform: scale(1); box-shadow: none; }
    50%  { transform: scale(1.04); box-shadow: 0 0 16px var(--accent); }
    100% { transform: scale(1); box-shadow: none; }
}

.login-success {
    animation: loginSuccess 0.5s ease forwards;
}

@keyframes loginSuccess {
    0%   { transform: scale(1); opacity: 1; }
    50%  { transform: scale(1.03); border-color: var(--success); box-shadow: 0 0 24px rgba(34,197,94,0.3); }
    100% { transform: scale(0.97); opacity: 0; }
}

/* ---------- Loading & Empty States ---------- */
.loading-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 1rem;
    font-size: 0.9rem;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 3rem 1rem;
    font-size: 0.95rem;
}

/* ---------- Member Info Bar ---------- */
.member-info-bar {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: var(--accent-dim);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--accent);
    margin-top: 0.25rem;
}

.member-info-bar .tag {
    font-size: 0.7rem;
}

/* ---------- Danger Button ---------- */
.btn-danger {
    background: var(--danger);
    color: white;
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background: #DC2626;
}

/* ---------- Modal Small ---------- */
.modal.modal-sm {
    max-width: 420px;
}

/* ---------- Truncated Text ---------- */
.truncate {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Invoice Print Window Styles ---------- */
.invoice-document {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px;
    color: #1a1a1a;
    background: #fff;
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 3px solid #F59E0B;
}

.invoice-header-left h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: #0F1117;
}

.invoice-header-left p {
    margin: 0;
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
}

.invoice-header-right {
    text-align: right;
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
}

.invoice-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #F59E0B;
    margin: 1.5rem 0;
    letter-spacing: 0.05em;
}

.invoice-meta {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2rem;
}

.invoice-meta-left,
.invoice-meta-right {
    font-size: 0.9rem;
    line-height: 1.8;
}

.invoice-meta-left strong,
.invoice-meta-right strong {
    display: inline-block;
    min-width: 110px;
    color: #333;
}

.invoice-meta-right {
    text-align: right;
    background: #f8f9fa;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    border-left: 3px solid #F59E0B;
}

.invoice-line-items {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.85rem;
}

.invoice-line-items thead th {
    background: #0F1117;
    color: #fff;
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.invoice-line-items thead th.num {
    text-align: right;
}

.invoice-line-items tbody td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.invoice-line-items tbody td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.invoice-line-items tbody tr:nth-child(even) {
    background: #f9fafb;
}

.invoice-totals {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.invoice-totals-box {
    min-width: 280px;
    font-size: 0.9rem;
}

.invoice-totals-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.invoice-totals-row.grand {
    font-weight: 700;
    font-size: 1.1rem;
    border-bottom: 2px solid #0F1117;
    border-top: 2px solid #0F1117;
    padding: 0.6rem 0;
    margin-top: 0.5rem;
}

.invoice-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    font-size: 0.85rem;
    color: #666;
    text-align: center;
}

/* ---------- Print ---------- */
@media print {
    .sidebar, .topbar, .page-actions { display: none !important; }
    .content { padding: 0; max-height: none; }
    .app { display: block; }
    .card { break-inside: avoid; border: 1px solid #ccc; }

    /* Invoice print window */
    .invoice-document {
        padding: 0;
        max-width: 100%;
    }
    .invoice-header {
        border-bottom-color: #F59E0B;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .invoice-line-items thead th {
        background: #0F1117 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .invoice-line-items tbody tr:nth-child(even) {
        background: #f9fafb !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .invoice-meta-right {
        background: #f8f9fa !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
