:root {
  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --accent: #1e6f6a;
  --accent-hover: #185c58;
  --accent-soft: rgba(30, 111, 106, 0.12);
  --border: rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.08);
  --radius: 14px;
  --radius-sm: 10px;
  --font: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
  --error: #d70015;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 240px;
  background: linear-gradient(180deg, rgba(30, 111, 106, 0.07) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

/* Topbar */
.topbar {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  height: 34px;
  width: auto;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-title {
  font-weight: 600;
  font-size: 15px;
}

.brand-subtitle {
  color: var(--text-secondary);
  font-size: 12px;
}

/* Layout */
.wrap {
  position: relative;
  z-index: 1;
  flex: 1;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 40px 24px 64px;
}

.foot {
  position: relative;
  z-index: 1;
  padding: 20px 28px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 12px;
}

.foot a {
  color: var(--text-secondary);
  text-decoration: none;
}

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

/* Cards */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 28px;
}

.muted {
  color: var(--text-secondary);
}

/* Login */
.login-card {
  max-width: 400px;
  margin: 48px auto 0;
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 22px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 22px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.field input {
  font-family: inherit;
  font-size: 14px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

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

/* Flash */
.flash {
  max-width: 400px;
  margin: 0 auto 18px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: rgba(215, 0, 21, 0.08);
  border: 1px solid rgba(215, 0, 21, 0.25);
  color: var(--error);
}

.flash p {
  margin: 0;
}

/* Portal */
.portal-head {
  margin-bottom: 28px;
}

.portal-head h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

.empty {
  margin-top: 40px;
  text-align: center;
}

.cards {
  display: grid;
  gap: 18px;
}

.analysis-card h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.analysis-card .topic {
  margin: 0 0 18px;
  font-size: 13px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-ghost {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: #fff;
  color: var(--accent);
  border-color: rgba(30, 111, 106, 0.35);
}

.btn-secondary:hover {
  background: var(--accent-soft);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-ghost:hover {
  color: var(--text);
  border-color: rgba(0, 0, 0, 0.2);
}

.btn-primary:active,
.btn-secondary:active,
.btn-ghost:active {
  transform: scale(0.98);
}

.login-card .btn-primary {
  margin-top: 4px;
  width: 100%;
  padding: 12px;
}

.logout-form {
  margin: 0;
}

/* PDF viewer */
.viewer-body {
  height: 100vh;
  overflow: hidden;
}

.viewer-body::before {
  display: none;
}

.viewer-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}

.viewer-title {
  flex: 1;
  text-align: center;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer-frame {
  flex: 1;
  width: 100%;
  border: 0;
}

/* Transcript */
.transcript {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
