    :root {
      --ink: #1a1f2e;
      --ink2: #2d3448;
      --slate: #4a5168;
      --mist: #8892a4;
      --border: #e2e6ed;
      --surface: #f7f8fa;
      --white: #ffffff;
      --gold: #d4a843;
      --gold2: #e8c56a;
      --teal: #0d7c6b;
      --teal2: #0fa88f;
      --rose: #c0392b;
      --sky: #1a6fa8;
      --amber: #d97706;
      --shadow-sm: 0 1px 4px rgba(26, 31, 46, 0.08);
      --shadow: 0 4px 16px rgba(26, 31, 46, 0.10);
      --shadow-lg: 0 12px 40px rgba(26, 31, 46, 0.15);
      --r: 10px;
      --r-lg: 16px;
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    body {
      font-family: 'Sora', sans-serif;
      background: var(--surface);
      color: var(--ink);
      min-height: 100vh;
      width: 100%;
      overflow-x: hidden;
    }

    input[type="date"] {
      background-color: var(--surface);
      color: var(--text);
      font-family: inherit;
      padding: 8px;
    }

    #section-audit input[type="date"] {
      min-width: 150px;
      appearance: none;
      -webkit-appearance: none;
      position: relative;
    }

    #section-audit input[type="date"]::-webkit-calendar-picker-indicator {
      cursor: pointer;
      padding: 6px;
      filter: invert(var(--is-dark, 0));
      background-size: contain;
    }

    /* ===== LOGIN ===== */
    #loginScreen {
      min-height: 100vh;
      display: flex;
      background: var(--ink);
      position: relative;
      overflow: hidden;
    }

    body.has-session #loginScreen {
      display: none !important;
    }

    body.has-session #appShell {
      display: flex !important;
    }

    #loginScreen::before {
      content: '';
      position: absolute;
      top: -200px;
      right: -200px;
      width: 600px;
      height: 600px;
      background: radial-gradient(circle, rgba(212, 168, 67, 0.12) 0%, transparent 70%);
      border-radius: 50%;
    }

    #loginScreen::after {
      content: '';
      position: absolute;
      bottom: -150px;
      left: -150px;
      width: 500px;
      height: 500px;
      background: radial-gradient(circle, rgba(13, 124, 107, 0.10) 0%, transparent 70%);
      border-radius: 50%;
    }

    .login-left {
      flex: 1;
      display: flex;
      flex-direction: column;
      justify-content: center;
      padding: 60px;
      position: relative;
      z-index: 1;
    }

    .login-brand {
      margin-bottom: 60px;
    }

    .login-brand-logo {
      width: 56px;
      height: 56px;
      background: var(--gold);
      border-radius: 14px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 26px;
      margin-bottom: 16px;
      box-shadow: 0 8px 24px rgba(212, 168, 67, 0.3);
    }

    .login-brand-name {
      font-family: 'Playfair Display', serif;
      font-size: 28px;
      color: var(--white);
      letter-spacing: 0.5px;
    }

    .login-brand-sub {
      font-size: 13px;
      color: rgba(255, 255, 255, 0.4);
      margin-top: 4px;
    }

    .login-tagline {
      font-family: 'Playfair Display', serif;
      font-size: 40px;
      color: var(--white);
      line-height: 1.2;
      margin-bottom: 20px;
    }

    .login-tagline span {
      color: var(--gold);
    }

    .login-desc {
      font-size: 14px;
      color: rgba(255, 255, 255, 0.45);
      line-height: 1.7;
      max-width: 420px;
    }

    .login-features {
      margin-top: 40px;
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .login-feat {
      display: flex;
      align-items: center;
      gap: 12px;
      font-size: 13px;
      color: rgba(255, 255, 255, 0.5);
    }

    .login-feat-icon {
      width: 32px;
      height: 32px;
      background: rgba(255, 255, 255, 0.07);
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 15px;
      flex-shrink: 0;
    }

    .login-right {
      width: 440px;
      background: var(--white);
      display: flex;
      flex-direction: column;
      justify-content: center;
      padding: 60px 48px;
      position: relative;
      z-index: 1;
    }

    .login-form-title {
      font-family: 'Playfair Display', serif;
      font-size: 26px;
      color: var(--ink);
      margin-bottom: 6px;
    }

    .login-form-sub {
      font-size: 13px;
      color: var(--mist);
      margin-bottom: 36px;
    }

    .login-field {
      margin-bottom: 16px;
    }

    .login-field label {
      display: block;
      font-size: 11px;
      font-weight: 600;
      color: var(--slate);
      text-transform: uppercase;
      letter-spacing: 1px;
      margin-bottom: 6px;
    }

    .login-field input,
    .login-field select {
      width: 100%;
      padding: 12px 16px;
      border: 1.5px solid var(--border);
      border-radius: var(--r);
      font-family: 'Sora', sans-serif;
      font-size: 14px;
      color: var(--ink);
      background: var(--surface);
      transition: border-color 0.15s;
    }

    .login-field input:focus,
    .login-field select:focus {
      outline: none;
      border-color: var(--gold);
      background: white;
    }

    .login-btn {
      width: 100%;
      padding: 14px;
      background: var(--ink);
      color: var(--gold);
      border: none;
      border-radius: var(--r);
      font-family: 'Sora', sans-serif;
      font-size: 14px;
      font-weight: 600;
      cursor: pointer;
      margin-top: 8px;
      transition: all 0.2s;
      letter-spacing: 0.5px;
    }

    .login-btn:hover {
      background: var(--ink2);
      transform: translateY(-1px);
      box-shadow: 0 6px 20px rgba(26, 31, 46, 0.2);
    }

    .login-hint {
      margin-top: 28px;
      background: var(--surface);
      border-radius: var(--r);
      padding: 14px 16px;
      font-size: 12px;
      color: var(--slate);
    }

    .login-hint strong {
      color: var(--ink);
      display: block;
      margin-bottom: 6px;
    }

    .login-hint-row {
      display: flex;
      justify-content: space-between;
      padding: 3px 0;
      border-bottom: 1px solid var(--border);
    }

    .login-hint-row:last-child {
      border-bottom: none;
    }

    /* ===== APP ===== */
    #appShell {
      display: none;
      min-height: 100vh;
      width: 100%;
    }

    /* SIDEBAR */
    .sidebar {
      width: 256px;
      background: var(--ink);
      height: 100vh;
      overflow-y: auto;
      position: fixed;
      top: 0;
      left: 0;
      z-index: 100;
      display: flex;
      flex-direction: column;
      transition: transform 0.3s;
    }

    .sidebar-header {
      padding: 20px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.07);
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .sidebar-logo-box {
      width: 38px;
      height: 38px;
      background: var(--gold);
      border-radius: 9px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      flex-shrink: 0;
    }

    .sidebar-logo-text {
      font-family: 'Playfair Display', serif;
      font-size: 16px;
      color: var(--white);
    }

    .sidebar-logo-sub {
      font-size: 10px;
      color: rgba(255, 255, 255, 0.3);
      margin-top: 1px;
    }

    .sidebar-school {
      padding: 12px 20px;
      background: rgba(212, 168, 67, 0.08);
      border-bottom: 1px solid rgba(255, 255, 255, 0.05);
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .school-logo-placeholder {
      width: 36px;
      height: 36px;
      background: rgba(255, 255, 255, 0.1);
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      flex-shrink: 0;
      overflow: hidden;
    }

    .school-logo-placeholder img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .school-name {
      font-size: 11px;
      color: rgba(255, 255, 255, 0.6);
      line-height: 1.4;
    }

    .nav-group {
      padding: 10px 0;
    }

    .nav-group-label {
      font-size: 9px;
      text-transform: uppercase;
      letter-spacing: 2px;
      color: rgba(255, 255, 255, 0.2);
      padding: 8px 20px 4px;
    }

    .nav-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 9px 20px;
      font-size: 13px;
      color: rgba(255, 255, 255, 0.5);
      cursor: pointer;
      transition: all 0.15s;
      border-left: 2px solid transparent;
      user-select: none;
    }

    .nav-item:hover {
      background: rgba(255, 255, 255, 0.05);
      color: rgba(255, 255, 255, 0.85);
    }

    .role-pedagog {
      background: rgba(8, 145, 178, 0.1);
      color: #0891b2;
      border: 1px solid rgba(8, 145, 178, 0.2);
    }

    .role-bucatar {
      background: rgba(245, 158, 11, 0.1);
      color: #f59e0b;
      border: 1px solid rgba(245, 158, 11, 0.2);
    }

    .role-ingrijitor {
      background: rgba(132, 204, 22, 0.1);
      color: #84cc16;
      border: 1px solid rgba(132, 204, 22, 0.2);
    }

    .role-paznic {
      background: rgba(100, 116, 139, 0.1);
      color: #64748b;
      border: 1px solid rgba(100, 116, 139, 0.2);
    }

    .nav-item.active {
      background: rgba(212, 168, 67, 0.1);
      color: var(--gold);
      border-left-color: var(--gold);
    }

    .nav-icon {
      width: 18px;
      text-align: center;
      font-size: 15px;
      flex-shrink: 0;
    }

    .nav-badge {
      margin-left: auto;
      background: var(--rose);
      color: white;
      font-size: 10px;
      padding: 1px 6px;
      border-radius: 10px;
      font-weight: 600;
    }

    /* hidden nav items based on role */
    .nav-item[data-roles] {
      display: none;
    }

    .sidebar-user {
      margin-top: auto;
      padding: 14px 20px;
      border-top: 1px solid rgba(255, 255, 255, 0.07);
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .user-avatar {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      background: var(--gold);
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      font-size: 13px;
      color: var(--ink);
      flex-shrink: 0;
    }

    .user-name {
      font-size: 12px;
      color: rgba(255, 255, 255, 0.7);
    }

    .user-role {
      font-size: 10px;
      color: rgba(255, 255, 255, 0.3);
    }

    .logout-btn {
      margin-left: auto;
      font-size: 16px;
      cursor: pointer;
      opacity: 0.4;
      transition: opacity 0.15s;
    }

    .logout-btn:hover {
      opacity: 0.9;
    }

    /* MAIN */
    .main {
      margin-left: 256px;
      min-height: 100vh;
      display: flex;
      flex-direction: column;
      flex: 1;
      width: calc(100% - 256px);
    }

    .topbar {
      background: var(--white);
      border-bottom: 1px solid var(--border);
      padding: 14px 28px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      position: sticky;
      top: 0;
      z-index: 50;
      box-shadow: var(--shadow-sm);
    }

    .topbar-left {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .topbar-title {
      font-family: 'Playfair Display', serif;
      font-size: 18px;
      color: var(--ink);
    }

    .topbar-breadcrumb {
      font-size: 12px;
      color: var(--mist);
    }

    .topbar-right {
      display: flex;
      gap: 10px;
      align-items: center;
    }

    .topbar-notif {
      position: relative;
      cursor: pointer;
      font-size: 18px;
      padding: 4px;
    }

    .notif-dot {
      position: absolute;
      top: 2px;
      right: 2px;
      width: 8px;
      height: 8px;
      background: var(--rose);
      border-radius: 50%;
      border: 2px solid white;
    }

    .content {
      padding: 24px 28px;
      flex: 1;
      width: 100%;
    }

    .section {
      display: none;
    }

    .section.active {
      display: block;
    }

    /* BUTTONS */
    .btn {
      padding: 8px 16px;
      border-radius: 8px;
      font-family: 'Sora', sans-serif;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      border: none;
      transition: all 0.15s;
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }

    .btn-primary {
      background: var(--ink);
      color: var(--gold);
    }

    .btn-primary:hover {
      background: var(--ink2);
      transform: translateY(-1px);
    }

    .btn-gold {
      background: var(--gold);
      color: var(--ink);
    }

    .btn-gold:hover {
      background: var(--gold2);
    }

    .btn-outline {
      background: transparent;
      border: 1.5px solid var(--border);
      color: var(--ink);
    }

    .btn-outline:hover {
      border-color: var(--gold);
      color: var(--gold);
    }

    .btn-teal {
      background: var(--teal);
      color: white;
    }

    .btn-teal:hover {
      background: var(--teal2);
    }

    .btn-danger {
      background: var(--rose);
      color: white;
    }

    .btn-sm {
      padding: 5px 10px;
      font-size: 11px;
    }

    /* CARDS */
    .stats-row {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 14px;
      margin-bottom: 24px;
    }

    .card-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
      gap: 16px;
      margin-bottom: 16px;
    }

    .stat-card {
      background: var(--white);
      border-radius: var(--r);
      padding: 16px 18px;
      box-shadow: var(--shadow-sm);
      border-top: 3px solid var(--border);
      transition: all 0.2s;
    }

    .stat-card:hover {
      box-shadow: var(--shadow);
      transform: translateY(-1px);
    }

    .stat-card.gold {
      border-top-color: var(--gold);
    }

    .stat-card.teal {
      border-top-color: var(--teal);
    }

    .stat-card.rose {
      border-top-color: var(--rose);
    }

    .stat-card.sky {
      border-top-color: var(--sky);
    }

    .stat-card.amber {
      border-top-color: var(--amber);
    }

    .stat-label {
      font-size: 10px;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--mist);
      margin-bottom: 6px;
    }

    .stat-val {
      font-family: 'Playfair Display', serif;
      font-size: 26px;
      color: var(--ink);
    }

    .stat-sub {
      font-size: 11px;
      color: var(--mist);
      margin-top: 2px;
    }

    .card {
      background: var(--white);
      border-radius: var(--r-lg);
      box-shadow: var(--shadow-sm);
      overflow: hidden;
      margin-bottom: 20px;
      border: 1px solid var(--border);
    }

    .card-header {
      padding: 14px 20px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: var(--surface);
    }

    .card-title {
      font-weight: 600;
      font-size: 14px;
      color: var(--ink);
      display: flex;
      align-items: center;
      gap: 8px;
    }

    table {
      width: 100%;
      border-collapse: collapse;
    }

    th {
      background: var(--surface);
      font-size: 10px;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--mist);
      padding: 10px 14px;
      text-align: left;
      font-weight: 700;
      border-bottom: 1px solid var(--border);
    }

    td {
      padding: 11px 14px;
      border-bottom: 1px solid var(--surface);
      font-size: 13px;
      vertical-align: middle;
    }

    tr:last-child td {
      border-bottom: none;
    }

    tr:hover td {
      background: #fdfcfb;
    }

    /* BADGES */
    .badge {
      display: inline-flex;
      align-items: center;
      padding: 2px 8px;
      border-radius: 20px;
      font-size: 10px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .b-green {
      background: #d1fae5;
      color: #065f46;
    }

    .b-yellow {
      background: #fef3c7;
      color: #92400e;
    }

    .b-red {
      background: #fee2e2;
      color: #991b1b;
    }

    .status-expired {
      background: #ffe5e5;
      color: #b30000;
      padding: 2px 6px;
      border-radius: 4px;
      font-weight: 600;
    }

    .status-warning {
      background: #fff4cc;
      color: #996600;
      padding: 2px 6px;
      border-radius: 4px;
      font-weight: 600;
    }

    .b-blue {
      background: #dbeafe;
      color: #1e40af;
    }

    .b-gray {
      background: #f3f4f6;
      color: #374151;
    }

    .b-teal {
      background: #ccfbf1;
      color: #0f766e;
    }

    .b-gold {
      background: #fef9c3;
      color: #854d0e;
    }

    /* FILTERS */
    .filters {
      display: flex;
      gap: 10px;
      margin-bottom: 18px;
      flex-wrap: wrap;
      align-items: center;
    }

    .search-box {
      flex: 1;
      min-width: 180px;
      background: var(--white);
      border: 1.5px solid var(--border);
      border-radius: 8px;
      padding: 0 12px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .search-box input {
      border: none;
      outline: none;
      padding: 9px 0;
      font-family: 'Sora', sans-serif;
      font-size: 13px;
      background: transparent;
      color: var(--ink);
      width: 100%;
    }

    select,
    input[type=text],
    input[type=number],
    input[type=date],
    input[type=email],
    input[type=password],
    textarea {
      font-family: 'Sora', sans-serif;
      font-size: 13px;
      padding: 8px 12px;
      border: 1.5px solid var(--border);
      border-radius: 8px;
      background: var(--white);
      color: var(--ink);
      outline: none;
      transition: border-color 0.15s;
    }

    select:focus,
    input:focus,
    textarea:focus {
      border-color: var(--gold);
    }

    /* MODAL */
    .modal-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(26, 31, 46, 0.6);
      z-index: 300;
      align-items: center;
      justify-content: center;
      backdrop-filter: blur(4px);
    }

    /* Table Responsiveness */
    .table-responsive {
      width: 100%;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      margin-bottom: 1rem;
    }

    @media (max-width: 768px) {
      .table-responsive table {
        min-width: 700px;
        /* Force scroll on mobile */
      }
    }

    .modal-overlay.open {
      display: flex;
    }

    .modal {
      background: var(--white);
      border-radius: var(--r-lg);
      padding: 0;
      width: 560px;
      max-width: 96vw;
      max-height: 92vh;
      overflow-y: auto;
      box-shadow: var(--shadow-lg);
      animation: modalIn 0.22s ease;
    }

    @keyframes modalIn {
      from {
        transform: scale(0.96) translateY(10px);
        opacity: 0;
      }

      to {
        transform: scale(1) translateY(0);
        opacity: 1;
      }
    }

    .modal-head {
      padding: 20px 24px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: var(--surface);
    }

    .modal-title {
      font-family: 'Playfair Display', serif;
      font-size: 18px;
      color: var(--ink);
    }

    .modal-close {
      cursor: pointer;
      font-size: 20px;
      color: var(--mist);
      transition: color 0.15s;
      line-height: 1;
    }

    .modal-close:hover {
      color: var(--ink);
    }

    .modal-body {
      padding: 22px 24px;
    }

    .modal-foot {
      padding: 16px 24px;
      border-top: 1px solid var(--border);
      display: flex;
      gap: 8px;
      justify-content: flex-end;
      background: var(--surface);
    }

    .form-row {
      margin-bottom: 14px;
    }

    .form-row label {
      display: block;
      font-size: 11px;
      font-weight: 700;
      color: var(--slate);
      text-transform: uppercase;
      letter-spacing: 0.8px;
      margin-bottom: 5px;
    }

    .form-row input,
    .form-row select,
    .form-row textarea {
      width: 100%;
    }

    .form-row textarea {
      resize: vertical;
      min-height: 70px;
    }

    .form-grid2 {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
      gap: 14px;
    }

    .form-grid3 {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
      gap: 12px;
    }

    /* QR MODAL */
    .qr-wrap {
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: 20px;
    }

    #qrCanvas {
      margin: 16px 0;
    }

    .qr-info {
      background: var(--surface);
      border-radius: var(--r);
      padding: 12px 16px;
      width: 100%;
      font-size: 12px;
    }

    .qr-info-row {
      display: flex;
      justify-content: space-between;
      padding: 4px 0;
      border-bottom: 1px solid var(--border);
    }

    .qr-info-row:last-child {
      border-bottom: none;
    }

    /* WORKFLOW BADGES */
    .workflow-step {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 8px;
    }

    .ws-num {
      width: 24px;
      height: 24px;
      border-radius: 50%;
      background: var(--ink);
      color: var(--gold);
      font-size: 11px;
      font-weight: 700;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .ws-text {
      font-size: 13px;
    }

    .ws-arrow {
      color: var(--mist);
      margin: 0 4px;
    }

    /* TABS */
    .tabs {
      display: flex;
      gap: 2px;
      background: var(--surface);
      border-radius: var(--r);
      padding: 4px;
      margin-bottom: 20px;
      border: 1px solid var(--border);
      width: fit-content;
    }

    .tab {
      padding: 7px 16px;
      border-radius: 7px;
      font-size: 13px;
      font-weight: 500;
      cursor: pointer;
      color: var(--mist);
      transition: all 0.15s;
    }

    .tab.active {
      background: var(--white);
      color: var(--ink);
      box-shadow: var(--shadow-sm);
      font-weight: 600;
    }

    /* ALERT */
    .alert {
      padding: 12px 16px;
      border-radius: var(--r);
      font-size: 13px;
      margin-bottom: 16px;
      display: flex;
      align-items: flex-start;
      gap: 10px;
    }

    .alert-warn {
      background: #fef9c3;
      border-left: 3px solid var(--amber);
      color: #78350f;
    }

    .alert-info {
      background: #eff6ff;
      border-left: 3px solid var(--sky);
      color: #1e3a5f;
    }

    /* BUILDING CARD */
    #cladiriGrid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
      gap: 20px;
    }

    .building-card {
      background: var(--white);
      border: 1px solid var(--border);
      border-radius: var(--r-lg);
      overflow: hidden;
      transition: all 0.2s;
      cursor: pointer;
    }

    .building-card:hover {
      box-shadow: var(--shadow);
      transform: translateY(-2px);
      border-color: var(--gold);
    }

    .building-card-header {
      padding: 16px 18px;
      background: var(--ink);
      color: white;
    }

    .building-card-name {
      font-family: 'Playfair Display', serif;
      font-size: 16px;
      margin-bottom: 4px;
    }

    .building-card-addr {
      font-size: 11px;
      color: rgba(255, 255, 255, 0.45);
    }

    .building-card-body {
      padding: 14px 18px;
    }

    .building-stat {
      display: flex;
      justify-content: space-between;
      font-size: 12px;
      padding: 5px 0;
      border-bottom: 1px solid var(--surface);
    }

    .building-stat:last-child {
      border-bottom: none;
    }

    .building-stat-val {
      font-weight: 700;
      color: var(--ink);
    }

    /* PERSONNEL CARD */
    .person-card {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 16px;
      border-bottom: 1px solid var(--surface);
      transition: background 0.15s;
    }

    .person-card:hover {
      background: var(--surface);
    }

    .person-card:last-child {
      border-bottom: none;
    }

    .person-avatar {
      width: 38px;
      height: 38px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      font-size: 14px;
      flex-shrink: 0;
    }

    .person-info {
      flex: 1;
    }

    .person-name {
      font-size: 14px;
      font-weight: 600;
    }

    .person-role {
      font-size: 11px;
      color: var(--mist);
    }

    .person-contact {
      font-size: 11px;
      color: var(--sky);
    }

    .person-actions {
      display: flex;
      gap: 6px;
    }

    /* TOAST */
    .toast {
      position: fixed;
      bottom: 20px;
      right: 20px;
      background: var(--ink);
      color: var(--white);
      padding: 12px 18px;
      border-radius: 10px;
      font-size: 13px;
      box-shadow: var(--shadow-lg);
      transform: translateY(70px);
      opacity: 0;
      transition: all 0.28s cubic-bezier(.34, 1.56, .64, 1);
      z-index: 999;
      border-left: 3px solid var(--gold);
      max-width: 320px;
    }

    .toast.show {
      transform: translateY(0);
      opacity: 1;
    }

    /* MAINTENANCE TASK */
    .task-row {
      display: flex;
      align-items: flex-start;
      gap: 12px;
      padding: 12px 16px;
      border-bottom: 1px solid var(--surface);
    }

    .task-row:last-child {
      border-bottom: none;
    }

    .task-priority {
      width: 4px;
      border-radius: 4px;
      align-self: stretch;
      flex-shrink: 0;
    }

    .tp-high {
      background: var(--rose);
    }

    .tp-med {
      background: var(--amber);
    }

    .tp-low {
      background: var(--teal);
    }

    .task-info {
      flex: 1;
    }

    .task-title {
      font-size: 13px;
      font-weight: 600;
      margin-bottom: 3px;
    }

    .task-meta {
      font-size: 11px;
      color: var(--mist);
    }

    .task-assign {
      font-size: 11px;
      background: var(--surface);
      border-radius: 6px;
      padding: 2px 8px;
      color: var(--slate);
    }

    /* SETTINGS SECTION */
    .settings-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
      gap: 20px;
    }

    .settings-card {
      background: var(--white);
      border: 1px solid var(--border);
      border-radius: var(--r-lg);
      padding: 20px;
    }

    .settings-card-title {
      font-weight: 700;
      font-size: 14px;
      margin-bottom: 16px;
      display: flex;
      align-items: center;
      gap: 8px;
      padding-bottom: 12px;
      border-bottom: 1px solid var(--surface);
    }

    .logo-upload-area {
      border: 2px dashed var(--border);
      border-radius: var(--r);
      padding: 24px;
      text-align: center;
      cursor: pointer;
      transition: border-color 0.15s;
      margin-bottom: 12px;
    }

    .logo-upload-area:hover {
      border-color: var(--gold);
    }

    .logo-preview {
      max-height: 80px;
      max-width: 200px;
      object-fit: contain;
      display: none;
      margin: 0 auto;
    }

    .permission-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 8px 0;
      border-bottom: 1px solid var(--surface);
      font-size: 13px;
    }

    .permission-row:last-child {
      border-bottom: none;
    }

    .toggle {
      width: 36px;
      height: 20px;
      background: var(--border);
      border-radius: 10px;
      position: relative;
      cursor: pointer;
      transition: background 0.2s;
    }

    .toggle.on {
      background: var(--teal);
    }

    .toggle::after {
      content: '';
      position: absolute;
      top: 2px;
      left: 2px;
      width: 16px;
      height: 16px;
      background: white;
      border-radius: 50%;
      transition: transform 0.2s;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    }

    .toggle.on::after {
      transform: translateX(16px);
    }

    /* EMPTY STATE */
    .empty {
      text-align: center;
      padding: 40px;
      color: var(--mist);
    }

    .empty-icon {
      font-size: 40px;
      margin-bottom: 10px;
    }

    .empty p {
      font-size: 13px;
    }

    /* ROLE COLORS */
    .role-admin_app {
      background: #1a1f2e;
      color: var(--gold);
    }

    .role-admin_pat {
      background: #0d7c6b;
      color: white;
    }

    .role-director {
      background: #7c3aed;
      color: white;
    }

    .role-contabil {
      background: #1a6fa8;
      color: white;
    }

    .role-informatician {
      background: #0369a1;
      color: white;
    }

    .role-profesor {
      background: #0891b2;
      color: white;
    }

    .role-mentenanta {
      background: #d97706;
      color: white;
    }

    @media print {

      .sidebar,
      .topbar,
      .filters,
      .btn,
      .nav-badge {
        display: none !important;
      }

      .main {
        margin-left: 0;
      }
    }

    /* ===== RESPONSIVE ===== */
    /* ===== RESPONSIVE — TOATE DISPOZITIVELE ===== */

    /* Tabletă mare (1024px) */
    @media (max-width: 1024px) {
      .sidebar {
        width: 220px;
      }

      .main {
        margin-left: 220px;
        width: calc(100% - 220px);
      }

      .stats-row {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
      }

      .flux-card,
      #fluxuriList {
        grid-template-columns: 1fr !important;
      }
    }

    /* Tabletă mică + telefon landscape (768px) */
    @media (max-width: 768px) {

      /* Sidebar slide-in */
      .sidebar {
        transform: translateX(-100%);
        width: 280px;
        z-index: 200;
        transition: transform 0.25s ease;
      }

      .sidebar.open {
        transform: translateX(0);
        box-shadow: 6px 0 24px rgba(0, 0, 0, 0.4);
      }

      .main {
        margin-left: 0;
        width: 100%;
      }

      #cladiriGrid {
        grid-template-columns: 1fr;
      }

      /* Topbar */
      .topbar {
        padding: 10px 14px;
        gap: 8px;
      }

      .topbar-title {
        font-size: 15px;
      }

      .hamburger {
        display: flex !important;
      }

      /* Content */
      .content {
        padding: 12px;
      }

      /* Stats grid */
      .stats-row {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 8px;
      }

      .stat-card {
        padding: 14px;
      }

      .stat-val {
        font-size: 22px;
      }

      .stat-label {
        font-size: 11px;
      }

      /* Grids formulare */
      .form-grid2,
      .form-grid3,
      .settings-grid {
        grid-template-columns: 1fr !important;
      }

      /* Modals */
      .modal {
        width: 96vw !important;
        max-height: 92vh;
        overflow-y: auto;
        margin: 4vh auto;
      }

      .modal-overlay {
        align-items: flex-start;
        padding-top: 4vh;
      }

      /* Login */
      .login-left {
        display: none;
      }

      .login-right {
        width: 100%;
        padding: 28px 20px;
        border-radius: 0;
      }

      .login-screen {
        min-height: 100vh;
      }

      /* Tabele */
      table {
        font-size: 12px;
      }

      th,
      td {
        padding: 7px 8px;
      }

      /* Import/Export */
      #section-import>div {
        grid-template-columns: 1fr !important;
      }

      /* Fluxuri grid */
      #fluxuriList {
        grid-template-columns: 1fr !important;
      }

      #flux-definite>div {
        grid-template-columns: 1fr !important;
      }

      /* Tabs scroll */
      .tabs {
        overflow-x: auto;
        white-space: nowrap;
      }

      /* Filters stack */
      .filters {
        flex-wrap: wrap;
        gap: 6px;
      }

      .filters input,
      .filters select {
        font-size: 13px;
      }

      /* Cards full width */
      .card-grid-2 {
        grid-template-columns: 1fr !important;
      }

      /* Notificari panel */
      .notif-panel {
        width: calc(100vw - 32px);
        right: 16px;
      }

      /* Workflow steps */
      .flux-card {
        padding: 12px;
      }

      /* Conturi demo login */
      .login-hint {
        font-size: 11px;
      }

      .login-hint-row {
        flex-direction: column;
        gap: 1px;
      }
    }

    /* Telefon portrait (480px) */
    @media (max-width: 480px) {

      /* Stats 2 coloane */
      .stats-row {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 6px;
      }

      .stat-val {
        font-size: 18px;
      }

      /* Butoane mai mici */
      .btn {
        padding: 7px 10px;
        font-size: 12px;
      }

      .btn-sm {
        padding: 4px 8px;
        font-size: 11px;
      }

      /* Safe Area Support (iOS) */
      .topbar {
        padding-top: calc(10px + env(safe-area-inset-top));
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        background: rgba(255, 255, 255, 0.9);
      }

      .main {
        padding-bottom: env(safe-area-inset-bottom);
      }

      .sidebar {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
      }

      /* Modal enhancements for touch */
      .modal {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
      }

      .modal-overlay {
        padding: 0;
      }

      /* Topbar compact */
      .topbar-title {
        font-size: 13px;
      }

      .topbar-right {
        gap: 6px;
      }

      #autosaveIndicator {
        display: none;
      }

      /* Tabele — ascunde coloane de la 5 în sus */
      td:nth-child(n+5),
      th:nth-child(n+5) {
        display: none;
      }

      /* Content padding mai mic */
      .content {
        padding: 8px;
      }

      /* Card header flex wrap */
      .card-header {
        flex-wrap: wrap;
        gap: 6px;
      }

      /* Workflow steps font */
      .workflow-step {
        padding: 8px 10px;
        font-size: 12px;
      }

      .ws-num {
        width: 22px;
        height: 22px;
        font-size: 11px;
        flex-shrink: 0;
      }

      /* Tabs scroll cu font mai mic */
      .tab {
        font-size: 12px;
        padding: 8px 12px;
      }

      /* Approval cards */
      .approval-card {
        padding: 12px;
      }

      /* Modals full screen pe telefon mic */
      .modal {
        width: 100vw !important;
        min-height: 100vh;
        border-radius: 0 !important;
        margin: 0 !important;
      }

      .modal-overlay {
        padding: 0;
        align-items: flex-start;
      }
    }

    /* Hamburger button */
    .hamburger {
      display: none;
      flex-direction: column;
      gap: 5px;
      cursor: pointer;
      padding: 6px 8px;
      border-radius: 8px;
      background: var(--surface);
      border: 1px solid var(--border);
      margin-right: 8px;
      flex-shrink: 0;
    }

    .hamburger span {
      width: 20px;
      height: 2px;
      background: var(--ink);
      border-radius: 2px;
      display: block;
      transition: all 0.2s;
    }

    /* Sidebar overlay */
    .sidebar-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.5);
      z-index: 150;
      backdrop-filter: blur(2px);
    }

    .sidebar-overlay.open {
      display: block;
    }

    /* ===== NOTIFICARI ===== */
    .notif-panel {
      position: fixed;
      top: 60px;
      right: 16px;
      width: 340px;
      max-height: 480px;
      background: var(--white);
      border-radius: var(--r-lg);
      box-shadow: var(--shadow-lg);
      border: 1px solid var(--border);
      z-index: 200;
      overflow: hidden;
      display: none;
      flex-direction: column;
      animation: modalIn 0.18s ease;
    }

    .notif-panel.open {
      display: flex;
    }

    .notif-head {
      padding: 14px 16px;
      border-bottom: 1px solid var(--border);
      background: var(--surface);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .notif-head-title {
      font-weight: 700;
      font-size: 14px;
    }

    .notif-list {
      overflow-y: auto;
      flex: 1;
    }

    .notif-item {
      padding: 12px 16px;
      border-bottom: 1px solid var(--surface);
      cursor: pointer;
      transition: background 0.1s;
    }

    .notif-item:hover {
      background: var(--surface);
    }

    .notif-item.unread {
      border-left: 3px solid var(--gold);
      background: #fffdf5;
    }

    .notif-item-title {
      font-size: 13px;
      font-weight: 600;
      margin-bottom: 3px;
    }

    .notif-item-body {
      font-size: 11px;
      color: var(--mist);
    }

    .notif-item-time {
      font-size: 10px;
      color: var(--mist);
      margin-top: 3px;
    }

    .notif-count {
      background: var(--rose);
      color: white;
      font-size: 10px;
      font-weight: 700;
      padding: 2px 6px;
      border-radius: 10px;
    }

    /* ===== APROBARE ===== */
    .approval-card {
      border: 1px solid var(--border);
      border-radius: var(--r);
      padding: 14px 16px;
      margin-bottom: 10px;
      transition: all 0.15s;
    }

    .approval-card:hover {
      box-shadow: var(--shadow-sm);
    }

    .approval-card.pending {
      border-left: 3px solid var(--amber);
    }

    .approval-card.approved {
      border-left: 3px solid var(--teal);
    }

    .approval-card.rejected {
      border-left: 3px solid var(--rose);
    }

    .approval-actions {
      display: flex;
      gap: 8px;
      margin-top: 10px;
    }

    /* ===== ISTORIC ===== */
    .history-item {
      display: flex;
      gap: 12px;
      padding: 12px 16px;
      border-bottom: 1px solid var(--surface);
    }

    .history-icon {
      width: 34px;
      height: 34px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 15px;
      flex-shrink: 0;
    }

    .history-content {
      flex: 1;
    }

    .history-title {
      font-size: 13px;
      font-weight: 600;
    }

    .history-meta {
      font-size: 11px;
      color: var(--mist);
      margin-top: 2px;
    }

    .history-user {
      font-size: 11px;
      background: var(--surface);
      padding: 2px 8px;
      border-radius: 6px;
      color: var(--slate);
    }

    /* ===== REZERVARE ===== */
    .rezervare-slot {
      padding: 8px 12px;
      border-radius: 8px;
      margin-bottom: 6px;
      font-size: 12px;
      border-left: 3px solid;
    }

    .rz-confirmed {
      background: #d1fae5;
      border-color: var(--teal);
    }

    .rz-pending {
      background: #fef9c3;
      border-color: var(--amber);
    }

    .rz-rejected {
      background: #fee2e2;
      border-color: var(--rose);
    }

    /* ===== FLUXURI ===== */
    .flux-card {
      border: 1px solid var(--border);
      border-radius: var(--r-lg);
      padding: 16px;
      background: var(--white);
      transition: box-shadow 0.15s;
    }

    .flux-card:hover {
      box-shadow: var(--shadow-sm);
    }

    .flux-card-head {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      margin-bottom: 10px;
    }

    .flux-card-title {
      font-weight: 700;
      font-size: 13px;
    }

    .flux-card-meta {
      font-size: 11px;
      color: var(--mist);
      margin-top: 3px;
    }

    .flux-steps {
      display: flex;
      flex-direction: column;
      gap: 4px;
      margin-top: 10px;
    }

    .flux-step {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 6px 10px;
      border-radius: 8px;
      font-size: 12px;
    }

    .flux-step.done {
      background: #d1fae5;
      color: #065f46;
    }

    .flux-step.current {
      background: #fef9c3;
      color: #854d0e;
      border: 1px solid #fbbf24;
      font-weight: 600;
    }

    .flux-step.pending {
      background: var(--surface);
      color: var(--mist);
    }

    .flux-step.blocat {
      background: #fee2e2;
      color: #991b1b;
    }

    .flux-step-icon {
      font-size: 14px;
      flex-shrink: 0;
    }

    .flux-progress {
      height: 6px;
      background: var(--surface);
      border-radius: 3px;
      margin-top: 10px;
      overflow: hidden;
    }

    .flux-progress-bar {
      height: 100%;
      background: var(--teal);
      border-radius: 3px;
      transition: width 0.3s;
    }

    .sidebar::-webkit-scrollbar {
      width: 4px;
    }

    .sidebar::-webkit-scrollbar-track {
      background: transparent;
    }

    .sidebar::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.15);
      border-radius: 2px;
    }

    .sidebar::-webkit-scrollbar-thumb:hover {
      background: rgba(255, 255, 255, 0.3);
    }

    #autosaveIndicator {
      pointer-events: none;
    }

    /* QR Scanner */
    @keyframes scanLine {
      0% {
        top: 20%;
        opacity: 1;
      }

      50% {
        top: 80%;
        opacity: 1;
      }

      100% {
        top: 20%;
        opacity: 1;
      }
    }

    #modalQRScanner .modal,
    #modalQRActiuni .modal {
      max-height: 95vh;
      overflow-y: auto;
    }

    @media (max-width: 480px) {

      #modalQRScanner .modal,
      #modalQRActiuni .modal {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 16px 16px 0 0 !important;
        position: fixed;
        bottom: 0;
        left: 0;
        margin: 0;
      }

      #modalQRScanner,
      #modalQRActiuni {
        align-items: flex-end !important;
      }
    }

    .btn-rose {
      background: var(--rose);
      color: white;
      border: none;
    }

    /* ===== AI FEATURES ===== */
    .ai-container {
      display: grid;
      grid-template-columns: 1fr 300px;
      gap: 20px;
      height: calc(100vh - 160px);
    }

    .ai-chat-card {
      background: var(--white);
      border-radius: var(--r-lg);
      display: flex;
      flex-direction: column;
      box-shadow: var(--shadow);
      border: 1px solid var(--border);
      position: relative;
      overflow: hidden;
    }

    .ai-chat-header {
      padding: 16px 20px;
      background: var(--ink);
      color: var(--white);
      display: flex;
      align-items: center;
      gap: 15px;
    }

    .ai-avatar {
      width: 44px;
      height: 44px;
      background: linear-gradient(135deg, var(--gold), #f3d081);
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 22px;
      box-shadow: 0 0 15px rgba(212, 168, 67, 0.4);
    }

    .ai-avatar.pulse {
      animation: ai-pulse 2s infinite;
    }

    @keyframes ai-pulse {
      0% { box-shadow: 0 0 0 0 rgba(212, 168, 67, 0.7); }
      70% { box-shadow: 0 0 0 10px rgba(212, 168, 67, 0); }
      100% { box-shadow: 0 0 0 0 rgba(212, 168, 67, 0); }
    }

    .ai-name {
      font-weight: 600;
      font-size: 15px;
    }

    .ai-status {
      font-size: 11px;
      opacity: 0.6;
    }

    .ai-chat-messages {
      flex: 1;
      overflow-y: auto;
      padding: 20px;
      display: flex;
      flex-direction: column;
      gap: 15px;
      background: #fdfcfb;
    }

    .ai-msg {
      max-width: 80%;
      padding: 12px 16px;
      border-radius: 16px;
      font-size: 14px;
      line-height: 1.5;
      position: relative;
    }

    .ai-msg.bot {
      align-self: flex-start;
      background: var(--white);
      color: var(--ink);
      border: 1px solid var(--border);
      border-bottom-left-radius: 4px;
      box-shadow: var(--shadow-sm);
    }

    .ai-msg.user {
      align-self: flex-end;
      background: var(--ink);
      color: var(--gold);
      border-bottom-right-radius: 4px;
    }

    .ai-chat-input-area {
      padding: 15px 20px;
      background: var(--white);
      border-top: 1px solid var(--border);
      display: flex;
      gap: 10px;
    }

    .ai-chat-input-area input {
      flex: 1;
      padding: 12px 18px;
      border: 1.5px solid var(--border);
      border-radius: 25px;
      font-family: inherit;
      font-size: 14px;
      transition: all 0.2s;
    }

    .ai-chat-input-area input:focus {
      outline: none;
      border-color: var(--gold);
      box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.1);
    }

    .ai-send-btn {
      width: 44px;
      height: 44px;
      background: var(--ink);
      color: var(--gold);
      border: none;
      border-radius: 50%;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      transition: all 0.2s;
    }

    .ai-send-btn:hover {
      transform: scale(1.05);
      background: var(--ink2);
    }

    .ai-suggestions-sidebar {
      background: var(--white);
      border-radius: var(--r-lg);
      padding: 20px;
      box-shadow: var(--shadow-sm);
      border: 1px solid var(--border);
    }

    .ai-sugg-title {
      font-weight: 700;
      font-size: 13px;
      text-transform: uppercase;
      letter-spacing: 1px;
      margin-bottom: 15px;
      color: var(--slate);
    }

    .ai-sugg-item {
      padding: 10px 12px;
      background: var(--surface);
      border-radius: 8px;
      font-size: 12px;
      margin-bottom: 8px;
      cursor: pointer;
      transition: all 0.2s;
      border: 1px solid transparent;
    }

    .ai-sugg-item:hover {
      background: var(--white);
      border-color: var(--gold);
      color: var(--gold);
      transform: translateX(5px);
    }

    /* AI Propuneri */
    .propunere-card {
      border-left: 4px solid var(--gold);
    }
    .propunere-card.urgenta {
      border-left-color: var(--rose);
    }
    .propunere-card.optimizare {
      border-left-color: var(--teal);
    }

    /* AI Todo */
    .todo-layout {
      display: grid;
      grid-template-columns: 1fr 300px;
      gap: 20px;
    }
    .todo-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 20px;
      border-bottom: 1px solid var(--surface);
      transition: background 0.2s;
    }
    .todo-item:hover {
      background: #fafafa;
    }
    .todo-check {
      width: 20px;
      height: 20px;
      border: 2px solid var(--border);
      border-radius: 4px;
      cursor: pointer;
    }
    .todo-check.done {
      background: var(--teal);
      border-color: var(--teal);
      position: relative;
    }
    .todo-check.done::after {
      content: '✓';
      color: white;
      position: absolute;
      top: -2px;
      left: 3px;
      font-size: 14px;
    }
    .todo-content {
      flex: 1;
    }
    .todo-title {
      font-size: 14px;
      font-weight: 500;
    }
    .todo-meta {
      font-size: 11px;
      color: var(--mist);
      margin-top: 2px;
    }

    @media (max-width: 992px) {
      .ai-container, .todo-layout {
        grid-template-columns: 1fr;
      }
      .ai-suggestions-sidebar, .todo-sidebar {
        display: none;
      }
    }
