/*
 * Google / Material 3 flavored theme for PDF intake.
 *
 * Tokens follow Material Design 3 "sys.color" roles so component rules can stay simple.
 * Palette is seeded from Google Blue (#0b57d0) with Google's neutral surface ramp. Typography
 * prefers Google Sans (if locally installed, e.g. on Google hardware / Chrome) and falls back
 * to Roboto loaded from fonts.googleapis.com. Material Symbols Outlined is used for icons.
 */

:root {
  color-scheme: light;

  /* ----- Material 3 color roles (Google Blue seed) ----- */
  --md-sys-color-primary: #0b57d0;
  --md-sys-color-on-primary: #ffffff;
  --md-sys-color-primary-container: #d3e3fd;
  --md-sys-color-on-primary-container: #041e49;

  --md-sys-color-secondary: #00639b;
  --md-sys-color-on-secondary: #ffffff;
  --md-sys-color-secondary-container: #c2e7ff;
  --md-sys-color-on-secondary-container: #001d33;

  --md-sys-color-tertiary: #146c2e;
  --md-sys-color-on-tertiary: #ffffff;
  --md-sys-color-tertiary-container: #c4eed0;
  --md-sys-color-on-tertiary-container: #072711;

  --md-sys-color-error: #b3261e;
  --md-sys-color-on-error: #ffffff;
  --md-sys-color-error-container: #f9dedc;
  --md-sys-color-on-error-container: #410e0b;

  --md-sys-color-background: #ffffff;
  --md-sys-color-on-background: #1f1f1f;

  --md-sys-color-surface: #ffffff;
  --md-sys-color-on-surface: #1f1f1f;
  --md-sys-color-surface-variant: #e1e3e1;
  --md-sys-color-on-surface-variant: #444746;

  --md-sys-color-surface-container-lowest: #ffffff;
  --md-sys-color-surface-container-low: #f8fafd;
  --md-sys-color-surface-container: #f0f4f9;
  --md-sys-color-surface-container-high: #e9eef6;
  --md-sys-color-surface-container-highest: #dde3ea;

  --md-sys-color-outline: #747775;
  --md-sys-color-outline-variant: #c4c7c5;

  --md-sys-color-inverse-surface: #303030;
  --md-sys-color-inverse-on-surface: #f2f2f2;

  /* Google brand accents for the product mark in the app bar. */
  --google-blue: #4285f4;
  --google-red: #ea4335;
  --google-yellow: #fbbc04;
  --google-green: #34a853;

  /* ----- Elevation (Google Material tonal shadows) ----- */
  --md-sys-elevation-1: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
  --md-sys-elevation-2: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 2px 6px 2px rgba(60, 64, 67, 0.15);
  --md-sys-elevation-3: 0 4px 8px 3px rgba(60, 64, 67, 0.15), 0 1px 3px 0 rgba(60, 64, 67, 0.3);

  /* ----- Shape ----- */
  --md-sys-shape-xs: 4px;
  --md-sys-shape-sm: 8px;
  --md-sys-shape-md: 12px;
  --md-sys-shape-lg: 16px;
  --md-sys-shape-xl: 28px;
  --md-sys-shape-pill: 9999px;

  /* ----- Type ----- */
  --md-sys-typescale-display: "Google Sans Display", "Google Sans", "Roboto Flex", "Roboto",
    system-ui, -apple-system, "Segoe UI", sans-serif;
  --md-sys-typescale-body: "Google Sans Text", "Google Sans", "Roboto", system-ui, -apple-system,
    "Segoe UI", sans-serif;
}

/* -------------------------------------------------------------------------- */
/* Base                                                                       */
/* -------------------------------------------------------------------------- */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--md-sys-typescale-body);
  font-size: 14px;
  line-height: 20px;
  letter-spacing: 0.1px;
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  font-family: var(--md-sys-typescale-display);
  color: var(--md-sys-color-on-surface);
  margin: 0 0 12px;
  font-weight: 500;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
  line-height: 36px;
}

h2 {
  font-size: 22px;
  line-height: 28px;
}

h3 {
  font-size: 18px;
  line-height: 24px;
  font-weight: 500;
}

p {
  margin: 0 0 12px;
}

a {
  color: var(--md-sys-color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* -------------------------------------------------------------------------- */
/* Material Symbols tuning                                                    */
/* -------------------------------------------------------------------------- */

.material-symbols-outlined {
  font-variation-settings:
    "FILL" 0,
    "wght" 400,
    "GRAD" 0,
    "opsz" 24;
  font-size: 20px;
  line-height: 1;
  vertical-align: middle;
  user-select: none;
}

/* -------------------------------------------------------------------------- */
/* Top app bar                                                                */
/* -------------------------------------------------------------------------- */

.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  padding: 0 16px;
  background: var(--md-sys-color-surface);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-bar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.app-bar__logo {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(
    from 180deg at 50% 50%,
    var(--google-blue) 0deg,
    var(--google-red) 90deg,
    var(--google-yellow) 180deg,
    var(--google-green) 270deg,
    var(--google-blue) 360deg
  );
  position: relative;
}

.app-bar__logo::after {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--md-sys-color-surface);
}

.app-bar__title {
  font-family: var(--md-sys-typescale-display);
  font-weight: 500;
  font-size: 22px;
  line-height: 28px;
  color: var(--md-sys-color-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-bar__title--muted {
  color: var(--md-sys-color-on-surface-variant);
  font-weight: 400;
}

.app-bar__nav {
  display: flex;
  gap: 4px;
  align-items: center;
}

.app-bar__nav a,
.app-bar__nav .link-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--md-sys-shape-pill);
  color: var(--md-sys-color-on-surface-variant);
  font-weight: 500;
  font-size: 14px;
  line-height: 20px;
  text-decoration: none;
  transition: background-color 120ms ease;
}

.app-bar__nav a:hover,
.app-bar__nav .link-button:hover {
  background: var(--md-sys-color-surface-container-high);
  text-decoration: none;
}

.app-bar__nav a.active {
  color: var(--md-sys-color-on-primary-container);
  background: var(--md-sys-color-primary-container);
}

/* -------------------------------------------------------------------------- */
/* Layout                                                                     */
/* -------------------------------------------------------------------------- */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 24px 64px;
}

.centered {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--md-sys-color-surface-container);
}

/* Generic inline wrapper used by <form class="inline"> to keep e.g. the sign-out
   button inline with other nav items. */
.inline {
  display: inline-flex;
  align-items: center;
}

/* -------------------------------------------------------------------------- */
/* Cards / surfaces                                                           */
/* -------------------------------------------------------------------------- */

.card {
  background: var(--md-sys-color-surface-container-low);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-lg);
  padding: 20px 24px;
  margin: 16px 0;
}

.card > h1:first-child,
.card > h2:first-child,
.card > h3:first-child {
  margin-top: 0;
}

.card p {
  color: var(--md-sys-color-on-surface-variant);
}

.card p strong {
  color: var(--md-sys-color-on-surface);
  font-weight: 500;
  margin-right: 4px;
}

/* Login / interstitial card: narrower, more elevation, centered content. */
.centered .card {
  width: min(92vw, 420px);
  padding: 32px;
  margin: 0;
  box-shadow: var(--md-sys-elevation-2);
  background: var(--md-sys-color-surface);
}

.centered .card h1 {
  font-family: var(--md-sys-typescale-display);
  font-size: 24px;
  line-height: 32px;
  text-align: center;
  margin-bottom: 8px;
}

.centered .card__subtitle {
  text-align: center;
  color: var(--md-sys-color-on-surface-variant);
  margin-bottom: 24px;
}

.centered .card .app-bar__logo {
  width: 44px;
  height: 44px;
  margin: 0 auto 16px;
}

.centered .card .app-bar__logo::after {
  width: 20px;
  height: 20px;
}

/* -------------------------------------------------------------------------- */
/* Tabs (Material 3 primary tabs with underline indicator)                    */
/* -------------------------------------------------------------------------- */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin: 8px 0 16px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.tab {
  position: relative;
  padding: 14px 20px;
  font-weight: 500;
  font-size: 14px;
  line-height: 20px;
  letter-spacing: 0.1px;
  color: var(--md-sys-color-on-surface-variant);
  text-decoration: none;
  border-radius: 0;
  transition: color 120ms ease, background-color 120ms ease;
}

.tab:hover {
  color: var(--md-sys-color-on-surface);
  background: var(--md-sys-color-surface-container-high);
  text-decoration: none;
}

.tab--active {
  color: var(--md-sys-color-primary);
}

.tab--active::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 3px;
  background: var(--md-sys-color-primary);
  border-radius: 3px 3px 0 0;
}

/* -------------------------------------------------------------------------- */
/* Toolbar (above tables)                                                     */
/* -------------------------------------------------------------------------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 8px 0 16px;
}

.toolbar label {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

/* -------------------------------------------------------------------------- */
/* Tables                                                                     */
/* -------------------------------------------------------------------------- */

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--md-sys-color-surface);
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-md);
  overflow: hidden;
  font-size: 14px;
}

.table thead th {
  background: var(--md-sys-color-surface-container-low);
  color: var(--md-sys-color-on-surface-variant);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.table thead th a {
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  vertical-align: middle;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table tbody tr:hover {
  background: var(--md-sys-color-surface-container);
}

/* -------------------------------------------------------------------------- */
/* Chips (Material 3 assist chip)                                             */
/* -------------------------------------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--md-sys-color-outline);
  background: transparent;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* Confidence bands: Material-style tonal pills. */
.band {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.4px;
  padding: 2px 8px;
  border-radius: var(--md-sys-shape-pill);
  text-transform: uppercase;
  border: 1px solid transparent;
}

.band--green {
  background: #e6f4ea;
  color: #137333;
}

.band--yellow {
  background: #fef7e0;
  color: #b06000;
}

.band--red {
  background: #fce8e6;
  color: #a50e0e;
}

/* -------------------------------------------------------------------------- */
/* Forms                                                                      */
/* -------------------------------------------------------------------------- */

.field {
  display: grid;
  gap: 6px;
  margin: 16px 0;
}

.field span {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
select,
textarea {
  width: 100%;
  max-width: 560px;
  padding: 12px 14px;
  border-radius: var(--md-sys-shape-sm);
  border: 1px solid var(--md-sys-color-outline);
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font: inherit;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--md-sys-color-primary);
  box-shadow: 0 0 0 1px var(--md-sys-color-primary);
}

select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='%23444746'><path d='M5 8l5 5 5-5H5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

/* -------------------------------------------------------------------------- */
/* Buttons (Material 3)                                                       */
/* -------------------------------------------------------------------------- */

button,
.btn {
  font: inherit;
  cursor: pointer;
  border: 0;
  background: transparent;
  color: inherit;
}

button.primary,
button.secondary,
button.danger,
button.tonal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 24px;
  border-radius: var(--md-sys-shape-pill);
  font-weight: 500;
  font-size: 14px;
  line-height: 20px;
  letter-spacing: 0.1px;
  transition: background-color 120ms ease, box-shadow 120ms ease, color 120ms ease;
  margin-top: 8px;
}

button.primary {
  background: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  box-shadow: var(--md-sys-elevation-1);
}

button.primary:hover {
  background: #084ab8;
  box-shadow: var(--md-sys-elevation-2);
}

button.primary:disabled {
  background: var(--md-sys-color-surface-container-high);
  color: var(--md-sys-color-on-surface-variant);
  box-shadow: none;
  cursor: not-allowed;
}

button.secondary,
button.tonal {
  background: var(--md-sys-color-secondary-container);
  color: var(--md-sys-color-on-secondary-container);
}

button.secondary:hover,
button.tonal:hover {
  background: #a8d8f5;
}

button.danger {
  background: var(--md-sys-color-error);
  color: var(--md-sys-color-on-error);
  box-shadow: var(--md-sys-elevation-1);
}

button.danger:hover {
  background: #8c1d17;
  box-shadow: var(--md-sys-elevation-2);
}

/* Text button style: used by "link-button" forms (sign out, etc.) when NOT in
   the app bar (app-bar scopes it to a tonal look via .app-bar__nav). */
.link-button {
  border: 0;
  background: transparent;
  color: var(--md-sys-color-primary);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--md-sys-shape-pill);
  font: inherit;
  font-weight: 500;
}

.link-button:hover {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
}

/* Action row below a form, e.g. Approve button after the review fields. */
.actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

/* -------------------------------------------------------------------------- */
/* Review page grid                                                           */
/* -------------------------------------------------------------------------- */

.review__meta {
  margin-bottom: 16px;
}

.review__grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 24px;
}

@media (max-width: 960px) {
  .review__grid {
    grid-template-columns: 1fr;
  }
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
}

.thumbs figure {
  margin: 0;
  display: grid;
  gap: 8px;
}

.thumbs img {
  width: 100%;
  height: auto;
  aspect-ratio: 8.5 / 11;
  object-fit: contain;
  background: var(--md-sys-color-surface-container);
  border-radius: var(--md-sys-shape-sm);
  border: 1px solid var(--md-sys-color-outline-variant);
}

.thumbs figcaption {
  color: var(--md-sys-color-on-surface-variant);
  font-size: 12px;
  letter-spacing: 0.4px;
  text-align: center;
}

/* -------------------------------------------------------------------------- */
/* Feedback                                                                   */
/* -------------------------------------------------------------------------- */

.error {
  color: var(--md-sys-color-error);
  background: var(--md-sys-color-error-container);
  border-radius: var(--md-sys-shape-sm);
  padding: 10px 12px;
  margin: 8px 0 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Snackbar-style banner, floating near bottom of viewport. */
.banner {
  position: fixed;
  left: 24px;
  right: 24px;
  bottom: 24px;
  margin: 0 auto;
  max-width: 560px;
  background: var(--md-sys-color-inverse-surface);
  color: var(--md-sys-color-inverse-on-surface);
  border: 0;
  border-radius: var(--md-sys-shape-xs);
  padding: 14px 16px;
  box-shadow: var(--md-sys-elevation-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 20;
}

.banner p {
  margin: 0;
  color: inherit;
  font-size: 14px;
}

.banner button.primary {
  background: var(--md-sys-color-primary-container);
  color: var(--md-sys-color-on-primary-container);
  box-shadow: none;
  margin: 0;
  padding: 6px 16px;
  min-height: 32px;
}
