/* Interfaccia stile SAP - professionale, compatta */
:root {
    --sap-sidebar: #0d3d6b;
    --sap-sidebar-hover: #0f4a7d;
    --sap-sidebar-active: #1565c0;
    --sap-topbar: #0d47a1;
    --sap-topbar-text: #fff;
    --sap-bg: #e8eaed;
    --sap-panel: #fff;
    --sap-border: #dadce0;
    --sap-text: #202124;
    --sap-text-muted: #5f6368;
    --sap-accent: #1a73e8;
    --sap-table-header: #f1f3f4;
    --sap-font: 'Segoe UI', 'Roboto', Arial, sans-serif;
}

body.sap-ui { margin: 0; font-family: var(--sap-font); font-size: 13px; background: var(--sap-bg); color: var(--sap-text); min-height: 100vh; }
body.sap-ui .app-shell { display: flex; min-height: 100vh; }

/* Sidebar */
.sap-sidebar { width: 220px; min-width: 220px; background: var(--sap-sidebar); color: #fff; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sap-sidebar .logo { display: block; padding: 14px 16px; font-weight: 700; font-size: 15px; color: #fff; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.1); }
.sap-sidebar .logo:hover { background: var(--sap-sidebar-hover); color: #fff; }
.sap-sidebar nav { padding: 8px 0; }
.sap-sidebar-nav-title { padding: 8px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: rgba(255,255,255,.6); }
.sap-sidebar a { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: rgba(255,255,255,.9); text-decoration: none; font-size: 13px; border-left: 3px solid transparent; }
.sap-sidebar a:hover { background: var(--sap-sidebar-hover); color: #fff; }
.sap-sidebar a.active { background: var(--sap-sidebar-active); color: #fff; border-left-color: #42a5f5; }
.sap-sidebar .nav-icon { width: 20px; height: 20px; flex-shrink: 0; opacity: .9; }

/* Top bar */
.sap-topbar { height: 48px; background: var(--sap-topbar); color: var(--sap-topbar-text); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; flex-shrink: 0; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.sap-topbar .breadcrumb { font-size: 14px; }
.sap-topbar .user-menu { display: flex; align-items: center; gap: 12px; }
.sap-topbar .user-menu span { font-size: 12px; opacity: .95; }
.sap-topbar .user-menu a { color: #fff; text-decoration: none; font-size: 12px; padding: 4px 8px; border-radius: 4px; }
.sap-topbar .user-menu a:hover { background: rgba(255,255,255,.15); }

/* Main content */
.sap-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.sap-content { flex: 1; padding: 16px 24px; overflow-x: auto; }

/* Panel / Card stile SAP */
.sap-panel { background: var(--sap-panel); border: 1px solid var(--sap-border); border-radius: 4px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.sap-panel-header { padding: 12px 16px; border-bottom: 1px solid var(--sap-border); font-weight: 600; font-size: 14px; background: var(--sap-table-header); display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.sap-panel-body { padding: 16px; }

/* Tabelle compatte SAP */
.sap-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.sap-table th, .sap-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--sap-border); }
.sap-table th { background: var(--sap-table-header); font-weight: 600; color: var(--sap-text-muted); white-space: nowrap; }
.sap-table tr:hover { background: #f8f9fa; }
.sap-table tr.sap-row-alert { background: #fff3cd; }
.sap-table tr.sap-row-alert:hover { background: #ffe69c; }
.sap-table .actions { white-space: nowrap; }
.sap-table .actions a, .sap-table .actions button { margin-right: 4px; }

/* Form SAP */
.sap-form .form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 24px; margin-bottom: 12px; }
.sap-form label { display: block; font-weight: 500; margin-bottom: 4px; font-size: 12px; color: var(--sap-text-muted); }
.sap-form input, .sap-form select, .sap-form textarea { padding: 6px 10px; border: 1px solid var(--sap-border); border-radius: 4px; font-size: 13px; width: 100%; max-width: 100%; }
.sap-form input:focus, .sap-form select:focus, .sap-form textarea:focus { outline: none; border-color: var(--sap-accent); box-shadow: 0 0 0 2px rgba(26,115,232,.2); }
.sap-form-actions { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--sap-border); display: flex; gap: 8px; flex-wrap: wrap; }

/* Bottoni SAP */
.btn-sap { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; font-size: 12px; font-weight: 500; border-radius: 4px; border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: background .15s; }
.btn-sap-primary { background: var(--sap-accent); color: #fff; border-color: var(--sap-accent); }
.btn-sap-primary:hover { background: #1557b0; color: #fff; }
.btn-sap-secondary { background: var(--sap-panel); color: var(--sap-text); border-color: var(--sap-border); }
.btn-sap-secondary:hover { background: var(--sap-table-header); }
.btn-sap-sm { padding: 4px 10px; font-size: 11px; }

/* Toolbar lista */
.sap-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.sap-toolbar h1, .sap-toolbar h2 { margin: 0; font-size: 18px; font-weight: 600; }

/* Mobile: sidebar collassabile */
.sap-sidebar-toggle { display: none; position: fixed; bottom: 16px; left: 16px; z-index: 999; width: 44px; height: 44px; border-radius: 8px; background: var(--sap-topbar); color: #fff; border: none; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
@media (max-width: 768px) {
    .sap-sidebar { position: fixed; left: 0; z-index: 900; transform: translateX(-100%); transition: transform .2s; }
    .sap-sidebar.is-open { transform: translateX(0); }
    .sap-sidebar-toggle { display: flex; align-items: center; justify-content: center; }
    .sap-main { padding-left: 0; }
    .sap-content { padding: 12px; }
}
