* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: #1f2937;
  background: #f5f7fb;
}
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.auth-page .card {
  width: 360px;
  padding: 24px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}
.auth-page .card h1 { margin: 0 0 6px; font-size: 22px; }
.muted { color: #6b7280; font-size: 14px; }
label {
  display: block;
  margin: 12px 0 4px;
  font-size: 14px;
}
input:not(.form-control):not(.form-check-input) {
  width: 100%;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
}
select:not(.form-select), textarea:not(.form-control) {
  width: 100%;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
  background: #fff;
}
button:not(.btn) {
  margin-top: 14px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  background: #1f4fff;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.alert:not(.alert-danger):not(.alert-success):not(.alert-warning):not(.alert-info) {
  background: #fee2e2;
  color: #991b1b;
  padding: 10px;
  border-radius: 8px;
  margin: 10px 0;
}
.success {
  background: #dcfce7;
  color: #166534;
  padding: 10px;
  border-radius: 8px;
  margin: 10px 0;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: #111827;
  color: #fff;
}
.topbar .link { color: #93c5fd; text-decoration: none; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 16px 0 32px;
}
.tile {
  display: block;
  text-decoration: none;
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
  color: inherit;
}
.tile h3 { margin: 0 0 6px; font-size: 16px; }
.tile p { margin: 0; color: #6b7280; }

.panel {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.06);
  padding: 16px;
  margin: 0 0 16px;
}
.panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.search-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
}
.search-form button {
  width: auto;
  padding: 10px 14px;
  margin-top: 0;
}
.notes-list {
  display: grid;
  gap: 12px;
}
.note-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
}
.note-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.link-note {
  color: #111827;
  text-decoration: none;
}
.link-note:hover {
  text-decoration: underline;
}
.chip {
  background: #dbeafe;
  color: #1e3a8a;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  white-space: nowrap;
}
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.photo-grid img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}
.suggestions {
  display: none;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  margin-top: -4px;
  margin-bottom: 12px;
}
.suggestion-item {
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid #eef2f7;
  background: #fff;
  color: #111827;
  padding: 10px 12px;
  margin: 0;
  font-weight: 500;
  border-radius: 0;
}
.suggestion-item:last-child {
  border-bottom: 0;
}
.suggestion-item:hover {
  background: #f8fafc;
}
.danger-btn {
  background: #dc2626;
}
.proposal-box {
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #fde68a;
  background: #fffbeb;
}
.proposal-box p {
  margin: 6px 0;
}
.list-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.action-buttons {
  display: flex;
  gap: 8px;
}
.small-btn {
  width: auto;
  margin: 0;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px;
  line-height: 1.2;
}
.small-btn.secondary {
  background: #374151;
}
.app-modal {
  display: none;
}
.app-modal.show {
  display: block;
}
.app-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  z-index: 50;
}
.app-modal-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(760px, calc(100% - 20px));
  max-height: calc(100vh - 20px);
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  z-index: 60;
  box-shadow: 0 20px 40px rgba(0,0,0,0.18);
}
.app-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.app-modal-head h2 {
  margin: 0;
  font-size: 18px;
}
.icon-close {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 999px;
  margin: 0;
  padding: 0;
  background: #111827;
}
.top-toast {
  position: fixed;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  z-index: 120;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.top-toast.hide {
  opacity: 0;
  transform: translateX(-50%) translateY(-8px);
}

@media (max-width: 720px) {
  .topbar {
    padding: 12px 14px;
    font-size: 14px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .search-form {
    grid-template-columns: 1fr;
  }
  button, input, select, textarea {
    font-size: 16px;
  }
  .panel {
    padding: 12px;
  }
  .note-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .list-header {
    flex-direction: column;
  }
  .action-buttons {
    width: 100%;
  }
  .small-btn {
    flex: 1;
    text-align: center;
  }
  .app-modal-panel {
    width: calc(100% - 12px);
    max-height: calc(100vh - 12px);
    border-radius: 12px;
    padding: 12px;
  }
  .top-toast {
    top: 8px;
    width: calc(100% - 18px);
    border-radius: 10px;
    text-align: center;
  }
}
