.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.navbar {
  display: grid;
  grid-template-columns: minmax(140px, auto) 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.9);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.navbar__left {
  display: flex;
  align-items: center;
  min-width: 0;
}

.navbar__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
}

.navbar__star {
  color: var(--accent);
  font-size: 1.1rem;
  line-height: 1;
}

.navbar__brand-text {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.navbar__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 0.15rem;
}

.navbar__link {
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.navbar__link:hover {
  background: var(--bg-deep);
  color: var(--ink);
}

.navbar__link.is-active {
  background: var(--accent);
  color: #fff;
}

.navbar__right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  justify-self: end;
}

.navbar__user {
  font-size: 0.9rem;
  color: var(--ink-muted);
  font-weight: 600;
}

.navbar__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 0.3rem;
  margin-left: 0.3rem;
  border-radius: 999px;
  background: #c45c26;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

.navbar__link--alert {
  position: relative;
  color: #9a3f12;
  box-shadow: 0 0 0 0 rgba(196, 92, 38, 0.55);
  animation: q-nav-glow 1.6s ease-out infinite;
}

.navbar__link--alert.is-active {
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.35);
}

.navbar__link--alert .navbar__badge {
  animation: q-badge-pulse 1.2s ease-in-out infinite;
}

@keyframes q-nav-glow {
  0% {
    box-shadow: 0 0 0 0 rgba(196, 92, 38, 0.55);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(196, 92, 38, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(196, 92, 38, 0);
  }
}

@keyframes q-badge-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12);
  }
}

.navbar__badge.is-hidden,
.navbar__notify.is-hidden,
.navbar__badge[hidden],
.navbar__notify[hidden] {
  display: none !important;
}

.navbar__notify {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(196, 92, 38, 0.12);
  color: #9a3f12;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
}

.navbar__notify:hover {
  background: rgba(196, 92, 38, 0.2);
}

.navbar__notify-label {
  font-size: 0.78rem;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.content {
  padding: 1.5rem;
  flex: 1;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 70% 45% at 15% 0%, rgba(15, 107, 92, 0.14) 0%, transparent 55%),
    radial-gradient(ellipse 55% 40% at 95% 10%, rgba(138, 90, 0, 0.1) 0%, transparent 50%),
    var(--bg);
}

.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 2rem 2rem 1.75rem;
}

.login-card__header {
  margin-bottom: 1.25rem;
}

.login-card__brand {
  font-family: var(--display);
  font-size: 1.85rem;
  letter-spacing: -0.02em;
  margin: 0;
}

.login-card__subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.92rem;
  color: var(--accent);
  font-weight: 600;
}

.login-card__lead {
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
}

.login-password {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
  align-items: stretch;
}

.login-password input {
  width: 100%;
}

.login-password__toggle {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 10px;
  padding: 0 0.85rem;
  font-size: 0.85rem;
  color: var(--ink-muted);
  white-space: nowrap;
}

.login-password__toggle:hover {
  color: var(--ink);
  border-color: var(--ink-muted);
}

.login-error {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.9rem;
}

.login-card__submit {
  width: 100%;
  margin-top: 0.25rem;
}

.login-card__footer {
  margin: 1.1rem 0 0;
  font-size: 0.8rem;
  line-height: 1.4;
}

.page-greeting {
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  margin: 0 0 1.25rem;
  color: var(--ink);
}

.dash-actions .btn {
  white-space: normal;
  text-align: left;
  line-height: 1.35;
  max-width: 100%;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.85rem;
}

.stat-tile {
  aspect-ratio: 1;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
  padding: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, border-color 0.12s ease;
}

a.stat-tile:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.stat-tile__value {
  font-family: var(--display);
  font-size: clamp(1.1rem, 2vw, 1.55rem);
  line-height: 1.15;
  color: var(--ink);
}

.stat-tile__label {
  font-size: 0.78rem;
  color: var(--ink-muted);
  line-height: 1.25;
}

.stat-tile--ok {
  border-color: #9dceb0;
  background: linear-gradient(160deg, #f4fbf6, var(--surface));
}

.stat-tile--muted {
  opacity: 0.85;
}

.detail-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.detail-toolbar__left,
.detail-toolbar__right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.detail-toolbar__right {
  position: relative;
  margin-left: auto;
}

.channel-board {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: stretch;
}

.channel-board__platforms {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.channel-board__empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0.5rem 0;
}

@media (max-width: 1100px) {
  .channel-board__platforms {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .channel-board__platforms {
    grid-template-columns: minmax(0, 1fr);
  }
}

.channel-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  min-width: 0;
}

.channel-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--line);
}

.channel-panel__title {
  font-family: var(--display);
  font-size: 1.05rem;
  margin: 0;
}

.channel-panel--source {
  background: linear-gradient(180deg, #f7faf8 0%, var(--surface) 40%);
}

.platform-picker {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--line);
}

.platform-picker--dropdown {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 30;
  width: min(340px, calc(100vw - 2rem));
  margin-top: 0;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-top: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.platform-picker__hint {
  font-size: 0.85rem;
  margin: 0 0 0.65rem;
  color: var(--ink-muted);
}

.platform-picker__list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 240px;
  overflow: auto;
}

.platform-picker__item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 0.9rem;
}

.platform-picker__item:hover {
  border-color: var(--accent);
}

.channel-panel .field {
  margin-bottom: 0.75rem;
}

.color-gallery {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.color-block__name {
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.color-block__imgs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.color-thumb {
  display: block;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-deep);
  position: relative;
}

.color-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.color-thumb--editable {
  display: inline-block;
  width: 88px;
  height: auto;
  overflow: visible;
  background: transparent;
  border: none;
}

.color-thumb--editable > a {
  display: block;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-deep);
}

.color-thumb__actions {
  display: flex;
  gap: 2px;
  margin-top: 4px;
  justify-content: center;
}

.color-thumb__btn {
  width: 22px;
  height: 20px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink, #1c1914);
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.color-thumb__btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.color-thumb__btn--remove {
  background: rgba(28, 25, 20, 0.85);
  border-color: transparent;
  color: #fff;
}

.color-thumb__remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 999px;
  background: rgba(28, 25, 20, 0.75);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.color-edit-block {
  padding: 0.65rem 0;
  border-bottom: 1px dashed var(--line);
}

.color-edit-block:last-child {
  border-bottom: none;
}

.color-webcolor-field .ty-attr-label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.8rem;
}

.color-webcolor-field select {
  max-width: 280px;
}

.input-sm {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.35rem 0.45rem;
  background: #fff;
  font-size: 0.8rem;
}

.input-readonly,
.channel-panel .field input.input-readonly {
  background: var(--bg-deep);
  color: var(--ink);
}

#category-map-table input,
#category-map-table textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.5rem;
  background: #fff;
  font: inherit;
}


.channel-panel .field input[readonly],
.channel-panel .field textarea[readonly] {
  background: var(--bg-deep);
  color: var(--ink);
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.mini-table th,
.mini-table td {
  text-align: left;
  padding: 0.4rem 0.35rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.mini-table th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
}

.table-row-link {
  cursor: pointer;
}

.table-row-link:hover td {
  background: rgba(15, 107, 92, 0.06);
}

@media (max-width: 1100px) {
  .dash-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .navbar {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .navbar__nav {
    justify-content: flex-start;
  }

  .navbar__right {
    justify-self: start;
  }

  .dash-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .dash-grid {
    grid-template-columns: 1fr 1fr;
  }
}
