/* ---------------------------------------------------------------------------
 * Binteca TenderOps
 *
 * The design system is shared with Binteca SalesOps (src/views/layout.js in
 * that repo) so the two products read as one suite: the same tokens, the same
 * Apple-style typography and radii, the same frosted-glass chrome, the same
 * dark-mode palette. Class names are TenderOps's own — this is a restyle, not
 * a rewrite, so public/app.js renders unchanged.
 *
 * Keep the :root / dark-mode token blocks in step with SalesOps when either
 * moves. Everything below is expressed in tokens for exactly that reason.
 * ------------------------------------------------------------------------- */

:root {
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-active: #005bb5;
  --accent-light: rgba(0, 113, 227, 0.08);
  --bg: #f5f5f7;
  --bg-gradient: radial-gradient(circle at 50% 0%, rgba(0, 113, 227, 0.04) 0%, transparent 70%);
  --panel: rgba(255, 255, 255, 0.85);
  --panel-solid: #ffffff;
  --panel-subtle: #fbfbfd;
  --panel-hover: rgba(0, 113, 227, 0.03);
  --ink: #1d1d1f;
  --ink-secondary: #424245;
  --muted: #86868b;
  --hair: rgba(0, 0, 0, 0.08);
  --hair-subtle: rgba(0, 0, 0, 0.04);
  --ok: #34c759;
  --ok-bg: rgba(52, 199, 89, 0.1);
  --ok-border: rgba(52, 199, 89, 0.25);
  --warn: #ff9500;
  --warn-bg: rgba(255, 149, 0, 0.1);
  --warn-border: rgba(255, 149, 0, 0.25);
  --bad: #ff3b30;
  --bad-bg: rgba(255, 59, 48, 0.1);
  --bad-border: rgba(255, 59, 48, 0.25);
  --info: #5856d6;
  --info-bg: rgba(88, 86, 214, 0.1);
  --info-border: rgba(88, 86, 214, 0.25);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 9999px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 2px 6px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 16px 40px -6px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.03);
  --blur: blur(20px) saturate(180%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #2997ff;
    --accent-hover: #47a7ff;
    --accent-active: #147ce5;
    --accent-light: rgba(41, 151, 255, 0.12);
    --bg: #000000;
    --bg-gradient: radial-gradient(circle at 50% 0%, rgba(41, 151, 255, 0.08) 0%, transparent 70%);
    --panel: rgba(28, 28, 30, 0.85);
    --panel-solid: #1c1c1e;
    --panel-subtle: #2c2c2e;
    --panel-hover: rgba(255, 255, 255, 0.04);
    --ink: #f5f5f7;
    --ink-secondary: #d2d2d7;
    --muted: #86868b;
    --hair: rgba(255, 255, 255, 0.12);
    --hair-subtle: rgba(255, 255, 255, 0.06);
    --ok: #30d158;
    --ok-bg: rgba(48, 209, 88, 0.15);
    --ok-border: rgba(48, 209, 88, 0.3);
    --warn: #ffd60a;
    --warn-bg: rgba(255, 214, 10, 0.15);
    --warn-border: rgba(255, 214, 10, 0.3);
    --bad: #ff453a;
    --bad-bg: rgba(255, 69, 58, 0.15);
    --bad-border: rgba(255, 69, 58, 0.3);
    --info: #7d7aff;
    --info-bg: rgba(125, 122, 255, 0.16);
    --info-border: rgba(125, 122, 255, 0.3);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.65);
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  position: relative;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    "SF Pro", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13.5px;
  line-height: 1.45;
  letter-spacing: -0.01em;
  background: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}

a:hover {
  opacity: 0.85;
}

/* ---------------------------------------------------------------------------
 * Header & navigation
 * ------------------------------------------------------------------------- */

.app-header {
  background: var(--panel);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--hair);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  max-width: 100vw;
  overflow-x: clip;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.header-container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--ink);
}

.brand-badge {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(0, 113, 227, 0.3);
  flex-shrink: 0;
}

.brand-title {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.app-nav {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  white-space: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  max-width: calc(100vw - 260px);
}

.app-nav::-webkit-scrollbar {
  display: none;
}

.app-nav a {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.app-nav a:hover {
  color: var(--ink);
  background: var(--hair-subtle);
  opacity: 1;
}

.app-nav a.active {
  color: var(--accent);
  background: var(--accent-light);
  font-weight: 600;
}

.user-box {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

body:not(.authed) .user-box {
  display: none;
}

body:not(.is-admin) .admin-only {
  display: none;
}

.user-name {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-name:hover {
  color: var(--accent);
  opacity: 1;
}

@media (max-width: 900px) {
  .header-container {
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px 8px;
  }

  .brand {
    justify-content: flex-start;
  }

  .app-nav {
    max-width: 100%;
    width: 100%;
    margin-left: 0;
    padding-bottom: 3px;
  }

  .user-box {
    justify-content: space-between;
  }

  .user-name {
    max-width: none;
  }
}

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

.main-container {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 24px 60px;
  overflow-x: hidden;
}

@media (max-width: 768px) {
  .main-container {
    padding: 16px 14px 48px;
  }
}

.app-footer {
  border-top: 1px solid var(--hair);
  background: var(--panel-subtle);
  color: var(--muted);
  font-size: 12px;
}

.footer-container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .footer-container {
    padding: 14px;
  }
}

/* ---------------------------------------------------------------------------
 * View headers
 * ------------------------------------------------------------------------- */

.view-header {
  margin-bottom: 20px;
}

.view-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--ink);
  margin-bottom: 4px;
}

.view-subtitle {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.view-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.view-header-row .view-header {
  flex: 1;
  min-width: 220px;
  margin-bottom: 0;
}

.view-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

@media (max-width: 640px) {
  .view-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .view-actions {
    width: 100%;
  }

  .view-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .view-title {
    font-size: 19px;
  }
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 12px;
}

.back-link:hover {
  color: var(--accent);
  opacity: 1;
}

.section-title,
.form-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink);
  margin: 22px 0 12px;
}

.form-section-title {
  padding-top: 16px;
  border-top: 1px solid var(--hair);
}

.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.section-header-row .section-title {
  margin-bottom: 0;
}

/* ---------------------------------------------------------------------------
 * KPI tiles
 * ------------------------------------------------------------------------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--panel-solid);
  border: 1px solid var(--hair);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  position: relative;
  overflow: hidden;
}

.kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.kpi-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  font-weight: 600;
}

.kpi-value {
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
  letter-spacing: -0.5px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.kpi-card.warning {
  border-color: var(--warn-border);
  background: var(--warn-bg);
}

.kpi-card.warning .kpi-value {
  color: var(--warn);
}

.kpi-card.urgent {
  border-color: var(--bad-border);
  background: var(--bad-bg);
}

.kpi-card.urgent .kpi-value {
  color: var(--bad);
}

@media (max-width: 600px) {
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .kpi-card {
    padding: 14px 16px;
  }

  .kpi-value {
    font-size: 19px;
  }
}

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

/* ---------------------------------------------------------------------------
 * Panels & cards
 * ------------------------------------------------------------------------- */

.panels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(520px, 1fr));
  gap: 18px;
  /* A grid item defaults to min-width:auto, so a wide table expands its own
   * track and scrolls the whole document rather than its own container.
   * rules: every web surface must not scroll horizontally at 375px. */
  align-items: start;
}

.panels-grid > * {
  min-width: 0;
}

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

.panel,
.detail-card {
  background: var(--panel-solid);
  border: 1px solid var(--hair);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  max-width: 100%;
  min-width: 0;
}

.panels-grid .panel {
  margin-bottom: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: var(--ink);
}

.panel-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-light);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

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

.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
  max-width: 100%;
  min-width: 0;
}

.app-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  /* Wide enough that columns do not crush, narrow enough that the five-column
   * dashboard tables fit their panel track without scrolling. Wider tables
   * (pipeline, tasks) scroll inside .table-container, never the document. */
  min-width: 520px;
}

.app-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--hair);
  font-weight: 600;
  white-space: nowrap;
  background: var(--panel-subtle);
}

.app-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--hair-subtle);
  vertical-align: middle;
}

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

.app-table tbody tr:hover {
  background: var(--panel-hover);
}

.table-link {
  font-weight: 600;
  color: var(--accent);
}

.table-link:hover {
  opacity: 0.8;
}

/* ---------------------------------------------------------------------------
 * Badges & chips
 * ------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  line-height: 1.25;
  white-space: nowrap;
}

.badge-green,
.badge-done {
  color: var(--ok);
  border-color: var(--ok-border);
  background: var(--ok-bg);
}

.badge-amber,
.badge-open {
  color: var(--warn);
  border-color: var(--warn-border);
  background: var(--warn-bg);
}

.badge-red {
  color: var(--bad);
  border-color: var(--bad-border);
  background: var(--bad-bg);
}

.badge-blue {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  background: var(--accent-light);
}

.badge-gray {
  color: var(--muted);
  border-color: var(--hair);
  background: var(--hair-subtle);
}

.days-chip {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  color: var(--muted);
  background: var(--hair-subtle);
  border: 1px solid var(--hair);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.meta-line {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* ---------------------------------------------------------------------------
 * Buttons
 * ------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.35;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.28);
}

.btn:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  filter: brightness(1.04);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.35);
  opacity: 1;
}

.btn:active {
  background: var(--accent-active);
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-sm {
  padding: 4px 11px;
  font-size: 12px;
}

.btn-outline,
.btn-ghost {
  background: var(--panel-solid);
  border-color: var(--hair);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.btn-outline:hover:not(:disabled),
.btn-ghost:hover:not(:disabled) {
  background: var(--panel-subtle);
  border-color: rgba(0, 0, 0, 0.16);
  filter: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
  .btn-outline:hover:not(:disabled),
  .btn-ghost:hover:not(:disabled) {
    border-color: rgba(255, 255, 255, 0.26);
  }
}

.user-box .btn-outline {
  padding: 4px 11px;
  font-size: 12px;
}

.user-box .btn-outline:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  background: var(--panel-solid);
  border-color: var(--bad-border);
  color: var(--bad);
  box-shadow: none;
}

.btn-danger:hover:not(:disabled) {
  background: var(--bad-bg);
  border-color: var(--bad);
  filter: none;
  box-shadow: none;
}

.btn-link-danger {
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.btn-link-danger:hover {
  color: var(--bad);
  background: var(--bad-bg);
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  width: 100%;
}

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

.form-field {
  margin-bottom: 0;
  width: 100%;
  min-width: 0;
}

.form-field.span-2 {
  grid-column: 1 / -1;
}

.form-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-field label .req {
  color: var(--bad);
  margin-left: 2px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="search"],
select,
textarea {
  width: 100%;
  max-width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--hair);
  border-radius: var(--radius-sm);
  background: var(--panel-solid);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px var(--accent-light);
}

.form-field textarea,
textarea {
  resize: vertical;
  min-height: 72px;
}

.form-hint {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.form-errors {
  display: none;
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  border: 1px solid var(--bad-border);
  background: var(--bad-bg);
  color: var(--bad);
}

.form-errors.visible {
  display: block;
}

.form-errors ul {
  margin: 6px 0 0 18px;
}

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

.toolbar label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.toolbar input[type="search"],
.toolbar select {
  width: auto;
  min-width: 200px;
  flex: 1;
  max-width: 340px;
}

@media (max-width: 560px) {
  .toolbar {
    align-items: stretch;
  }

  .toolbar input[type="search"],
  .toolbar select {
    max-width: none;
    width: 100%;
    flex: 1 1 100%;
  }
}

.select-inline {
  width: auto;
  max-width: 170px;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* Repeater rows (requirements / partners inside the tender form) */
.repeater {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.repeater-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  background: var(--panel-subtle);
}

.repeater-row.partner-row {
  grid-template-columns: 1fr 1fr auto 1fr auto;
}

.repeater-row input,
.repeater-row select {
  font-size: 13px;
  padding: 6px 10px;
  background: var(--panel-solid);
}

.repeater-row .mandatory-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.repeater-row .mandatory-toggle input {
  width: auto;
  accent-color: var(--accent);
}

.repeater-add {
  align-self: flex-start;
  margin-top: 8px;
}

@media (max-width: 720px) {
  .repeater-row,
  .repeater-row.partner-row {
    grid-template-columns: 1fr;
  }

  .repeater-row .btn-link-danger {
    justify-self: end;
  }
}

/* ---------------------------------------------------------------------------
 * Detail view
 * ------------------------------------------------------------------------- */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

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

.detail-item {
  min-width: 0;
}

.detail-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 600;
}

.detail-value {
  margin-top: 3px;
  font-size: 14px;
  word-break: break-word;
}

.text-section {
  margin-top: 18px;
}

.text-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.text-section-body {
  white-space: pre-wrap;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-secondary);
}

.empty-msg,
.loading-state {
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
}

/* ---------------------------------------------------------------------------
 * Modals
 * ------------------------------------------------------------------------- */

.modal {
  border: 1px solid var(--hair);
  border-radius: var(--radius-xl);
  padding: 0;
  width: min(760px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  background: var(--panel-solid);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-confirm {
  width: min(440px, calc(100vw - 32px));
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-content {
  padding: 24px 26px;
  max-height: calc(100vh - 64px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 560px) {
  .modal-content {
    padding: 20px 16px;
  }
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--ink);
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--hair);
  flex-wrap: wrap;
}

@media (max-width: 480px) {
  .modal-actions .btn {
    flex: 1;
    justify-content: center;
  }
}

.confirm-message {
  font-size: 13.5px;
  color: var(--ink-secondary);
  line-height: 1.5;
}

/* ---------------------------------------------------------------------------
 * Toasts
 * ------------------------------------------------------------------------- */

.toast-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(360px, calc(100vw - 32px));
}

.toast {
  padding: 11px 16px;
  border-radius: var(--radius);
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.toast-success {
  background-color: #248a3d;
}

.toast.toast-error {
  background-color: #c9271e;
}

.toast.toast-info {
  background-color: var(--accent);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ---------------------------------------------------------------------------
 * Sign-in / forced password change
 * ------------------------------------------------------------------------- */

.auth-wrap {
  min-height: calc(100vh - 220px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
}

.auth-card {
  width: 100%;
  max-width: 410px;
  background: var(--panel);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-xl);
  padding: 40px 36px 32px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: card-fade-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  .auth-card {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(28, 28, 30, 0.85);
  }
}

@keyframes card-fade-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.auth-card .brand-badge {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), #004fb0);
  font-size: 26px;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(0, 113, 227, 0.32);
}

.auth-title {
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  color: var(--ink);
}

.auth-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.45;
}

.auth-card .form-field {
  text-align: left;
  margin-bottom: 18px;
}

.auth-card .form-field label {
  margin-bottom: 6px;
}

.auth-card input {
  padding: 11px 14px;
  font-size: 14px;
  border-radius: 10px;
}

.auth-card .btn {
  width: 100%;
  padding: 11px 18px;
  font-size: 14px;
  margin-top: 6px;
}

.auth-card .form-errors {
  text-align: left;
}

/* ---------------------------------------------------------------------------
 * Error page & noscript
 * ------------------------------------------------------------------------- */

.error-page {
  max-width: 480px;
  margin: 0 auto;
  padding: 64px 20px;
  text-align: center;
}

.error-code {
  font-size: 64px;
  font-weight: 700;
  letter-spacing: -2px;
  color: var(--accent);
  line-height: 1;
}

.error-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-top: 12px;
  color: var(--ink);
}

.error-text {
  font-size: 13.5px;
  color: var(--muted);
  margin: 8px 0 24px;
  line-height: 1.5;
}

.error-home-link {
  display: inline-flex;
}

.noscript-warning {
  padding: 16px;
  margin: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--warn-border);
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 13.5px;
  text-align: center;
}
