* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f3f4f6;
  color: #1f2937;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login,
.panel,
.flash {
  background: #fff;
  border: 2px solid #222;
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

.login {
  width: min(360px, calc(100% - 32px));
  display: grid;
  gap: 12px;
}

.login label {
  margin-bottom: -6px;
}

.main-menu {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px 0;
}

.main-menu-left,
.main-menu-right {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.main-menu-right {
  margin-left: auto;
}

.main-menu a,
.main-menu button,
.button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid #9ca3af;
  border-radius: 7px;
  background: #fff;
  color: #111827;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
}

.main-menu form {
  margin: 0;
}

.main-menu a.active {
  background: #111827;
  color: #fff;
  border-color: #111827;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  padding: 16px;
}

.right-column,
.np-app,
.cancellations-app {
  display: grid;
  gap: 16px;
}

.np-app,
.cancellations-app {
  padding: 16px;
}

.password-page {
  padding: 16px;
}

.password-panel {
  max-width: 520px;
}

.list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  max-height: 560px;
  overflow-y: auto;
  padding-right: 6px;
}

.np-app .list {
  max-height: 620px;
}

.cancellations-list {
  max-height: 620px;
  overflow-y: auto;
}

.cancellation-meta {
  display: flex;
  gap: 8px 16px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.item {
  position: relative;
  border: 1px solid #aaa;
  border-radius: 8px;
  padding: 12px;
  background: #fafafa;
}

.muted {
  color: #6b7280;
  font-size: 13px;
}

h1,
h2 {
  margin-top: 0;
}

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

input,
textarea,
select,
button {
  width: 100%;
  padding: 8px 9px;
  border: 1px solid #999;
  border-radius: 7px;
  font-size: 14px;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

button {
  background: #111827;
  color: white;
  cursor: pointer;
  border: none;
}

.form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.single-column-form {
  grid-template-columns: 1fr;
}

.full {
  grid-column: 1 / -1;
}

.status-buttons,
.modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 10px;
}

.status-buttons form,
form.status-buttons {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0;
}

form.status-buttons {
  width: auto;
}

.status-buttons button,
.modal-actions button {
  width: auto;
  min-width: 84px;
  padding: 7px 10px;
  border: 3px solid transparent;
  font-size: 13px;
}

.list .status-buttons button,
.list .toggle-return-form,
.list .edit-new-patient,
.list .edit-cancellation {
  min-width: 0;
  padding: 4px 7px;
  font-size: 12px;
}

.status-buttons .status-current {
  border-color: #111827;
}

.status-hotove,
.status-predpisane {
  background: #047857;
}

.status-cakajuce {
  background: #6b7280;
}

.status-riesi_sa {
  background: #d97706;
}

.status-return {
  margin-top: 8px;
  background: #7c2d12;
}

.toggle-return-form {
  width: auto;
}

.return-form {
  margin-top: 10px;
}

.return-form[hidden] {
  display: none;
}

.status-delete {
  background: #b91c1c;
}

.edit-new-patient {
  background: #1d4ed8;
}

.star-form {
  position: absolute;
  right: 8px;
  top: 8px;
}

.star-button {
  width: 28px;
  background: transparent;
  color: #111827;
  font-size: 24px;
  padding: 0;
}

.star-button.starred {
  color: #facc15;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.tab-button {
  width: auto;
  background: #e5e7eb;
  color: #111827;
}

.tab-button.active-tab {
  background: #111827;
  color: #fff;
}

.tab-panel {
  display: none;
}

.tab-panel.active-tab-panel {
  display: block;
}

.returned-note {
  margin-top: 8px;
  padding: 8px;
  border-left: 4px solid #7c2d12;
  background: #fff7ed;
}

.doctor-options {
  display: flex;
  gap: 12px;
  align-items: center;
}

.doctor-options label {
  display: flex;
  gap: 6px;
  align-items: center;
  margin: 0;
  font-weight: normal;
}

.doctor-options input {
  width: auto;
}

.search-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: end;
}

.compact-search {
  grid-template-columns: 1fr auto;
  margin-bottom: 12px;
}

.search-form button,
.search-form .button {
  width: auto;
}

.error {
  background: #fee2e2;
  border-color: #ef4444;
  color: #991b1b;
}

.success {
  background: #dcfce7;
  border-color: #22c55e;
  color: #166534;
}

.login .error {
  padding: 9px 10px;
  border: 1px solid #ef4444;
  border-radius: 7px;
}

.flash {
  margin: 16px 16px 0;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(17, 24, 39, .55);
}

.modal.visible {
  display: flex;
}

.modal-dialog {
  width: min(760px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  background: #fff;
  border: 2px solid #111827;
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .28);
}

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

.modal-header h2 {
  margin: 0;
}

.modal-close {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  background: #e5e7eb;
  color: #111827;
  font-size: 22px;
  line-height: 1;
}

@media (max-width: 850px) {
  .main-menu,
  .main-menu-left,
  .main-menu-right {
    width: 100%;
  }

  .main-menu-right {
    margin-left: 0;
  }

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

  .form,
  .search-form {
    grid-template-columns: 1fr;
  }

  .status-buttons button,
  .modal-actions button,
  .search-form button,
  .search-form .button {
    width: 100%;
  }
}
