/*
 * APeX – Globus Drahtseil GmbH & Co. KG
 * Haupt-Stylesheet
 */

/* ═══════════════════════════════════════════════════════════
   0. RESET & BASIS
   ═══════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
    font-family: system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
    font-size: 13px;
    color: #1e293b;
    background-color: #f1f5f9;
    min-height: 100%;
}

/* ═══════════════════════════════════════════════════════════
   1. LAYOUT-WRAPPER  #inhalt
   ═══════════════════════════════════════════════════════════ */
#inhalt {
    display: grid;
    grid-template-areas:
        "nav     nav"
        "aside   article"
        "footer  footer";
    grid-template-columns: var(--apex-sidebar-w, 168px) 1fr;
    grid-template-rows: auto 1fr auto;
    min-height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
    padding: 12px;
    gap: 8px;
}

/* ═══════════════════════════════════════════════════════════
   2. NAV
   ═══════════════════════════════════════════════════════════ */
nav {
    grid-area: nav;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--apex-color-nav, #1e293b);
    border-radius: 10px;
    padding: 0 20px;
    height: 64px;
    gap: 16px;
}
#apex-nav-brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
#apex-nav-logo  { height: 38px; width: auto; border-radius: 4px; object-fit: contain; background: #fff; padding: 3px 6px; }
#apex-nav-title { line-height: 1.2; }
#apex-nav-title .apex-product { font-size: 15px; font-weight: 600; color: #f1f5f9; letter-spacing: 0.3px; }
#apex-nav-title .apex-company { font-size: 11px; color: #94a3b8; margin-top: 1px; }
#menu_top { flex: 1; min-width: 0; }
#menu_top table { background: transparent !important; width: 100%; }
#menu_top td    { background: transparent !important; color: #e2e8f0; font-size: 12px; padding: 0; vertical-align: middle; }
#menu_top img:first-child { display: none; }
#menu_top td:last-child   { text-align: right; }
nav input { border-radius: 6px; border: 1px solid #475569; background: #334155; color: #e2e8f0; font-size: 13px; padding: 5px 10px; box-shadow: none; width: auto; }
nav input:focus { outline: 2px solid var(--apex-color-accent, #EFA601); outline-offset: 1px; }

/* Buttons in nav (LAM, Neu, Druck, Übersicht) */
input.apex-nav-btn,
nav input.apex-nav-btn {
    background: rgba(255,255,255,0.12) !important;
    border: 1px solid rgba(255,255,255,0.25) !important;
    border-radius: 6px !important;
    color: #e2e8f0 !important;
    font-size: 12px !important;
    padding: 5px 12px !important;
    cursor: pointer !important;
    box-shadow: none !important;
    transition: background 0.12s !important;
    width: auto !important;
}
input.apex-nav-btn:hover,
nav input.apex-nav-btn:hover {
    background: rgba(255,255,255,0.22) !important;
    color: #ffffff !important;
}

/* ═══════════════════════════════════════════════════════════
   3. ASIDE (Sidebar)
   ═══════════════════════════════════════════════════════════ */
aside {
    grid-area: aside;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: static;
    width: auto;
    min-height: 0;
}
aside table { background: transparent !important; width: 100%; border-collapse: collapse; }
aside td    { background: transparent !important; padding: 0; }

aside a svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.5; transition: opacity 0.12s; }

aside a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 14px;
    font-size: 12px;
    font-weight: 400;
    color: #475569;
    text-decoration: none;
    background: transparent;
    border-top: none;
    border-right: none;
    border-bottom: none;
    border-left: 3px solid transparent;
    width: auto;
    height: auto;
    transition: background 0.15s, color 0.15s, border-left-color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    box-shadow: none;
}

aside a:link,
aside a:visited {
    color: #475569;
    background: transparent;
    border-left: 3px solid transparent;
    font-weight: 400;
    text-decoration: none;
    box-shadow: none;
}

aside a:hover {
    color: #0f172a !important;
    background: #fdf3d9 !important;
    background-color: #fdf3d9 !important;
    border-top: none !important;
    border-right: none !important;
    border-bottom: none !important;
    border-left: 3px solid #EFA601 !important;
    border-left-color: var(--apex-color-accent, #EFA601) !important;
    text-decoration: none !important;
    box-shadow: none !important;
}

aside a:hover svg { opacity: 0.9; }

aside a.apex-active {
    color: #0f172a !important;
    background: #fdf3d9 !important;
    background-color: #fdf3d9 !important;
    border-left: 3px solid #EFA601 !important;
    border-left-color: var(--apex-color-accent, #EFA601) !important;
    font-weight: 500;
}
aside a.apex-active svg { opacity: 0.9; }

aside a.apex-logout {
    color: #94a3b8;
    font-size: 11px;
    border-top: 1px solid #f1f5f9;
    border-left: 3px solid transparent;
    margin-top: auto;
}
aside a.apex-logout:hover {
    color: #dc2626 !important;
    background: #fef2f2 !important;
    background-color: #fef2f2 !important;
    border-left: 3px solid #dc2626 !important;
}

/* ═══════════════════════════════════════════════════════════
   4. ARTICLE
   ═══════════════════════════════════════════════════════════ */
article {
    grid-area: article;
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    padding: 20px 24px;
    min-width: 0;
    float: none;
    width: auto;
}
article input[type="text"],
article input[type="number"],
article input[type="date"],
article input[type="password"],
article select,
article textarea {
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 13px;
    padding: 6px 10px;
    box-shadow: none;
    transition: border-color 0.12s, box-shadow 0.12s;
}
article input:focus, article select:focus, article textarea:focus {
    outline: none;
    border-color: var(--apex-color-accent, #EFA601);
    box-shadow: 0 0 0 3px rgba(239,166,1,0.15);
}
article input[type="submit"], article button[type="submit"] {
    background: var(--apex-color-accent, #EFA601);
    color: #fff; border: none; border-radius: 6px;
    padding: 7px 18px; font-size: 13px; font-weight: 500;
    cursor: pointer; transition: filter 0.12s;
}
article input[type="submit"]:hover, article button[type="submit"]:hover { filter: brightness(1.08); }

/* ═══════════════════════════════════════════════════════════
   4b. KUNDEN.PHP – fixe Tabellenbreiten überschreiben
   ═══════════════════════════════════════════════════════════ */
article table[width],
article table[width="500"],
article table[width="500px"] {
    width: 100% !important;
    max-width: 100% !important;
}
article div[align="center"] { text-align: left; width: 100%; }
article table[width] colgroup col:first-child,
article table[width="500"] colgroup col:first-child,
article table[width="500px"] colgroup col:first-child { width: 220px !important; }
article table[width] colgroup col:last-child,
article table[width="500"] colgroup col:last-child,
article table[width="500px"] colgroup col:last-child  { width: auto !important; }
article table[width="500px"][frame="hsides"]          { width: 100% !important; }
article table[width="500px"][frame="hsides"] colgroup col { width: 25% !important; }

/* ═══════════════════════════════════════════════════════════
   4c. KUNDEN.PHP – Tab-Buttons (Infos/Ansprechpartner/...)
       th bekommt in globus.css dunkel+weiß, Links darin
       müssen ebenfalls weiß sein.
   ═══════════════════════════════════════════════════════════ */
article table[frame="hsides"] th a,
article table[frame="hsides"] th a:link,
article table[frame="hsides"] th a:visited {
    color: #e2e8f0 !important;
    font-weight: 500;
    text-decoration: none;
}
article table[frame="hsides"] th a:hover {
    color: var(--apex-color-accent, #EFA601) !important;
    text-decoration: none;
}

/* Tab-Leiste optisch als Button-Reihe */
article table[frame="hsides"] th {
    text-align: center !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-size: 13px !important;
    padding: 10px 8px !important;
    cursor: pointer;
    border-right: 1px solid rgba(255,255,255,0.1);
}

/* ═══════════════════════════════════════════════════════════
   5. FOOTER
   ═══════════════════════════════════════════════════════════ */
footer {
    grid-area: footer;
    background-color: #1e293b !important;
    background-color: var(--apex-color-nav, #1e293b) !important;
    border-radius: 10px;
    height: 44px;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    gap: 12px;
    clear: none;
    overflow: visible;
    border: none !important;
    box-shadow: none !important;
}
footer *, footer table, footer tbody, footer tr, footer td {
    background-color: transparent !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: inherit;
}
footer, footer td, footer b { color: #94a3b8; font-size: 12px; }
footer strong, footer b     { color: #e2e8f0; }
footer a, footer a:link, footer a:visited { color: #94a3b8; text-decoration: none; font-weight: 400; }
footer a:hover { color: var(--apex-color-accent, #EFA601); text-decoration: none; }
footer img     { width: 22px; height: 22px; opacity: 0.7; vertical-align: middle; }

.apex-footer-left  { display: flex; align-items: center; gap: 10px; color: #94a3b8; font-size: 12px; }
.apex-footer-left strong { color: #e2e8f0; }
.apex-footer-version     { color: #64748b; font-size: 11px; }
.apex-footer-right       { display: flex; align-items: center; gap: 8px; }
.apex-footer-badge {
    background: rgba(255,255,255,0.1) !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    border-radius: 5px; padding: 3px 10px; font-size: 11px; color: #94a3b8;
}

/* ═══════════════════════════════════════════════════════════
   6. TABELLEN
   ═══════════════════════════════════════════════════════════ */
table { background-color: #ffffff; }
th {
    background-color: var(--apex-color-nav, #1e293b);
    color: #e2e8f0; font-size: 11px; font-weight: 500;
    text-align: left; padding: 8px 12px;
    text-transform: uppercase; letter-spacing: 0.4px;
}
td { font-size: 12px; padding: 7px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tr:nth-child(even) td { background-color: #f8fafc; }
/* tr:hover td — Tabellen-Hover generell deaktiviert */

/* ═══════════════════════════════════════════════════════════
   7. BADGES
   ═══════════════════════════════════════════════════════════ */
.badge-ok, .badge-io        { display:inline-block; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:500; background:#dcfce7; color:#166534; }
.badge-warn, .badge-faellig { display:inline-block; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:500; background:#fef9c3; color:#854d0e; }
.badge-err, .badge-ueberfaellig { display:inline-block; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:500; background:#fee2e2; color:#991b1b; }

/* ═══════════════════════════════════════════════════════════
   8. BUTTONS
   ═══════════════════════════════════════════════════════════ */
.menubuttons {
    display: inline-block; text-align: center; padding: 6px 14px;
    background: transparent; border: 1px solid #475569 !important;
    border-radius: 6px; color: #94a3b8; font-size: 12px;
    cursor: pointer; transition: all 0.12s; text-decoration: none;
}
.menubuttons:hover { background: #334155 !important; color: #e2e8f0; border-color: #64748b !important; text-decoration: none; }
.drucktable       { border-radius: 8px; border: 1px solid #e2e8f0; box-shadow: 0 1px 4px rgba(0,0,0,0.06); background: #ffffff; overflow: hidden; }
.drucktable table { background: #ffffff; }

/* ═══════════════════════════════════════════════════════════
   9. LINKS
   ═══════════════════════════════════════════════════════════ */
a:link    { color: #1e293b; text-decoration: none; font-weight: normal; }
a:visited { color: #475569; text-decoration: none; font-weight: normal; }
a:hover   { color: var(--apex-color-accent, #EFA601); text-decoration: underline; }
a:active  { color: #0f172a; text-decoration: none; }

/* ═══════════════════════════════════════════════════════════
   10–12. DIVERSES
   ═══════════════════════════════════════════════════════════ */
.dispotabelle     { border-radius: 8px; border: 1px solid #e2e8f0; box-shadow: 0 1px 4px rgba(0,0,0,0.06); background: #ffffff; }
.dispotabelle td  { border: 1px solid #f1f5f9; font-size: 10px; }
.tooltip span { display: none; position: relative; cursor: pointer; }
.tooltip:hover span { display: block; position: absolute; white-space: pre; background: #ffffff; padding: 6px 10px; border: 1px solid #e2e8f0; color: #1e293b; border-radius: 6px; margin-left: 7px; margin-top: 20px; width: 270px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 100; font-size: 12px; }
#login-form { width: 320px; margin: 60px auto; box-sizing: border-box; }
#login-form h3 { font-size: 20px; font-weight: 600; color: var(--apex-color-nav, #1e293b); margin-bottom: 16px; }
#login-form fieldset { background: #ffffff; border-radius: 8px; padding: 20px; border: 1px solid #e2e8f0; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
#login-form input[type="text"], #login-form input[type="password"] { border: 1px solid #cbd5e1; padding: 10px 12px; width: 100%; border-radius: 6px; font-size: 14px; background: #f8fafc; box-shadow: none; margin-bottom: 10px; }
#login-form input[type="text"]:focus, #login-form input[type="password"]:focus { border-color: var(--apex-color-accent, #EFA601); outline: none; background: #fff; }
#login-form input[type="submit"] { background: var(--apex-color-accent, #EFA601); border-radius: 6px; color: #fff; width: 100%; font-weight: 600; margin-top: 8px; padding: 11px 20px; border: none; font-size: 14px; cursor: pointer; transition: filter 0.12s; }
#login-form input[type="submit"]:hover { filter: brightness(1.1); }

/* ═══════════════════════════════════════════════════════════
   13. RESPONSIVE – TABLET  (640–1023px)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 1023px) {
    #inhalt { --apex-sidebar-w: 48px; padding: 8px; gap: 6px; }
    aside a, aside a:link, aside a:visited {
        padding: 11px; justify-content: center; gap: 0;
        border-top: none; border-right: none;
        border-bottom: 3px solid transparent; border-left: none;
    }
    aside a:hover {
        border-top: none !important; border-right: none !important;
        border-bottom: 3px solid #EFA601 !important;
        border-bottom-color: var(--apex-color-accent, #EFA601) !important;
        border-left: none !important;
    }
    aside a .apex-link-label   { display: none; }
    aside tr.apex-menu-divider { display: none; }
    aside a.apex-logout span   { display: none; }
    article { padding: 14px 16px; }
    #apex-nav-title .apex-company { display: none; }
}

/* ═══════════════════════════════════════════════════════════
   14. RESPONSIVE – MOBIL  (< 640px)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 639px) {
    #inhalt { grid-template-areas: "nav" "aside" "article" "footer"; grid-template-columns: 1fr; grid-template-rows: auto auto 1fr auto; padding: 6px; gap: 6px; --apex-sidebar-w: 1fr; }
    aside { flex-direction: row; height: 44px; overflow-x: auto; overflow-y: hidden; border-radius: 8px; }
    aside table, aside tbody { display: flex; flex-direction: row; width: auto; }
    aside tr, aside td       { display: flex; }
    aside a, aside a:link, aside a:visited {
        padding: 0 12px; height: 44px; gap: 6px;
        border-top: none; border-right: none;
        border-bottom: 3px solid transparent; border-left: none;
        white-space: nowrap; font-size: 12px;
    }
    aside a:hover {
        border-bottom: 3px solid #EFA601 !important;
        border-bottom-color: var(--apex-color-accent, #EFA601) !important;
        border-left: none !important; background: #fdf3d9 !important;
    }
    aside tr.apex-menu-divider, aside a.apex-logout { display: none; }
    aside a .apex-link-label { display: inline; }
    nav { height: 54px; padding: 0 14px; }
    #apex-nav-title .apex-company { display: none; }
    article { padding: 12px; }
    footer  { height: auto; padding: 8px 14px; flex-wrap: wrap; gap: 6px; }
    #menu_top td:last-child { display: none; }
}

/* ═══════════════════════════════════════════════════════════
   15. DRUCK
   ═══════════════════════════════════════════════════════════ */
@media print {
    #inhalt { display: block; padding: 0; }
    nav, aside, footer { display: none !important; }
    article { border: none; box-shadow: none; padding: 0; }
    body    { background: #fff; font-size: 12px; }
}
