* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f3f4f8;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.app {
  width: 380px;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
  overflow: hidden;
}

.header {
  padding: 20px 20px 10px 20px;
  text-align: center;
}

.logo {
  max-width: 170px;
  height: auto;
  margin-bottom: 10px;
}

.header h1 {
  margin: 0;
  color: #1f256d;
  font-size: 24px;
}

.calculator-card {
  padding: 20px;
}

.display-wrap {
  margin-bottom: 12px;
}

.display {
  width: 100%;
  height: 72px;
  border: 2px solid #d9dce7;
  border-radius: 12px;
  background: #fafbff;
  color: #111827;
  font-size: 28px;
  text-align: right;
  padding: 12px 14px;
}

.message-box {
  min-height: 22px;
  margin-bottom: 12px;
  font-size: 14px;
  color: #1f256d;
}

.buttons-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.btn {
  border: none;
  border-radius: 12px;
  height: 58px;
  font-size: 22px;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.btn:hover {
  opacity: 0.95;
}

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

.btn:focus-visible {
  outline: 3px solid #8aa3ff;
  outline-offset: 2px;
}

/* Boutons chiffres = bleu LISAM */
.buttons-grid .btn {
  background: #1f256d;
  color: #ffffff;
}

/* Boutons opérateurs = orange LISAM */
.buttons-grid .btn.operator {
  background: #f07d2f;
  color: #ffffff;
}

/* Boutons actions (C / retour) = gris foncé */
.buttons-grid .btn.action {
  background: #475569;
  color: #ffffff;
}

/* Bouton égal = orange plus soutenu */
.buttons-grid .btn.equal {
  background: #f07d2f;
  color: #ffffff;
}

/* Boutons secondaires sous la calculatrice */
.btn.secondary {
  background: #1f256d;
  color: #ffffff;
}

.zero {
  grid-column: span 2;
}

.extra-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.wide-btn {
  height: 52px;
  font-size: 16px;
}

.footer {
  background: #1f256d;
  color: #ffffff;
  text-align: center;
  padding: 14px;
  font-size: 14px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.hidden {
  display: none;
}

.modal-content {
  width: 100%;
  max-width: 460px;
  background: #ffffff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
}

.modal-large {
  max-width: 1000px;
}

.modal-content h2 {
  margin-top: 0;
  color: #1f256d;
}

.modal-content label {
  display: block;
  margin-top: 12px;
  margin-bottom: 6px;
  font-weight: bold;
  color: #1f2937;
}

.modal-content input,
.modal-content textarea {
  width: 100%;
  border: 2px solid #d9dce7;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 15px;
}

.modal-content textarea {
  min-height: 100px;
  resize: vertical;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

.table-wrap {
  overflow-x: auto;
  max-height: 420px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  background: #f8fafc;
  color: #1f2937;
}

.import-btn {
  background: #1f256d;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

.delete-btn {
  background: #f07d2f;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

@media (max-width: 500px) {
  .app {
    width: calc(100% - 20px);
  }

  .display {
    font-size: 24px;
  }

  .btn {
    height: 54px;
    font-size: 20px;
  }

  .extra-actions {
    grid-template-columns: 1fr;
  }
}