/* Card Scanner - web dashboard
   Mirrors the Android app's palette so the two feel like one product. */

:root {
  --blue: #1565c0;
  --blue-dark: #0d47a1;
  --blue-soft: #e8f1fb;
  --green: #2e7d32;
  --red: #c62828;
  --ink: #263238;
  --ink-2: #546e7a;
  --ink-3: #90a4ae;
  --line: #e0e6eb;
  --bg: #f4f6f8;
  --card: #ffffff;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* ------------------------------------------------------------- topbar --- */
.topbar { background: var(--blue); color: #fff; }
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 58px; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: rgba(255,255,255,.18);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; letter-spacing: .5px;
}
.brand-name { font-weight: 700; letter-spacing: .3px; }

.nav { display: flex; align-items: center; gap: 14px; font-size: 14px; flex-wrap: wrap; }
.nav a { color: #cfe3f8; text-decoration: none; }
.nav a:hover, .nav a.is-active { color: #fff; }
.who { color: #cfe3f8; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout { border: 1px solid rgba(255,255,255,.35); padding: 4px 10px; border-radius: 6px; }

.badge {
  font-size: 10px; font-weight: 700; letter-spacing: .5px;
  padding: 3px 7px; border-radius: 4px;
}
.badge-pro { background: #ffc107; color: #4e342e; }
.badge-free { background: rgba(255,255,255,.2); color: #fff; }

/* --------------------------------------------------------------- cards --- */
.panel {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin: 20px 0;
}

h1 { font-size: 22px; margin: 24px 0 4px; }
h2 { font-size: 17px; margin: 0 0 14px; }
.sub { color: var(--ink-2); font-size: 14px; margin: 0 0 20px; }

/* --------------------------------------------------------------- forms --- */
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=search], textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; font: inherit; color: var(--ink); background: #fff;
}
input:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue); }
textarea { min-height: 82px; resize: vertical; }
.field { margin-bottom: 15px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.btn {
  display: inline-block; border: 0; border-radius: 8px; cursor: pointer;
  padding: 10px 18px; font: inherit; font-weight: 600; text-decoration: none;
  background: var(--blue); color: #fff;
}
.btn:hover { background: var(--blue-dark); }
.btn-green { background: var(--green); }
.btn-green:hover { background: #1b5e20; }
.btn-ghost { background: #fff; color: var(--ink-2); border: 1px solid var(--line); }
.btn-ghost:hover { background: #f5f7f9; color: var(--ink); }
.btn-danger { background: #fff; color: var(--red); border: 1px solid #f2c6c6; }
.btn-danger:hover { background: #fdecec; }
.btn[disabled], .btn.is-disabled { background: var(--ink-3); cursor: not-allowed; pointer-events: none; }

/* -------------------------------------------------------------- alerts --- */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fdecec; color: #a11; border: 1px solid #f2c6c6; }
.alert-ok { background: #e8f5e9; color: #1b5e20; border: 1px solid #c3e6c8; }
.alert-info { background: var(--blue-soft); color: #0d3c6e; border: 1px solid #c5dcf5; }
.alert-warn { background: #fff8e1; color: #8a5a00; border: 1px solid #ffe082; }

/* ---------------------------------------------------------------- auth --- */
.auth { max-width: 400px; margin: 48px auto; }
.auth .panel { padding: 26px; }
.auth h1 { margin-top: 0; }
.auth .btn { width: 100%; text-align: center; }
.switch { text-align: center; margin-top: 16px; font-size: 14px; color: var(--ink-2); }
.switch a { color: var(--blue); font-weight: 600; }

/* ------------------------------------------------------------ toolbar --- */
.toolbar {
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  flex-wrap: wrap; margin: 18px 0;
}
.search-form { display: flex; gap: 8px; flex: 1 1 280px; max-width: 420px; }
.count { color: var(--ink-2); font-size: 14px; }

/* --------------------------------------------------------------- table --- */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; min-width: 760px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { background: #fafbfc; color: var(--ink-2); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcff; }
td.actions { white-space: nowrap; text-align: right; }
td.actions a { font-size: 13px; margin-left: 10px; color: var(--blue); text-decoration: none; font-weight: 600; }
td.actions a.danger { color: var(--red); }
.muted { color: var(--ink-3); }

.thumb { width: 44px; height: 30px; object-fit: cover; border-radius: 4px; border: 1px solid var(--line); }
.thumb-empty {
  width: 44px; height: 30px; border-radius: 4px; background: var(--blue-soft);
  display: grid; place-items: center; color: var(--blue); font-size: 11px; font-weight: 700;
}

/* ----------------------------------------------------------- pagination --- */
.pager { display: flex; gap: 8px; justify-content: center; margin: 20px 0; flex-wrap: wrap; }
.pager a, .pager span {
  padding: 7px 12px; border-radius: 6px; text-decoration: none;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2); font-size: 14px;
}
.pager .is-current { background: var(--blue); color: #fff; border-color: var(--blue); }

/* --------------------------------------------------------------- empty --- */
.empty { text-align: center; padding: 56px 20px; color: var(--ink-2); }
.empty-icon { font-size: 40px; }
.empty h2 { margin: 12px 0 6px; color: var(--ink); }

/* -------------------------------------------------------------- detail --- */
.card-images { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; }
.card-images figure { margin: 0; }
.card-images img { max-width: 260px; border-radius: 8px; border: 1px solid var(--line); display: block; }
.card-images figcaption { font-size: 12px; color: var(--ink-3); margin-top: 5px; }

.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 20px; flex-wrap: wrap; }
.spacer { flex: 1; }

/* -------------------------------------------------------------- footer --- */
.footer { color: var(--ink-3); font-size: 13px; padding: 28px 0 40px; text-align: center; }
.footer p { margin: 4px 0; }
.footer-links a { color: var(--ink-2); text-decoration: none; }
.footer-links a:hover { color: var(--blue); text-decoration: underline; }
.footer-links span { margin: 0 6px; }

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .who { display: none; }
}
