*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  color: var(--sn-dark);
  background: var(--sn-soft);
}

a {
  color: var(--sn-primary);
  text-decoration: none;
}

a:hover {
  color: var(--sn-primary-dark);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 56px 1fr;
}

.app-sidebar {
  background: var(--sn-sidebar);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 8px;
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--sn-primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
}

.sidebar-link {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.75);
}

.sidebar-link:hover,
.sidebar-link.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.app-main {
  min-width: 0;
}

.topbar {
  height: 48px;
  background: rgba(7, 31, 78, 0.92);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.topbar__brand {
  font-weight: 700;
  color: #fff;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--sn-primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar.has-photo {
  padding: 0;
  background: #dfe1e6;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar--lg {
  width: 72px;
  height: 72px;
  font-size: 22px;
}

.profile-avatar-block {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  padding: 14px;
  background: #f7f8f9;
  border-radius: 12px;
}

.profile-avatar-block__text {
  flex: 1;
  min-width: 0;
}

.profile-avatar-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--sn-text, #172b4d);
  margin-bottom: 10px;
}

.profile-avatar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.profile-avatar-input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  opacity: 0 !important;
}

.profile-avatar-remove {
  background: #fff !important;
  color: #ae2a19 !important;
  border: 1px solid #ffd5d2 !important;
}

.profile-avatar-remove:hover {
  background: #ffebe6 !important;
}

.profile-avatar-hint {
  margin: 0;
  font-size: 12px;
  color: var(--sn-muted);
  word-break: break-all;
}

.profile-form .errorlist {
  color: #ae2a19;
  font-size: 13px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.page-content {
  padding: 24px;
}

.page-title {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 700;
}

.section-title {
  margin: 24px 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--sn-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.boards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.board-tile {
  position: relative;
  height: 96px;
  border-radius: var(--sn-radius);
  overflow: hidden;
  color: #fff;
  box-shadow: var(--sn-shadow);
  display: flex;
  align-items: flex-end;
  padding: 12px;
  font-weight: 700;
}

.board-tile__link {
  position: absolute;
  inset: 0;
  color: inherit;
}

.board-tile__title {
  position: relative;
  z-index: 1;
}

.board-tile__star {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  opacity: 0.85;
}

.board-create-tile {
  height: 96px;
  border-radius: var(--sn-radius);
  background: rgba(255, 255, 255, 0.45);
  border: none;
  cursor: pointer;
  color: var(--sn-muted);
  font-weight: 600;
}

.board-create-tile:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--sn-dark);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--sn-radius);
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: var(--sn-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--sn-primary-dark);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.28);
}

.form-card {
  max-width: 420px;
  margin: 48px auto;
  background: var(--sn-panel);
  border: 1px solid var(--sn-border);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--sn-shadow);
}

.form-card h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.form-card p {
  margin: 0 0 20px;
  color: var(--sn-muted);
}

.form-field {
  margin-bottom: 14px;
}

.form-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--sn-border);
  border-radius: var(--sn-radius);
  font: inherit;
}

.form-field select {
  padding-right: 40px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  cursor: pointer;
}

/* Custom select with rounded dropdown list */
.nb-select {
  position: relative;
  width: 100%;
}

.nb-select__native {
  display: none !important;
}

.nb-select__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  border: 1px solid var(--sn-border);
  border-radius: 8px;
  background: #fff;
  padding: 10px 40px 10px 12px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
}

.nb-select.is-open .nb-select__trigger,
.nb-select__trigger:focus {
  outline: none;
  border-color: var(--sn-primary);
  box-shadow: 0 0 0 1px var(--sn-primary);
}

.nb-select__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nb-select__list {
  display: none;
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--sn-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
  padding: 6px;
  box-sizing: border-box;
}

.nb-select.is-open .nb-select__list {
  display: block;
}

.nb-select__option {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
  color: inherit;
}

.nb-select__option:hover {
  background: #f1f5f9;
}

.nb-select__option.is-active {
  background: var(--sn-primary);
  color: #fff;
}

.nb-select--compact {
  width: auto;
  min-width: 158px;
}

.nb-select--compact .nb-select__trigger {
  padding: 4px 40px 4px 8px;
  font-size: 12px;
  border-radius: 8px;
  background-position: right 14px center;
  background-size: 14px;
}

.form-errors {
  color: #b91c1c;
  font-size: 14px;
  margin-bottom: 12px;
}

.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

.messages li {
  padding: 10px 12px;
  border-radius: var(--sn-radius);
  margin-bottom: 8px;
  background: #e8f1ff;
  color: var(--sn-primary-deep);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-backdrop.is-open {
  display: flex;
}

.modal {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.2);
}

.modal h2 {
  margin: 0 0 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.board-page {
  min-height: calc(100vh - 48px);
  padding: 12px;
}

.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.board-header__title {
  margin: 0;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}

.board-header__members {
  display: flex;
  gap: 4px;
}

.board-lists {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.board-list {
  width: 272px;
  flex: 0 0 auto;
  background: var(--sn-list-bg);
  border-radius: var(--sn-radius);
  padding: 8px;
}

.board-list__title {
  margin: 0 0 8px;
  padding: 4px 8px;
  font-size: 14px;
  font-weight: 700;
}

.board-list__placeholder {
  background: var(--sn-card-bg);
  border-radius: var(--sn-radius);
  padding: 8px 10px;
  margin-bottom: 8px;
  box-shadow: var(--sn-shadow);
  font-size: 14px;
}

.board-list__add,
.board-list--create {
  color: var(--sn-muted);
  background: rgba(255, 255, 255, 0.24);
  border: none;
  border-radius: var(--sn-radius);
  padding: 8px 10px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.board-list--create {
  width: 272px;
  flex: 0 0 auto;
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
}

.board-empty-note {
  color: rgba(255, 255, 255, 0.85);
  font-size: 14px;
  margin: 0 0 12px;
}

.auth-footer {
  margin-top: 16px;
  font-size: 14px;
  color: var(--sn-muted);
}

@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    display: none;
  }

  .topbar {
    padding: 8px 12px;
    gap: 8px;
  }

  .topbar__brand {
    font-size: 16px;
  }

  .topbar__actions {
    gap: 8px;
  }

  .topbar__actions .btn {
    padding: 6px 10px;
    font-size: 13px;
  }

  .page-content {
    padding: 16px 12px;
  }

  .boards-grid {
    grid-template-columns: 1fr;
  }

  .form-card {
    width: 100%;
    max-width: none;
    margin: 0;
  }

  .profile-avatar-block {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .profile-avatar-actions {
    justify-content: center;
  }
}
