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

html,
body {
  height: 100%;
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background: #f3f6f9;
  color: #1e1e1e;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1 {
  text-align: center;
}

main {
  padding: 20px;
  flex: 1;
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: #1d4ed8;
  color: #fff;
}

.burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}

.burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
}

.navbar .menu {
  display: flex;
  gap: 12px;
  list-style: none;
}

.navbar a {
  color: #fff;
  font-weight: 600;
}

.navbar .user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar .user-info img {
  width: 32px;
  height: 32px;
}

.wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.calculator h1,
.history h1,
.settings h1 {
  margin-bottom: 10px;
}



.calculator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.form {
  background: #0080000d;
  padding: 5px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row {
  gap: 0px;
  padding: 0px;
  display: flex;
  flex-direction: column;
}
form > .form-row {
  background-color: white;
  border: 1px solid green;
  gap: 6px;
  border-radius: 10px;
  padding: 20px;
}

.form-row__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.form-row label {
  font-weight: 600;
}

.form input,
.form select,
.form textarea {
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
}

.form textarea {
  resize: vertical;
}

.radio-group {
  display: flex;
  gap: 20px;
}

.form-actions {
  display: flex;
  gap: 10px;
}

.btn {
  padding: 10px 14px;
  border: none;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}

.btn-secondary {
  background: #51a172;
}

.btn-success {
  background: #16a34a;
}

.btn-danger {
  background: #dc2626;
}

.btn:hover {
  opacity: 0.9;
}

.alert {
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 12px;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecdd3;
}

.list-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.list-row + .list-row {
  margin-top: 10px;
}

.list-row__fields {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  width: 100%;
}


.list-row .btn {
  align-self: center;
  white-space: nowrap;
}

.result {
  background: #fff;
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.result-list {
  list-style: none;
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.result-list span {
  font-weight: 600;
}

.final {
  font-size: 20px;
  font-weight: 700;
  padding: 12px;
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
}

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

.history td , .history th {
  font-size: 14px;
  padding: 5px !important ;
}

.history-actions {
  display: flex;
  gap: 10px;
}

.table-wrapper {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
}

.table th,
.table td {
  padding: 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: center;
}

.table th {
  background: #f3f4f6;
}

.inline-form {
  margin: 0;
  display: inline;
}

.users-panel {
  margin-top: 24px;
}

.users-panel h2 {
  margin-bottom: 12px;
}

.users-table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.users-table .inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.users-table {
  max-width: 100%;
  table-layout: auto;
}

.users-table th,
.users-table td {
  padding: 8px 6px;
  white-space: normal;
}

.users-table select,
.users-table input[type='password'] {
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
}

.modal-content {
  position: relative;
  background: #28b6dd;
  color: #fff;
  border-radius: 10px;
  padding: 20px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

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

.modal-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}

.modal-body .form-row label {
  color: #e0e7ff;
}

.modal-body .form-row input,
.modal-body .form-row select {
  border: none;
  background: #fff;
}

.modal-actions {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.modal-actions__right {
  display: flex;
  gap: 10px;
}

.settings .form {
  max-width: 100%;
}

@media (max-width: 640px) {
  main {
    padding: 16px 14px;
  }

  .calculator-grid {
    grid-template-columns: 1fr;
  }

  .navbar {
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .burger {
    display: inline-flex;
  }

  .navbar .user-info {
    margin-left: auto;
  }

  .navbar .menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: #1d4ed8;
    padding: 12px 16px;
    display: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  }

  .navbar .menu li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  }

  .navbar .menu li:last-child {
    border-bottom: none;
  }

  .navbar .menu.menu-open {
    display: flex;
  }

  .history-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .history-actions {
    width: 100%;
  }

  .history-actions .btn {
    flex: 1;
    text-align: center;
  }

  .table-wrapper {
    overflow-x: auto;
  }

  .table:not(.users-table) {
    min-width: 700px;
  }

  .list-row {
    flex-direction: column;
    gap: 10px;
  }

  .list-row__fields {
    grid-template-columns: 1fr;
  }

  .form {
    padding: 14px;
    gap: 10px;
  }

  .form-row__header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .users-table {
    font-size: 14px;
  }

  .users-table th,
  .users-table td {
    padding: 6px 4px;
    white-space: normal;
  }

  .users-table {
    min-width: 0;
    table-layout: auto;
  }
}

@media (max-width: 768px) {
  main {
    padding: 16px 14px;
  }

  .navbar {
    position: sticky;
    top: 0;
    z-index: 10;
    gap: 12px;
  }

  .burger {
    display: inline-flex;
  }

  .navbar .user-info {
    margin-left: auto;
  }

  .navbar .menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: #1d4ed8;
    padding: 12px 16px;
    display: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  }

  .navbar .menu li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  }

  .navbar .menu li:last-child {
    border-bottom: none;
  }

  .navbar .menu.menu-open {
    display: flex;
  }

  .history-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .history-actions {
    width: 100%;
  }

  .history-actions .btn {
    flex: 1;
    text-align: center;
  }

  .table-wrapper {
    overflow-x: auto;
  }

  .table:not(.users-table) {
    min-width: 700px;
  }

  .list-row {
    flex-direction: column;
    gap: 10px;
  }

  .list-row__fields {
    grid-template-columns: 1fr;
  }

  .form {
    padding: 5px;
    gap: 10px;
  }

  .form-row__header {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .users-table {
    font-size: 14px;
  }
}

.container {
    display: flex;
    justify-content: center;
}

.form-box {
  background: #ffffff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
  max-width: 350px;
  width: 100%;
  text-align: center;
}

.form-box label {
  display: block;
  text-align: left;
  margin-top: 10px;
  font-weight: 500;
}

.form-box input {
  width: 100%;
  padding: 10px;
  margin-top: 5px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 14px;
}

.btn-primary {
  margin-top: 15px;
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 5px;
  background: #4facfe;
  color: white;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.3s;
}

.btn-primary:hover {
  background: #00c2fe;
}

footer {
  background-color: #0687D9;
  padding: 20px;
  text-align: center;
  color: white;
}


.form-group {
  margin-bottom: 15px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: bold;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 1rem;
}


.modal-body input, .modal-body select, .modal-body label, .modal-actions button {
    font-size: 20px;
    text-align: center;
    margin-bottom: 10px;
}

.close-button {
  background-color: grey;
}

.save-button {
  background-color: green;
}