:root {
  --ink: #16221c;
  --pine: #123832;
  --pine-light: #1c4b42;
  --sage-bg: #f0f3ec;
  --sage-panel: #e7ecdf;
  --sage-border: #d6ddcc;
  --gold: #b8892b;
  --gold-dark: #8f6a1f;
  --gold-bg: #f6ecd6;
  --coral: #bd5233;
  --coral-bg: #f7e4dd;
  --text-secondary: #5c6b62;
  --text-muted: #8a988e;
  --white: #ffffff;
  --shadow-card: 0 1px 2px rgba(18, 56, 50, 0.06), 0 1px 1px rgba(18, 56, 50, 0.04);
  --shadow-hover: 0 10px 24px rgba(18, 56, 50, 0.10), 0 2px 6px rgba(18, 56, 50, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--sage-bg);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

h1, h2, h3, .slab {
  font-family: 'Roboto Slab', serif;
}

.mono {
  font-family: 'IBM Plex Mono', monospace;
}

a {
  text-decoration: none;
}

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 32px;
  width: 100%;
}

/* Topbar */
.topbar {
  background: var(--pine);
  color: var(--white);
  height: 68px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-mark svg {
  width: 20px;
  height: 20px;
}
.brand-name {
  font-family: 'Roboto Slab', serif;
  font-weight: 600;
  font-size: 19px;
  color: var(--white);
}
.brand-sub {
  font-size: 11px;
  color: #b9ccc4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 1px;
}
.top-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}
.top-nav a {
  color: #d7e4dd;
  font-size: 14.5px;
  font-weight: 500;
  transition: color 0.15s;
}
.top-nav a:hover, .top-nav a.active {
  color: var(--white);
}
.user-chip-container {
  position: relative;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 6px 14px 6px 8px;
  border-radius: 999px;
  font-size: 13.5px;
  color: #eef3ee;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.user-chip:hover {
  background: rgba(255, 255, 255, 0.14);
}
.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--pine);
}

/* User Dropdown Menu */
.user-dropdown {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 8px;
  width: 220px;
  background: var(--white);
  border: 1px solid var(--sage-border);
  border-radius: 12px;
  box-shadow: var(--shadow-hover);
  padding: 8px;
  display: none;
  flex-direction: column;
  z-index: 100;
}
.user-dropdown.show {
  display: flex;
}
.dropdown-header {
  padding: 8px 12px;
  border-bottom: 1px solid var(--sage-border);
  margin-bottom: 6px;
}
.dropdown-header .lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}
.dropdown-header .name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 2px;
  word-break: break-all;
}
.dropdown-header .email {
  font-size: 11px;
  color: var(--text-secondary);
  word-break: break-all;
}
.user-dropdown a, .user-dropdown button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.user-dropdown a:hover {
  background: var(--sage-bg);
  color: var(--ink);
}
.user-dropdown a.danger {
  color: var(--coral);
}
.user-dropdown a.danger:hover {
  background: var(--coral-bg);
}
.user-dropdown svg {
  width: 14px;
  height: 14px;
}

/* Footer */
.footer {
  background: var(--pine);
  color: #c7d8d0;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.footer-inner {
  padding: 34px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}
.footer-brand {
  font-family: 'Roboto Slab', serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--white);
}
.footer-copy {
  font-size: 12.5px;
  color: #8fa89e;
  margin-top: 4px;
}
.footer-links {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}
.footer-links a {
  color: #c7d8d0;
  font-size: 13.5px;
  transition: color 0.15s;
}
.footer-links a:hover {
  color: var(--white);
}

/* Global Auth Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal.show {
  display: flex;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(22, 34, 28, 0.45);
  backdrop-filter: blur(4px);
}
.modal-content {
  position: relative;
  background: var(--white);
  border: 1px solid var(--sage-border);
  border-radius: 18px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-hover);
  padding: 24px;
  z-index: 10;
  animation: modal-zoom 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes modal-zoom {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}
.modal-close:hover {
  color: var(--ink);
  background: var(--sage-bg);
}
.modal-close svg {
  width: 18px;
  height: 18px;
}

/* Modal Title & Header */
.modal-header {
  text-align: center;
  margin-bottom: 20px;
}
.modal-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--gold-bg);
  color: var(--gold-dark);
  margin-bottom: 12px;
}
.modal-icon svg {
  width: 20px;
  height: 20px;
}
.modal-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
  font-family: 'Roboto Slab', serif;
}
.modal-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Auth Alert */
.alert {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 16px;
}
.alert.danger {
  background: var(--coral-bg);
  border: 1px solid #f2cfc4;
  color: var(--coral);
}
.alert.success {
  background: #eef3ee;
  border: 1px solid var(--sage-border);
  color: var(--pine);
}

/* Modal Tabs */
.modal-tabs {
  display: flex;
  background: var(--sage-bg);
  border: 1px solid var(--sage-border);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 20px;
}
.modal-tab {
  flex: 1;
  padding: 6px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}
.modal-tab.active {
  background: var(--white);
  color: var(--pine);
  box-shadow: var(--shadow-card);
}

/* Forms and Inputs */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 12.8px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}
.input-wrap {
  position: relative;
}
.input-wrap input, .input-wrap select, .input-wrap textarea {
  width: 100%;
  height: 44px;
  border: 1px solid var(--sage-border);
  border-radius: 10px;
  padding: 0 14px 0 42px;
  font-size: 13.8px;
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  background: var(--white);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-wrap textarea {
  height: 100px;
  padding: 12px 14px 12px 42px;
  resize: vertical;
}
.input-wrap input:focus, .input-wrap select:focus, .input-wrap textarea:focus {
  border-color: var(--pine);
  box-shadow: 0 0 0 3px rgba(18, 56, 50, 0.08);
}
.input-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}
.input-wrap.textarea-wrap svg {
  top: 20px;
  transform: none;
}
.input-wrap.no-icon input, .input-wrap.no-icon select, .input-wrap.no-icon textarea {
  padding-left: 14px;
}

/* Spinner and Buttons */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}
.spinner.dark {
  border-color: rgba(18, 56, 50, 0.15);
  border-top-color: var(--pine);
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn-primary {
  width: 100%;
  height: 44px;
  background: var(--pine);
  color: var(--white);
  border: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  transition: background 0.15s;
}
.btn-primary:hover {
  background: var(--pine-light);
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.btn-primary svg {
  width: 15px;
  height: 15px;
}

/* Social Buttons */
.social-login {
  border-top: 1px solid var(--sage-border);
  margin-top: 20px;
  padding-top: 16px;
  text-align: center;
}
.social-login p {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 0;
  margin-bottom: 12px;
}
.btn-google {
  width: 100%;
  height: 42px;
  background: var(--white);
  border: 1px solid var(--sage-border);
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.15s;
  font-family: 'Inter', sans-serif;
}
.btn-google:hover {
  background: var(--sage-bg);
  border-color: #c9d5be;
}
.btn-google img {
  width: 16px;
  height: 16px;
}

/* Responsive elements */
@media (max-width: 768px) {
  .top-nav {
    display: none;
  }
  .wrap {
    padding: 0 16px;
  }
}

.hidden {
  display: none !important;
}
