/* Client Portal Template — warm/sketchy aesthetic */
:root {
  --primary: #c96442;
  --primary-dark: #b04d2e;
  --bg: #f0eee9;
  --card-bg: #faf9f6;
  --text: #2c2420;
  --text-muted: #8c8279;
  --border: #e0d8ce;
  --danger: #c94a4a;
  --success: #5a9e6f;
  --warning: #d4a84b;
  --radius: 10px;
}

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

body {
  font-family: Georgia, 'Times New Roman', Times, serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Navigation */
.topnav {
  background: var(--primary);
  color: #fff;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  border-bottom: 3px solid var(--primary-dark);
  box-shadow: 0 2px 8px rgba(201, 100, 66, 0.15);
}
.nav-inner {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nav-brand {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.02em;
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.nav-user { font-size: 0.9rem; opacity: 0.9; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
.btn-link {
  background: none;
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  transition: background 0.2s, border-color 0.2s;
}
.btn-link:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.6);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Login */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 56px);
}
.login-card {
  background: var(--card-bg);
  padding: 2.5rem;
  border-radius: var(--radius);
  box-shadow:
    0 4px 6px -1px rgba(44, 36, 32, 0.08),
    0 0 0 1px var(--border);
  width: 100%;
  max-width: 400px;
  position: relative;
}
.login-card::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 12px;
  right: 12px;
  height: 3px;
  background: var(--primary);
  border-radius: 2px;
  opacity: 0.4;
}
.login-card h1 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
  color: var(--primary);
}
.login-subtitle { color: var(--text-muted); margin-bottom: 1.5rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--text);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(201, 100, 66, 0.12);
}
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transition: all 0.15s;
}
.btn:hover {
  border-color: var(--text-muted);
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 0 var(--primary-dark);
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  box-shadow: 0 2px 0 #9a3d22;
}
.btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 var(--primary-dark);
}
.btn-danger {
  color: var(--danger);
  border-color: var(--danger);
  background: #fff;
}
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-full { width: 100%; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.alert-error {
  background: #fdf2f0;
  color: var(--danger);
  border: 1px solid #f5cdc8;
}

/* Dashboard */
.dashboard-header { margin-bottom: 2rem; }
.dashboard-header h1 { font-size: 1.75rem; color: var(--primary); }
.dashboard-header p { color: var(--text-muted); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}
.module-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
  position: relative;
}
.module-card::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 10px;
  right: 10px;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
  opacity: 0;
  transition: opacity 0.2s;
}
.module-card:hover {
  box-shadow: 0 4px 16px rgba(201, 100, 66, 0.1);
  border-color: var(--primary);
  transform: translateY(-2px);
}
.module-card:hover::after { opacity: 0.5; }
.module-icon { font-size: 2rem; margin-bottom: 0.75rem; color: var(--primary); }
.module-card h3 { margin-bottom: 0.4rem; font-size: 1.1rem; }
.module-card p { font-size: 0.85rem; color: var(--text-muted); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.5rem; color: var(--primary); }

/* Planes iframe */
.iframe-container {
  width: 100%;
  height: calc(100vh - 200px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}
.iframe-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}
.iframe-container.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  border: none;
  border-radius: 0;
}

/* Files */
.upload-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.upload-card h3 { margin-bottom: 1rem; color: var(--primary); font-size: 1.1rem; }

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
th, td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
th {
  background: #e8e2d9;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(201, 100, 66, 0.03); }
.actions { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.actions select { padding: 0.25rem 0.5rem; font-size: 0.8rem; border: 1px solid var(--border); border-radius: 6px; font-family: inherit; }
td .btn { white-space: nowrap; }

/* Status badges */
.status {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  white-space: nowrap;
}
.status-pending { background: #f5edd6; color: #8a7025; }
.status-in_progress { background: #e2dae8; color: #5b3e7a; }
.status-completed { background: #dde8da; color: #3d6b4a; }
.status-blocked { background: #f0d8d6; color: #8a3a3a; }

/* DevStatus badges */
.status-Not-Started { background: #ece6dc; color: #6b6057; }
.status-In-Progress { background: #e2dae8; color: #5b3e7a; }
.status-Done { background: #dde8da; color: #3d6b4a; }
.status-Blocked { background: #f0d8d6; color: #8a3a3a; }

/* TestStatus badges */
.status-Passed { background: #dde8da; color: #3d6b4a; }
.status-Failed { background: #f0d8d6; color: #8a3a3a; }

/* ChangeStatus badges */
.status-Identified { background: #ece6dc; color: #6b6057; }
.status-Staged { background: #e2dae8; color: #5b3e7a; }
.status-In-Process { background: #f5edd6; color: #8a7025; }
.status-Complete { background: #dde8da; color: #3d6b4a; }

/* Type tag */
.type-tag {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.75rem;
  border: 1px dashed var(--border);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--text);
  background: #fff;
  white-space: nowrap;
}

/* Changelog table */
.changelog-table .change-parent td {
  background: #e8e2d9;
  font-weight: 600;
}
.parent-status-cell {
  text-align: center;
  vertical-align: middle;
}
.changelog-table .toggle-cell {
  text-align: center;
  vertical-align: middle;
}
.toggle-icon {
  cursor: pointer;
  font-size: 0.9rem;
  user-select: none;
  display: inline-block;
  width: 18px;
}
.change-parent .obj-name {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
}
.change-parent .desc {
  font-family: Georgia, 'Times New Roman', Times, serif;
  font-size: 0.85rem;
}
.children-cell {
  padding: 4px 10px 14px 10px !important;
}
.child-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  box-shadow: 0 2px 8px rgba(44, 36, 32, 0.06);
  overflow: hidden;
}
.child-header {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 4px 10px;
  border-bottom: 1px dashed var(--border);
  background: #f3efe2;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.child-header strong {
  color: var(--text);
  font-family: 'Courier New', Courier, monospace;
}
.child-table {
  width: 100%;
  border-collapse: collapse;
  border: none;
  border-radius: 0;
}
.child-table th {
  font-size: 0.7rem;
  padding: 4px 8px;
  background: transparent;
  color: var(--text-muted);
  border-bottom: 1px dashed var(--border);
}
.child-table td {
  padding: 5px 8px;
  font-size: 0.8rem;
  border-bottom: 1px dashed var(--border);
  background: transparent;
}
.child-table tr:last-child td {
  border-bottom: none;
}
.child-table .obj-name {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
  font-weight: 600;
}
.child-table .desc {
  font-family: Georgia, 'Times New Roman', Times, serif;
  font-size: 0.8rem;
}

/* Date cells */
.date-cell {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Priority rows */
.priority-critical td { background: #fdf2f0; }
.priority-high td { background: #faf3e8; }

/* Links */
.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.link-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, border-color 0.2s;
  position: relative;
}
.link-card::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 10px;
  right: 10px;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
  opacity: 0;
  transition: opacity 0.2s;
}
.link-card:hover {
  box-shadow: 0 4px 16px rgba(201, 100, 66, 0.1);
  border-color: var(--primary);
}
.link-card:hover::after { opacity: 0.5; }
.link-card h3 { margin-bottom: 0.3rem; color: var(--primary); }
.link-card p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
.link-arrow { align-self: flex-end; color: var(--primary); font-size: 1.2rem; }

/* Create card */
.create-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.create-card h3 { margin-bottom: 1rem; color: var(--primary); font-size: 1.1rem; }

/* Empty state */
.empty-state { color: var(--text-muted); text-align: center; padding: 2rem; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
.empty-state h2 { color: var(--text); margin-bottom: 0.5rem; font-family: Georgia, 'Times New Roman', Times, serif; }
.empty-state a { color: var(--primary); }

/* Icons (simple text-based for now) */
.icon-clipboard-list::before { content: '📋'; }
.icon-arrows-spin::before { content: '🔄'; }
.icon-folder-open::before { content: '📁'; }
.icon-link::before { content: '🔗'; }
.icon-users-gear::before { content: '👥'; }

/* Admin */
.alert-success { background: #edf4ea; color: var(--success); border: 1px solid #c8ddc4; }
.inactive-row td { opacity: 0.5; }
.role-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
.role-admin { background: #f5edd6; color: #8a7025; }
.role-user { background: #e0d8ce; color: #5c5248; }
.users-list table td:last-child { min-width: 200px; }
