* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f0f4f8;
  color: #1a202c;
  min-height: 100vh;
}

/* ── APP LAYOUT ── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  min-width: 240px;
  background: #1a202c;
  display: flex;
  flex-direction: column;
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 50;
}

.sidebar-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid #2d3748;
}

.sidebar-brand h1 {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.sidebar-brand p {
  font-size: 12px;
  color: #718096;
  margin-top: 2px;
}

.sidebar-user {
  padding: 16px 20px;
  border-bottom: 1px solid #2d3748;
}

.sidebar-user .name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 500;
  color: #a0aec0;
  text-decoration: none;
  transition: all 0.15s;
  margin-bottom: 2px;
}

.sidebar-nav a:hover {
  background: #2d3748;
  color: #fff;
}

.sidebar-nav a.active {
  background: #2b6cb0;
  color: #fff;
}

.sidebar-nav .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 10px;
  border-top: 1px solid #2d3748;
}

.sidebar-footer button {
  width: 100%;
  background: transparent;
  border: 1px solid #4a5568;
  color: #a0aec0;
  padding: 9px 12px;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.sidebar-footer button:hover {
  border-color: #e53e3e;
  color: #e53e3e;
}

.main-content {
  margin-left: 240px;
  flex: 1;
  min-height: 100vh;
}

/* ── LOGIN ── */
.login-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
}

.login-box {
  background: #fff;
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-box .logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-box .logo h1 {
  font-size: 28px;
  font-weight: 700;
  color: #1a202c;
  letter-spacing: -0.5px;
}

.login-box .logo p {
  color: #718096;
  font-size: 14px;
  margin-top: 4px;
}

/* ── FORM ── */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 6px;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  color: #1a202c;
  background: #f7fafc;
  transition: border-color 0.2s;
}

.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: #4299e1;
  background: #fff;
}

.btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: #2b6cb0;
  color: #fff;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-danger {
  background: #e53e3e;
  color: #fff;
}

.btn-danger:hover {
  opacity: 0.9;
}

.btn-sm {
  width: auto;
  padding: 6px 14px;
  font-size: 13px;
}

.error-msg {
  color: #e53e3e;
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
}

/* ── NAVBAR ── */
.navbar {
  background: #1a202c;
  color: #fff;
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar .brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.navbar .nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}

.navbar .nav-right span {
  color: #a0aec0;
}

.navbar .nav-right strong {
  color: #fff;
}

.logout-btn {
  background: transparent;
  border: 1px solid #4a5568;
  color: #a0aec0;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.logout-btn:hover {
  border-color: #e53e3e;
  color: #e53e3e;
}

/* ── LAYOUT ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: #1a202c;
  margin-bottom: 8px;
}

.page-subtitle {
  font-size: 14px;
  color: #718096;
  margin-bottom: 28px;
}

/* ── BADGE LEVEL ── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-admin {
  background: #ebf8ff;
  color: #2b6cb0;
}

.badge-commerciale {
  background: #fefcbf;
  color: #b7791f;
}

.badge-cliente {
  background: #f0fff4;
  color: #276749;
}

/* ── RASPBERRY CARDS ── */
.raspberry-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.raspberry-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  border: 1px solid #e2e8f0;
  transition: box-shadow 0.2s;
}

.raspberry-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.raspberry-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.raspberry-card .card-name {
  font-size: 16px;
  font-weight: 600;
  color: #1a202c;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.status-dot::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-online::before { background: #48bb78; }
.status-offline::before { background: #fc8181; }

.raspberry-card .card-meta {
  font-size: 12px;
  color: #a0aec0;
  margin-top: 8px;
}

/* ── TABLE ── */
.table-wrapper {
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table thead {
  background: #f7fafc;
}

table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: #718096;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #e2e8f0;
}

table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid #f0f4f8;
}

table tr:last-child td {
  border-bottom: none;
}

table tr:hover td {
  background: #f7fafc;
}

/* ── NAV TABS ── */
.nav-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 28px;
  border-bottom: 2px solid #e2e8f0;
}

.nav-tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: #718096;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  text-decoration: none;
}

.nav-tab:hover {
  color: #2b6cb0;
}

.nav-tab.active {
  color: #2b6cb0;
  border-bottom-color: #2b6cb0;
  font-weight: 600;
}

/* ── MODAL ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.modal-actions .btn {
  flex: 1;
}

.btn-secondary {
  background: #e2e8f0;
  color: #4a5568;
}

.btn-secondary:hover {
  background: #cbd5e0;
}

/* ── LOADING ── */
.loading {
  text-align: center;
  padding: 60px;
  color: #a0aec0;
  font-size: 14px;
}
