/* KINKADO price monitor — modern UI (redesign 2026-05-15)
   Restore: design-backup/pre-redesign-2026-05-15/app.css */

*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg-base: #eef2f7;
  --bg-surface: #ffffff;
  --bg-muted: #f8fafc;
  --bg-subtle: #f1f5f9;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-soft: #94a3b8;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-ring: rgba(79, 70, 229, 0.25);
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 10px 24px -6px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, 0.15);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ok: #059669;
  --ok-bg: #ecfdf5;
  --err: #dc2626;
  --err-bg: #fef2f2;
  --warn: #d97706;
  --warn-bg: #fffbeb;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 0.9375rem;
  line-height: 1.5;
  overflow-x: hidden;
  max-width: 100vw;
  color: var(--text);
  background:
    radial-gradient(ellipse 120% 80% at 100% -20%, rgba(79, 70, 229, 0.12), transparent 50%),
    radial-gradient(ellipse 80% 60% at 0% 100%, rgba(14, 165, 233, 0.08), transparent 45%),
    var(--bg-base);
  min-height: 100vh;
}

h1,
h2 {
  color: var(--text);
  letter-spacing: -0.02em;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

h2 {
  font-size: 1.15rem;
  font-weight: 650;
  margin: 1.75rem 0 0.75rem;
}

.wrap {
  max-width: 52rem;
  margin: 0 auto;
  padding: 1.25rem max(1rem, env(safe-area-inset-left)) 2.5rem max(1rem, env(safe-area-inset-right));
  width: 100%;
}

.wrap-wide {
  max-width: min(85rem, 98vw);
}

@media (min-width: 48rem) {
  .wrap-wide table.data th,
  .wrap-wide table.data td {
    padding: 0.7rem 1rem;
  }

  .wrap-wide .col-name {
    min-width: 11rem;
  }

  .wrap-wide .col-measure {
    min-width: 13rem;
    width: 23%;
  }

  .wrap-wide .col-page {
    white-space: nowrap;
  }
}

a {
  color: var(--accent);
  word-break: break-word;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-hover);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.dashboard-head {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.35rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.dashboard-head-title {
  margin: 0 0 0.85rem;
  font-size: 1.55rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--text) 0%, #334155 55%, var(--accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.dashboard-head-row2 {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.dashboard-head-spacer {
  flex: 1;
  min-width: 0.5rem;
}

.nav a {
  font-weight: 600;
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-xs);
  color: var(--text);
  background: var(--bg-subtle);
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.nav a:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
  border-color: var(--border);
}

.muted {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.err {
  color: var(--err);
  background: var(--err-bg);
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  margin: 0 0 1rem;
}

.ok {
  color: var(--ok);
  background: var(--ok-bg);
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  margin: 0 0 1rem;
}

.stock-ok {
  color: #047857;
  font-weight: 700;
}

.stock-no {
  color: #b91c1c;
  font-weight: 700;
}

.stock-inquiry {
  color: #b45309;
  font-weight: 700;
}

.cron-tier {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.add-fold {
  margin-top: 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.add-fold > summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.15rem;
  font-weight: 650;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  user-select: none;
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-muted) 100%);
}

.add-fold > summary::-webkit-details-marker {
  display: none;
}

.add-fold > summary::after {
  content: "▸";
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: transform 0.2s ease;
}

.add-fold[open] > summary::after {
  transform: rotate(90deg);
}

.add-fold .add-fold-inner {
  padding: 0 1.15rem 1.15rem;
  border-top: 1px solid var(--border);
}

.add-fold .add-fold-inner .add-box {
  margin-top: 0;
  border: none;
  padding: 0.85rem 0 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.add-box {
  margin-top: 1.25rem;
  padding: 1.15rem 1.25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.add-box input[type="url"],
.add-box input[type="text"],
.add-box input[type="password"],
.add-box input[type="search"],
.add-box input[type="email"],
.add-box select,
.add-box textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.55rem 0.7rem;
  margin-top: 0.3rem;
  font: inherit;
  color: var(--text);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.add-box input:focus,
.add-box select:focus,
.add-box textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.add-box button[type="submit"],
.dashboard-search-btn,
button[type="submit"]:not(.link):not(.icon) {
  padding: 0.55rem 1.1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-xs);
  border: none;
  background: linear-gradient(180deg, #6366f1 0%, var(--accent) 100%);
  color: #fff;
  box-shadow: 0 2px 8px var(--accent-ring);
  transition: transform 0.1s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.add-box button[type="submit"]:hover,
.dashboard-search-btn:hover,
button[type="submit"]:not(.link):not(.icon):hover {
  filter: brightness(1.05);
  box-shadow: 0 4px 14px var(--accent-ring);
}

.add-box button[type="submit"]:active,
.dashboard-search-btn:active {
  transform: translateY(1px);
}

form.inline {
  display: inline;
}

button.link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  padding: 0;
  font: inherit;
  font-weight: 500;
}

button.link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

button.icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.2rem 0.35rem;
  border-radius: var(--radius-xs);
  transition: background 0.15s ease;
}

button.icon:hover {
  background: var(--accent-soft);
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table.data {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  margin-top: 0;
  font-size: 0.9rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

table.data th,
table.data td {
  text-align: left;
  padding: 0.6rem 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

table.data th {
  background: var(--bg-subtle);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

table.data tbody tr {
  transition: background 0.12s ease;
}

table.data tbody tr:hover td {
  background: rgba(79, 70, 229, 0.03);
}

table.data tr:last-child td {
  border-bottom: none;
}

.col-star {
  width: 2.5rem;
  text-align: center;
}

.col-thumb {
  width: 1%;
  white-space: nowrap;
  vertical-align: top;
}

.col-page {
  width: 1%;
  white-space: nowrap;
}

.col-measure {
  min-width: 10rem;
  width: 19%;
}

.col-actions {
  width: 10rem;
  min-width: 10rem;
  max-width: 10.5rem;
  white-space: normal;
  font-size: 0.85rem;
  line-height: 1.4;
}

.col-actions a,
.col-actions button.link {
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  line-height: inherit;
  color: var(--accent);
  text-decoration: none;
}

.col-actions a:hover,
.col-actions button.link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.product-list-thumb {
  display: block;
  height: 100px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--bg-muted);
  box-shadow: var(--shadow-sm);
}

.product-edit-thumb-preview {
  margin-bottom: 0.35rem;
}

.product-thumb-placeholder {
  display: block;
  box-sizing: border-box;
  height: 100px;
  width: 72px;
  border-radius: var(--radius-xs);
  border: 1px dashed var(--border-strong);
  background: var(--bg-subtle);
}

.product-thumb-upload-form {
  margin: 0;
  padding: 0;
}

.product-thumb-add {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 100px;
  width: 80px;
  margin: 0;
  border-radius: var(--radius-xs);
  border: 1px dashed var(--border-strong);
  background: var(--bg-subtle);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.product-thumb-add:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.product-thumb-file-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.product-thumb-add-icon {
  font-size: 2.75rem;
  line-height: 1;
  font-weight: 300;
  color: var(--text-soft);
  user-select: none;
  pointer-events: none;
}

.product-thumb-form-field {
  margin: 0 0 1rem;
}

.product-thumb-form-block {
  margin-bottom: 1rem;
}

.product-thumb-form-actions {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.product-thumb-remove {
  margin: 0 0 0.35rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
}

.product-thumb-fetch-btn {
  margin: 0 0 0.35rem;
}

.product-thumb-add:hover .product-thumb-add-icon {
  color: var(--accent);
}

@media (max-width: 42rem) {
  table.data.table-cards,
  table.data.table-cards tbody,
  table.data.table-cards tr,
  table.data.table-cards td {
    display: block;
    width: 100%;
  }

  table.data.table-cards thead {
    display: none;
  }

  table.data.table-cards tr {
    margin-bottom: 0.85rem;
    padding: 0.85rem 0.75rem;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
  }

  table.data.table-cards td {
    border: none;
    padding: 0.4rem 0;
  }

  table.data.table-cards td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.2rem;
  }

  table.data.table-cards .col-star {
    text-align: left;
  }

  table.data.table-cards .col-thumb::before {
    display: none;
  }

  table.data.table-cards .col-thumb {
    margin-bottom: 0.35rem;
  }

  table.data.table-cards .col-name {
    font-size: 1.05rem;
    font-weight: 650;
  }

  table.data.table-cards .col-name a {
    text-decoration: none;
    color: var(--text);
  }

  table.data.table-cards .col-name a:hover {
    color: var(--accent);
  }

  .dashboard-head {
    padding: 1rem;
  }

  .dashboard-head-title {
    font-size: 1.25rem;
  }
}

.filter-bar {
  line-height: 1.6;
}

.filter-bar a {
  text-decoration: none;
  color: var(--text-muted);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.filter-bar a:hover {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--border);
}

.filter-bar a.filter-active {
  font-weight: 650;
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(79, 70, 229, 0.35);
  text-decoration: none;
}

.filter-sep {
  margin: 0 0.35rem;
  opacity: 0.35;
  color: var(--text-soft);
}

.dashboard-search-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.6rem 0.85rem;
  margin: 0.85rem 0 1rem;
  padding: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.dashboard-search-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1 1 12rem;
  min-width: 0;
}

.dashboard-search-input {
  width: 100%;
  max-width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  font: inherit;
  background: var(--bg-surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dashboard-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.dashboard-search-btn {
  border: none;
}

tr.row-drop-alert td {
  background: var(--warn-bg) !important;
  box-shadow: inset 3px 0 0 #f59e0b;
}

tr.row-link-gone td {
  background: var(--err-bg) !important;
  box-shadow: inset 3px 0 0 var(--err);
}

@media (max-width: 42rem) {
  tr.row-drop-alert {
    box-shadow: inset 3px 0 0 #f59e0b;
    background: var(--warn-bg) !important;
  }

  tr.row-link-gone {
    box-shadow: inset 3px 0 0 var(--err);
    background: var(--err-bg) !important;
  }
}

.dashboard-per-page-bar {
  margin-top: -0.2rem;
}

.dashboard-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.65rem 1rem;
  margin: 1.35rem 0 0.5rem;
  font-size: 0.9rem;
  padding: 0.85rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.dashboard-pagination-pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.4rem;
}

.dashboard-pagination-pages a {
  text-decoration: none;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.dashboard-pagination-pages a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.dashboard-pagination-current {
  font-weight: 700;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-xs);
  background: var(--accent);
  color: #fff;
}

.dashboard-pagination-ellipsis {
  color: var(--text-soft);
  padding: 0 0.15rem;
}

.dashboard-pagination-prev,
.dashboard-pagination-next {
  font-weight: 600;
  text-decoration: none;
}

.dashboard-pagination-prev.is-disabled,
.dashboard-pagination-next.is-disabled {
  color: var(--text-soft);
}

.scroll-top-btn {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 1500;
  width: 3rem;
  height: 3rem;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  background: rgba(79, 70, 229, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.15s ease, background 0.15s ease;
}

.scroll-top-btn.is-visible {
  opacity: 1;
  visibility: visible;
}

.scroll-top-btn:hover {
  background: var(--accent);
  transform: translateY(-2px);
}

.login-narrow {
  max-width: 28rem;
  margin: 2.5rem auto;
}

.login-narrow .add-box,
.login-narrow form {
  margin-top: 0;
}

.login-narrow h1 {
  text-align: center;
  margin-bottom: 1.25rem;
}

code {
  font-size: 0.85em;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}
