/* ===== ATNews admin – realism layer (loads after style.css) ===== */

/* User chip + logout in masthead */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 700 10px var(--font-body);
  letter-spacing: 0;
}
.user-name {
  color: #fff;
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0;
  font-weight: 600;
}
.logout-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #e4e6ea;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 100px;
  padding: 3px 11px;
  font: 600 11px var(--font-body);
  letter-spacing: 0;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.logout-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.masthead-right {
  display: flex;
  align-items: center;
  gap: 18px;
}
@media (max-width: 640px) {
  .user-name {
    display: none;
  }
  .masthead-date {
    display: none;
  }
}

/* Skeleton shimmer for "Loading…" rows */
.loading-row {
  color: transparent !important;
  height: 240px;
  background: linear-gradient(90deg, #f3f1ea 25%, #faf9f6 40%, #f3f1ea 60%);
  background-size: 400% 100%;
  animation: ex-shimmer 1.3s ease-in-out infinite;
}
@keyframes ex-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}

/* Table quick filter + sync time */
.table-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.table-search {
  position: relative;
}
.table-search i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  font-size: 11px;
}
.table-search input {
  width: 210px;
  padding: 6px 10px 6px 28px;
  font: 500 12.5px var(--font-body);
  border: 1px solid var(--line-strong);
  border-radius: 100px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s,
    width 0.2s;
}
.table-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  width: 250px;
}
.sync-time {
  font: 500 11px var(--font-mono);
  color: var(--ink-faint);
  white-space: nowrap;
}
.data-table tr.row-hidden {
  display: none;
}

/* Toasts (replace blocking alert()) */
.toast-stack {
  position: fixed;
  top: 76px;
  right: 20px;
  z-index: 20000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--press-blue);
  border-radius: 10px;
  padding: 13px 14px;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
  white-space: pre-line;
  animation: ex-toast-in 0.25s ease both;
}
.toast i {
  margin-top: 2px;
}
.toast.success {
  border-left-color: var(--success);
}
.toast.success i {
  color: var(--success);
}
.toast.error {
  border-left-color: var(--danger);
}
.toast.error i {
  color: var(--danger);
}
.toast.warn {
  border-left-color: var(--warn);
}
.toast.warn i {
  color: var(--warn);
}
.toast.info i {
  color: var(--press-blue);
}
.toast .toast-x {
  margin-left: auto;
  background: none;
  border: 0;
  color: var(--ink-faint);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.toast.leaving {
  animation: ex-toast-out 0.2s ease both;
}
@keyframes ex-toast-in {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes ex-toast-out {
  to {
    opacity: 0;
    transform: translateX(24px);
  }
}

/* Logout confirm */
.confirm-popup {
  max-width: 400px;
}
.confirm-popup p {
  margin: 0 0 4px;
  color: var(--ink-soft);
  font-size: 13.5px;
}
@media (prefers-reduced-motion: reduce) {
  .loading-row,
  .toast {
    animation: none !important;
  }
}

/* ===== Realism pass 2: panel + news editor ===== */
.api-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: 600 11px var(--font-body);
  letter-spacing: 0;
  color: #aeb4c2;
}
.api-chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6b7385;
}
.api-chip.ok::before {
  background: #34c26b;
  box-shadow: 0 0 0 3px rgba(52, 194, 107, 0.2);
}
.api-chip.slow::before {
  background: #f0b429;
}
.api-chip.down::before {
  background: #ff4d5e;
}
@media (max-width: 640px) {
  .api-chip {
    display: none;
  }
}

/* denser, cleaner ledger */
.data-table td {
  padding-top: 12px;
  padding-bottom: 12px;
}
.data-table td:last-child,
.data-table th:last-child {
  white-space: nowrap;
}
.action-btn-group {
  flex-wrap: nowrap;
}
.data-table tbody tr:hover td.cell-id {
  color: var(--accent);
}
.kbd {
  font: 600 10px var(--font-mono);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 5px;
  color: var(--ink-faint);
  background: #fff;
  margin-left: 6px;
}

/* News editor */
.publish-target {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -6px 0 16px;
  font-size: 12.5px;
  color: var(--ink-soft);
}
.publish-target b {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 3px 10px;
  border-radius: 100px;
  font-weight: 700;
}
.req {
  color: var(--accent);
  margin-left: 3px;
}
.field-meta {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 5px;
  font: 500 11px var(--font-mono);
  color: var(--ink-faint);
}
.field-meta .over {
  color: var(--danger);
  font-weight: 700;
}
.field-meta .good {
  color: var(--success);
}
.modern-field.invalid {
  border-color: var(--danger);
  background: var(--danger-soft);
}
.file-upload-wrapper.drag {
  border-color: var(--accent);
  background: var(--accent-soft);
  border-style: solid;
}
.file-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--ink-soft);
}
.file-chip span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-chip em {
  font: 500 11px var(--font-mono);
  color: var(--ink-faint);
  font-style: normal;
}
.file-chip button {
  border: 0;
  background: none;
  color: var(--ink-faint);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
}
.file-chip button:hover {
  color: var(--danger);
}
.editor-hint {
  font-size: 11px;
  color: var(--ink-faint);
  margin-right: auto;
  align-self: center;
}

/* ===== App management modules (Brands / Redemptions / Members) ===== */
.nav-menu li.nav-label {
  cursor: default;
  font: 700 10.5px var(--font-body);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #5c6679;
  padding: 16px 12px 6px;
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.nav-menu li.nav-label:hover {
  background: none;
  padding-left: 12px;
  color: #5c6679;
}
.brand-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-cell img,
.brand-cell .no-logo {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--line-strong);
  background: #fff;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
}
.brand-cell b {
  color: var(--ink);
  font-weight: 600;
}
.coupon {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
  font: 600 12px var(--font-body);
  background: var(--gold-soft);
  color: #8a6508;
  border: 1px solid #ecd9a6;
  padding: 4px 11px;
  border-radius: 100px;
}
.mod-pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: #faf9f6;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}
.mod-pager .btn-page-nav {
  width: auto;
  padding: 0 12px;
  gap: 6px;
}
.error-row small {
  display: block;
  margin-top: 8px;
  font-weight: 500;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  word-break: break-all;
}
.switch-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
}
.switch-row input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

/* =====================================================================
   NEWSROOM POLISH — makes the console feel like a real CMS
   ===================================================================== */
body {
  background: #eeece4;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: #cfcabc;
  border-radius: 10px;
  border: 2px solid #eeece4;
}

/* page header + breadcrumb */
.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-faint);
  margin: 0 0 14px;
}
.crumbs i {
  font-size: 8px;
  opacity: 0.7;
}
.crumbs b {
  color: var(--ink-soft);
  font-weight: 600;
}
.page-header h1 {
  font-size: 34px;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tool-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s;
}
.tool-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.tool-btn.spin i {
  animation: ex-spin 0.7s linear;
}
@keyframes ex-spin {
  to {
    transform: rotate(360deg);
  }
}

/* sidebar */
.nav-menu li.active {
  box-shadow:
    inset 3px 0 0 #fff,
    var(--shadow-sm);
}
.sidebar-footer {
  font-size: 11.5px;
}

/* cards */
.stat-card {
  background: linear-gradient(180deg, #fff, #fcfbf8);
}
.stat-card .stat-value {
  font-variant-numeric: tabular-nums;
}
.data-card {
  border-radius: 12px;
}
.data-card-header {
  background: #fff;
  padding: 18px 22px;
}
.data-card-header h2 {
  font-size: 16px;
}

/* story rows */
.data-table thead th {
  background: #f7f5ef;
}
.data-table tbody tr {
  box-shadow: inset 3px 0 0 transparent;
}
.data-table tbody tr:hover {
  box-shadow: inset 3px 0 0 var(--accent);
}
.data-table td.story-td {
  max-width: 620px;
  min-width: 340px;
}
.story-cell {
  display: flex;
  gap: 14px;
  align-items: center;
}
.story-thumb {
  width: 84px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--line-strong);
  background: #e9e6dc;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #b3ad9f;
  font-size: 18px;
}
.story-body {
  min-width: 0;
}
.story-title {
  font: 700 14.5px/1.35 var(--font-body);
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.story-sum {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.story-tags {
  display: flex;
  gap: 5px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.story-tags span {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--press-blue);
  background: var(--press-blue-soft);
  padding: 1px 8px;
  border-radius: 100px;
}
.media-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 12px;
  margin-right: 4px;
}
.media-ico.img {
  background: var(--press-blue-soft);
  color: var(--press-blue);
}
.media-ico.vid {
  background: var(--accent-soft);
  color: var(--accent);
}
.media-ico.none {
  background: #f1efe9;
  color: #b8b3a6;
}
.time-ago {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.time-sub {
  display: block;
  font: 500 11px var(--font-mono);
  color: var(--ink-faint);
}

/* analytics */
.graph-card {
  border-radius: 12px;
}
.chart-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--ink-faint);
  font-size: 13px;
  padding: 0 20px;
}
@media (max-width: 768px) {
  .story-thumb {
    width: 64px;
    height: 44px;
  }
  .page-actions .tool-btn {
    display: none;
  }
}
