/* Alpine Custom Work — Partner Portal */

:root {
  --bg: #0a1a1a;
  --bg-elevated: #0e2222;
  --bg-card: rgba(19, 42, 42, 0.75);
  --text: #f7f4ef;
  --text-muted: #a3aba3;
  --accent: #c17a3a;
  --accent-hover: #d48b48;
  --border: rgba(255,255,255,0.08);
  --sidebar-w: 260px;
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Inter', system-ui, sans-serif;
  --radius: 8px;
  --transition: 0.28s cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 4px;
  transition: all var(--transition);
}
.btn-primary { background: var(--accent); color: #0c0c0c; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-outline {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 8px 14px; font-size: 0.72rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.65; cursor: not-allowed; }

/* ===== Login ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(193,122,58,0.08), transparent 50%),
    var(--bg);
}

.login-wrap {
  width: 100%;
  max-width: 420px;
  animation: fadeUp 0.7s ease forwards;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  justify-content: center;
}
.login-pine { height: 40px; width: auto; }
.login-name {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.4rem;
  font-weight: 700;
  font-style: italic;
  letter-spacing: 0.2em;
}
.login-tag {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.28em;
  color: var(--accent);
  font-weight: 700;
  font-style: italic;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  backdrop-filter: blur(12px);
}

.login-eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
  font-weight: 600;
}
.login-card h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 500;
  margin-bottom: 6px;
}
.login-sub {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 28px;
}

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 14px;
  transition: border-color var(--transition);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.login-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  font-size: 0.85rem;
}
.check { display: flex; align-items: center; gap: 8px; color: var(--text-muted); cursor: pointer; }
.link-muted { color: var(--text-muted); font-size: 0.85rem; }
.link-muted:hover { color: var(--accent); }

.login-note {
  margin-top: 20px;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}
.back-link {
  display: block;
  text-align: center;
  margin-top: 24px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.back-link:hover { color: var(--accent); }

/* ===== Portal shell ===== */
.portal-body {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: rgba(8, 20, 20, 0.97);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  transition: transform var(--transition);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-pine { height: 32px; }
.sidebar-name {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
  font-style: italic;
  letter-spacing: 0.18em;
}
.sidebar-tag {
  display: block;
  font-size: 0.55rem;
  letter-spacing: 0.2em;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
}

.partner-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 14px;
  padding: 12px;
  background: rgba(193,122,58,0.1);
  border: 1px solid rgba(193,122,58,0.25);
  border-radius: var(--radius);
}
.partner-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: #0c0c0c;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
}
.partner-chip strong { display: block; font-size: 0.85rem; }
.partner-chip span { font-size: 0.7rem; color: var(--text-muted); }

.sidebar-nav {
  flex: 1;
  padding: 8px 10px;
  overflow-y: auto;
}
.nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border-radius: 6px;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 2px;
  transition: all var(--transition);
}
.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.nav-item.active {
  background: rgba(193,122,58,0.15);
  color: var(--accent);
  font-weight: 600;
}
.nav-item.subtle { font-size: 0.8rem; }

.sidebar-foot {
  padding: 12px 10px 20px;
  border-top: 1px solid var(--border);
}

.portal-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.portal-top {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 26, 26, 0.9);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 40;
}
.menu-btn {
  display: none;
  font-size: 1.3rem;
  color: var(--text);
  padding: 4px 8px;
}
.top-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  flex: 1;
}
.top-actions { margin-left: auto; }

.portal-content {
  padding: 28px;
  flex: 1;
}

/* Views */
.view {
  display: none;
  animation: viewIn 0.35s ease forwards;
}
.view.active { display: block; }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.welcome h1 {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 500;
  margin-bottom: 4px;
}
.welcome p { color: var(--text-muted); margin-bottom: 28px; }

.page-head { margin-bottom: 28px; }
.page-head h1 {
  font-family: var(--font-serif);
  font-size: 1.9rem;
  font-weight: 500;
  margin-bottom: 6px;
}
.page-head p { color: var(--text-muted); }

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 18px;
  backdrop-filter: blur(10px);
}
.stat-num {
  display: block;
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1.2;
}
.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  backdrop-filter: blur(10px);
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.card-head h3 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 500;
}
.link {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 500;
}
.link:hover { text-decoration: underline; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.list { list-style: none; }
.list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.list li:last-child { border-bottom: none; padding-bottom: 0; }
.list strong { display: block; font-size: 0.92rem; margin-bottom: 2px; }
.muted { color: var(--text-muted); font-size: 0.82rem; }
.time { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.badge-progress { background: rgba(193,122,58,0.2); color: var(--accent); }
.badge-scheduled { background: rgba(100,160,200,0.2); color: #7eb8d8; }
.badge-pending { background: rgba(220,180,80,0.2); color: #e0c060; }
.badge-paid { background: rgba(80,180,120,0.2); color: #7dcea0; }
.badge-open { background: rgba(220,100,100,0.2); color: #e07a7a; }

/* Projects */
.project-list { display: flex; flex-direction: column; gap: 16px; }
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(10px);
  transition: border-color var(--transition);
}
.project-card:hover { border-color: rgba(193,122,58,0.35); }
.project-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}
.project-top h3 {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: 4px;
}
.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.project-actions { display: flex; gap: 8px; margin-bottom: 14px; }
.status-bar {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}
.status-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* Forms */
.form-card { max-width: 640px; }
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.upload-zone {
  border: 1px dashed rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color var(--transition);
}
.upload-zone:hover { border-color: var(--accent); }
.form-success {
  margin-top: 14px;
  color: #7dcea0;
  font-size: 0.9rem;
}

/* Estimates */
.estimate-card { max-width: 520px; }
.estimate-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}
.estimate-head h3 {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  margin-bottom: 4px;
}
.simple-table { width: 100%; margin-bottom: 20px; }
.simple-table td {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.simple-table td:last-child { text-align: right; }
.simple-table .total td {
  font-weight: 700;
  font-size: 1.1rem;
  border-bottom: none;
  padding-top: 14px;
  color: var(--accent);
}
.estimate-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.approve-note {
  margin-top: 16px;
  color: #7dcea0;
  font-size: 0.9rem;
}

/* Documents */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.doc-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition);
  cursor: pointer;
}
.doc-item:hover { border-color: rgba(193,122,58,0.4); }
.doc-item span:first-child { font-size: 1.4rem; }
.doc-item strong { display: block; font-size: 0.9rem; margin-bottom: 2px; }

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table th {
  text-align: left;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 12px 12px 0;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 14px 12px 14px 0;
  border-bottom: 1px solid var(--border);
}

/* Messages */
.messages-card { max-width: 640px; padding: 0; overflow: hidden; }
.msg-thread { padding: 20px; max-height: 400px; overflow-y: auto; }
.msg {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  max-width: 85%;
}
.msg strong { display: block; font-size: 0.8rem; margin-bottom: 4px; }
.msg p { font-size: 0.9rem; margin-bottom: 6px; }
.msg .time { font-size: 0.7rem; color: var(--text-muted); }
.msg.them { background: rgba(255,255,255,0.05); }
.msg.us {
  background: rgba(193,122,58,0.15);
  margin-left: auto;
}
.msg-compose {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.msg-compose input {
  flex: 1;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
}
.msg-compose input:focus { outline: none; border-color: var(--accent); }

/* Properties */
.property-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.property-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color var(--transition);
  cursor: pointer;
}
.property-card:hover { border-color: rgba(193,122,58,0.4); }
.property-card h3 {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  margin-bottom: 4px;
}
.property-card .muted { margin-bottom: 12px; display: block; }

/* History */
.history-list { list-style: none; }
.history-list li {
  display: flex;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.history-list li:last-child { border-bottom: none; }
.hist-date {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  min-width: 80px;
}
.history-list strong { display: block; margin-bottom: 2px; }

/* Responsive */
@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .portal-main { margin-left: 0; }
  .menu-btn { display: block; }
  .portal-content { padding: 20px 16px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .project-top { flex-direction: column; }
}

.form-error {
  margin-top: 14px;
  color: #e07a7a;
  font-size: 0.88rem;
  text-align: center;
}
