* { box-sizing: border-box; }
body { font-family: system-ui, -apple-system, sans-serif; margin: 0; background: #f5f5f7; color: #222; }
.container { max-width: 1100px; margin: 0 auto; padding: 1rem; }

/* ============ HEADER ============ */
header { background: #1f2937; color: #fff; position: sticky; top: 0; z-index: 100; }
header .container { display: flex; justify-content: space-between; align-items: center; padding: .75rem 1rem; }
header h1 { margin: 0; font-size: 18px; font-weight: 500; display: flex; align-items: center; gap: .6rem; }
header nav { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; }
header nav a, header nav span { color: #fff; margin-left: 1rem; text-decoration: none; font-size: 14px; }
header nav a:hover { text-decoration: underline; }

/* Hamburger button - hidden on desktop */
.hamburger {
  display: none;
  background: transparent; border: 0; color: #fff;
  font-size: 24px; cursor: pointer; padding: .3rem .5rem; line-height: 1;
}
.hamburger:hover { background: rgba(255,255,255,.1); }

/* Drawer */
.drawer-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.5); z-index: 200; animation: fadeIn .2s ease;
}
.drawer {
  display: none; position: fixed; top: 0; right: 0; bottom: 0;
  width: 280px; max-width: 85vw; background: #1f2937; color: #fff;
  z-index: 201; padding: 1rem; overflow-y: auto;
  box-shadow: -4px 0 12px rgba(0,0,0,.3); animation: slideIn .25s ease;
}
.drawer.open, .drawer-overlay.open { display: block; }
.drawer-close {
  background: transparent; border: 0; color: #fff; font-size: 28px;
  cursor: pointer; float: right; line-height: 1; padding: 0 .3rem;
}
.drawer-user { padding-bottom: 1rem; border-bottom: 1px solid #374151; margin-bottom: 1rem; }
.drawer-user b { display: block; font-size: 16px; margin-bottom: .25rem; }
.drawer-user span { font-size: 12px; color: #9ca3af; }
.drawer nav { display: flex; flex-direction: column; }
.drawer nav a {
  color: #fff; text-decoration: none; padding: .85rem .5rem;
  border-radius: 6px; font-size: 15px; margin: 0; transition: background .15s;
}
.drawer nav a:hover { background: #374151; text-decoration: none; }
.drawer nav a.logout {
  margin-top: 1rem; border-top: 1px solid #374151;
  padding-top: 1rem; color: #fca5a5;
}

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

/* ============ CARDS ============ */
.card { background: #fff; border-radius: 8px; padding: 1rem 1.2rem; margin: 1rem 0; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-top: 1rem; }
h2 { margin: 0 0 .8rem; font-size: 16px; }

/* ============ BUTTONS ============ */
button, .btn {
  background: #2563eb; color: #fff; border: 0;
  padding: .55rem 1rem; border-radius: 6px;
  cursor: pointer; font-size: 14px; min-height: 38px;
  text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { background: #1d4ed8; }
button:disabled { background: #9ca3af; cursor: not-allowed; }
.btn-green { background: #16a34a; } .btn-green:hover { background: #15803d; }
.btn-red { background: #dc2626; } .btn-red:hover { background: #b91c1c; }
.btn-blue { background: #2563eb; }
.btn-orange { background: #ea580c; } .btn-orange:hover { background: #c2410c; }
.btn-cyan { background: #0891b2; } .btn-cyan:hover { background: #0e7490; }
.btn-gray { background: #6b7280; } .btn-gray:hover { background: #4b5563; }
.btn-purple { background: #7c3aed; } .btn-purple:hover { background: #6d28d9; }

/* Butoane MICI - nu devin full-width pe mobil */
.btn-sm {
  padding: .35rem .75rem !important;
  font-size: 13px !important;
  min-height: 32px !important;
  width: auto !important;
  display: inline-flex !important;
  align-items: center;
  gap: .3rem;
  line-height: 1;
}
.btn-sm:hover { text-decoration: none !important; }

/* Grupare butoane mici (toolbar) */
.btn-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
}

/* ============ FORMS ============ */
form label { display: block; margin: .5rem 0; font-size: 13px; color: #555; }
input[type=text], input[type=password], input[type=date], input[type=email],
input[type=tel], input[type=number], textarea, select {
  width: 100%; padding: .55rem; border: 1px solid #d1d5db; border-radius: 5px;
  font-size: 14px; font-family: inherit; min-height: 38px;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.inline-form input, .inline-form select { width: auto; flex: 1; min-width: 120px; }

/* ============ TABLES ============ */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: .5rem; text-align: left; border-bottom: 1px solid #eee; vertical-align: middle; }
th { background: #f9fafb; font-weight: 500; }

/* ============ MISC ============ */
.mono { font-family: ui-monospace, monospace; font-size: 12px; color: #555; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.badge-intrare { background: #d1fae5; color: #065f46; }
.badge-iesire { background: #fee2e2; color: #991b1b; }
.badge-observatie { background: #dbeafe; color: #1e40af; }
.badge-concediu { background: #fef3c7; color: #92400e; }
.badge-invoire { background: #ede9fe; color: #5b21b6; }
.err { background: #fee2e2; color: #991b1b; padding: .6rem; border-radius: 6px; margin: .5rem 0; }
.login-card { max-width: 360px; margin: 3rem auto; }
.chain-ok { border-left: 4px solid #16a34a; }
.chain-fail { border-left: 4px solid #dc2626; background: #fef2f2; }

/* ====================================================================
   RESPONSIVE MOBILE (< 768px)
   ==================================================================== */
@media (max-width: 768px) {
  .container { padding: .75rem; }
  
  /* Header */
  header .container { padding: .75rem; }
  header h1 { font-size: 16px; }
  header nav.desktop-nav { display: none; }
  .hamburger { display: block; }
  
  /* Cards */
  .card { padding: .85rem; margin: .75rem 0; border-radius: 6px; }
  h2 { font-size: 15px; margin-bottom: .6rem; }
  
  /* Buttons full-width on mobile */
  button, .btn {
    width: 100%; padding: .75rem 1rem; min-height: 44px;
    font-size: 15px; margin: .25rem 0;
  }
  .inline-form button, .inline-form .btn { width: auto; flex: 0 0 auto; }
  td button, td .btn, .card-actions button, .card-actions .btn {
    width: auto; min-width: 80px; padding: .5rem .75rem;
    font-size: 13px; min-height: 38px;
  }
  /* btn-sm ramane mic pe mobil */
  .btn-sm {
    width: auto !important;
    padding: .4rem .7rem !important;
    font-size: 12px !important;
    min-height: 32px !important;
    margin: 0 !important;
  }
  .btn-toolbar {
    gap: .3rem;
  }
  
  /* Forms */
  form label { margin: .75rem 0 .25rem; font-size: 14px; }
  input[type=text], input[type=password], input[type=date], input[type=email],
  input[type=tel], input[type=number], textarea, select {
    font-size: 16px; padding: .7rem; min-height: 44px;
  }
  textarea { min-height: 100px; }
  
  .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form input, .inline-form select { width: 100%; }
  
  /* Tabele -> Cards */
  .table-responsive.cards-on-mobile table thead { display: none; }
  .table-responsive.cards-on-mobile table tbody tr {
    display: block; margin-bottom: .75rem; background: #fff;
    border: 1px solid #e5e7eb; border-radius: 6px; padding: .5rem;
  }
  .table-responsive.cards-on-mobile table tbody td {
    display: flex; justify-content: space-between; align-items: center;
    padding: .5rem; border-bottom: 1px solid #f3f4f6;
    text-align: right; font-size: 13px;
  }
  .table-responsive.cards-on-mobile table tbody td:last-child { border-bottom: 0; }
  .table-responsive.cards-on-mobile table tbody td::before {
    content: attr(data-label); font-weight: 600; color: #6b7280;
    margin-right: .75rem; text-align: left; flex: 1;
    font-size: 12px; text-transform: uppercase;
  }
  
  .table-responsive table { min-width: 100%; }
  
  .grid { grid-template-columns: 1fr; gap: .75rem; }
  .login-card { margin: 1.5rem auto; max-width: 92vw; }
  .hide-mobile { display: none !important; }
  
  .card a[style*="float:right"], .card a[style*="float: right"] {
    float: none !important; display: inline-block;
    margin: .5rem .25rem 0 0 !important; font-size: 13px;
  }
  
  pre { font-size: 11px; overflow-x: auto; }
  details summary { padding: .5rem 0; font-size: 14px; }
}

@media (min-width: 769px) {
  .hamburger { display: none; }
  .drawer, .drawer-overlay { display: none !important; }
  .mobile-only { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
