:root {
  --bg-page: #f3f6fb;
  --bg-surface: #ffffff;
  --bg-accent: #0d6efd;
  --text-main: #1f2937;
  --text-muted: #5c6b80;
  --border-soft: #dce3ee;
  --shadow-soft: 0 12px 35px rgba(14, 28, 54, 0.08);
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text-main);
  background: radial-gradient(circle at top right, #e4edff 0, transparent 30%), var(--bg-page);
}

a {
  color: inherit;
}

.site-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-soft);
}

.top-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
}

.brand img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.top-links {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

.top-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
}

.top-links a:hover {
  color: var(--bg-accent);
}

.auth-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-name {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.auth-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border-soft);
  background: var(--bg-surface);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
}

.auth-action:hover {
  border-color: var(--bg-accent);
  color: var(--bg-accent);
}

.site-content {
  flex: 1;
  width: min(1200px, 100% - 40px);
  margin: 28px auto;
}

.site-footer {
  max-width: 1200px;
  margin: 0 auto;
  width: calc(100% - 40px);
  padding: 16px 0 24px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-footer img {
  height: 22px;
  opacity: 0.8;
}

.login-hero {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 420px);
  gap: 24px;
  align-items: stretch;
}

.login-card,
.login-visual,
.dashboard-shell,
.placeholder-page {
  border-radius: 18px;
  border: 1px solid var(--border-soft);
  background: var(--bg-surface);
  box-shadow: var(--shadow-soft);
}

.login-card {
  padding: 42px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-logo {
  width: 64px;
  height: 64px;
  margin-bottom: 18px;
}

.login-card h1 {
  margin-bottom: 12px;
}

.login-card p {
  color: var(--text-muted);
  max-width: 560px;
  margin-bottom: 22px;
}

.login-card .btn-primary {
  width: fit-content;
  border-radius: 10px;
  padding: 12px 18px;
  font-weight: 600;
}

.login-visual {
  overflow: hidden;
  min-height: 320px;
}

.login-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dashboard-shell {
  padding: 30px;
}

.page-heading h1 {
  margin-bottom: 6px;
}

.page-heading p {
  color: var(--text-muted);
}

.dashboard-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.dashboard-tile {
  min-height: 160px;
  padding: 22px;
  border-radius: 16px;
  border: 1px solid var(--border-soft);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 700;
  color: #12305f;
  background: linear-gradient(135deg, #f8fbff 0%, #eaf2ff 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dashboard-tile img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.dashboard-tile span {
  display: block;
  line-height: 1.35;
}

.tile-versions img,
.tile-settings img {
  filter: brightness(0);
}

.dashboard-tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 28px rgba(15, 50, 110, 0.15);
}

.placeholder-page {
  padding: 32px;
}

.placeholder-page p {
  color: var(--text-muted);
  margin-bottom: 20px;
}

@media (max-width: 900px) {
  .login-hero {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 28px;
  }

  .top-nav-inner {
    flex-wrap: wrap;
  }

  .top-links {
    order: 3;
    width: 100%;
    margin: 6px 0 0;
  }
}

.sync-page {
    border-radius: 18px;
    border: 1px solid var(--border-soft);
    background: var(--bg-surface);
    box-shadow: var(--shadow-soft);
    padding: 30px;
    position: relative;
}

.sync-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 16px;
}

.sync-panel {
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 14px;
}

    .sync-panel h2,
    .sync-log-wrap h2 {
        font-size: 1rem;
        margin-bottom: 10px;
    }

.sync-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.sync-log-wrap {
    margin-top: 20px;
}

.sync-log {
    margin: 0;
    background: #0f172a;
    color: #d9f3ff;
    border-radius: 12px;
    padding: 12px;
    min-height: 180px;
    max-height: 320px;
    overflow-y: auto;
    white-space: pre-wrap;
}

.log-copy-btn {
    border: none;
    background: transparent;
    padding: 0.15rem 0.4rem;
    border-radius: 0.375rem;
    font-size: 1rem;
    line-height: 1;
    color: #6c757d;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease, color 0.15s ease;
}

.log-copy-btn:hover {
    background-color: rgba(108, 117, 125, 0.15);
}

.log-copy-btn:active {
    transform: scale(0.9);
}

.log-copy-btn.copied {
    color: #198754;
    background-color: rgba(25, 135, 84, 0.12);
    cursor: default;
}

.log-copy-btn:disabled {
    opacity: 1;
}

.log-copy-label {
    font-size: 0.85rem;
    font-weight: 600;
    vertical-align: 0.05rem;
}

.copy-value {
    display: inline-flex;
    align-items: flex-start;
    gap: 0.35rem;
}

.copy-value-text {
    word-break: break-all;
}

.sync-loading {
    display: none;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(13, 110, 253, 0.08);
    width: fit-content;
}

@media (max-width: 900px) {
    .sync-grid {
        grid-template-columns: 1fr;
    }
}

.sync-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 16px;
}

/* Page-specific override: keep 3 panels on one row */
.update-egg-prices-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1200px) {
    .update-egg-prices-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.sync-panel {
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 14px;
}

@media (max-width: 900px) {
    .sync-grid {
        grid-template-columns: 1fr;
    }
}

.template-page {
    border-radius: 18px;
    border: 1px solid var(--border-soft);
    background: var(--bg-surface);
    box-shadow: var(--shadow-soft);
    padding: 30px;
}

.template-upload-panel {
    margin-top: 16px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 16px;
    background: #fffef4;
}

.template-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.template-upload-panel {
    margin-top: 16px;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 16px;
    background: #fffef4;
    position: relative;
}

.template-upload-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.82);
    border-radius: 12px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 600;
}

@media (max-width: 576px) {
    .template-actions-row {
        flex-direction: column;
        align-items: stretch;
    }

        .template-actions-row .btn {
            width: 100%;
        }
}