/* ProposalOS — Peritus Digital Dashboard Styles */
/* Colors from config/brand.json */

:root {
  --blue: #1A56DB;
  --teal: #0D9488;
  --green: #059669;
  --dark: #030709;
  --light-bg: #F7F9FB;
  --border: #E2E8F0;
  --text: #1A1A2E;
  --text-secondary: #5A6577;
  --text-muted: #8A95A5;
  --white: #FFFFFF;
  --radius: 8px;
  --radius-lg: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--light-bg);
  color: var(--text);
  line-height: 1.5;
}

/* Navbar */
.navbar {
  background: var(--dark);
  color: white;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-logo {
  background: var(--blue);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.nav-title {
  font-weight: 600;
  font-size: 16px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-links a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.15s;
}

.nav-links a:hover { color: white; }

.nav-user {
  color: rgba(255,255,255,0.5);
  font-size: 13px;
}

.nav-logout {
  color: rgba(255,255,255,0.5) !important;
  font-size: 13px !important;
}

/* Container */
.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* Dashboard Header */
.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.dashboard-header h1 {
  font-size: 24px;
  font-weight: 600;
}

/* Page Header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 600;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

.header-actions {
  display: flex;
  gap: 8px;
}

/* Metrics */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border);
}

.metric-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.metric-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.metric-draft .metric-value { color: var(--text-secondary); }
.metric-sent .metric-value { color: var(--blue); }
.metric-accepted .metric-value { color: var(--green); }
.metric-revenue .metric-value { color: var(--teal); }

/* Filter Bar */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.filter-btn {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  text-decoration: none;
  color: var(--text-secondary);
  background: white;
  border: 1px solid var(--border);
  transition: all 0.15s;
}

.filter-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.filter-btn.active {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}

/* Table */
.proposals-table {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.proposals-table table {
  width: 100%;
  border-collapse: collapse;
}

.proposals-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--light-bg);
  border-bottom: 1px solid var(--border);
}

.proposals-table td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.proposals-table tr:last-child td {
  border-bottom: none;
}

.proposals-table tr:hover {
  background: #FAFBFC;
}

.client-name a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

.client-name a:hover {
  color: var(--blue);
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  text-transform: capitalize;
}

.status-draft { background: #F1F5F9; color: var(--text-secondary); }
.status-sent { background: #DBEAFE; color: #1E40AF; }
.status-viewed { background: #FEF3C7; color: #92400E; }
.status-accepted { background: #D1FAE5; color: #065F46; }
.status-expired { background: #FEE2E2; color: #991B1B; }

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  line-height: 1.4;
}

.btn-primary {
  background: var(--blue);
  color: white;
}

.btn-primary:hover {
  background: #1547B8;
}

.btn-primary:disabled {
  background: #94A3B8;
  cursor: not-allowed;
}

.btn-secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: #CBD5E1;
  background: #FAFBFC;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 13px;
}

.btn-full {
  width: 100%;
  text-align: center;
}

/* Cards */
.card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
}

/* Forms */
.form-card {
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 32px;
}

.form-group {
  margin-bottom: 20px;
  flex: 1;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: white;
  transition: border-color 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

.form-row {
  display: flex;
  gap: 20px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 20px;
}

.alert-error {
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
}

.alert-success {
  background: #F0FDF4;
  color: #166534;
  border: 1px solid #BBF7D0;
}

.alert-warning {
  background: #FFFBEB;
  color: #92400E;
  border: 1px solid #FDE68A;
}

/* Detail Grid */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
}

.detail-main { min-width: 0; }

.detail-list dt {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-top: 12px;
}

.detail-list dt:first-child {
  margin-top: 0;
}

.detail-list dd {
  font-size: 14px;
  color: var(--text);
  margin-top: 2px;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}

.timeline-step {
  position: relative;
  padding-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.timeline-step:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid white;
  position: absolute;
  left: -24px;
  top: 4px;
  z-index: 1;
}

.timeline-step.active .timeline-dot {
  background: var(--green);
}

.timeline-content strong {
  display: block;
  font-size: 14px;
}

.timeline-content span {
  font-size: 13px;
  color: var(--text-muted);
}

/* Actions */
.action-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.action-form {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.action-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.action-done {
  color: var(--green);
  font-weight: 500;
  font-size: 14px;
}

.action-item {
  font-size: 14px;
}

.portal-link {
  word-break: break-all;
  font-size: 13px;
  color: var(--blue);
}

/* Downloads */
.download-grid {
  display: flex;
  gap: 12px;
}

/* Activity Log */
.activity-log {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-event {
  background: var(--light-bg);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
  font-size: 12px;
  white-space: nowrap;
}

.activity-detail {
  flex: 1;
  color: var(--text-secondary);
}

.activity-time {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.activity-ip {
  color: var(--text-muted);
  font-size: 11px;
  font-family: monospace;
}

/* Login Page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  display: inline-flex;
  width: 48px;
  height: 48px;
  background: var(--blue);
  color: white;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 22px;
  margin-bottom: 16px;
}

.login-header h1 {
  font-size: 22px;
  font-weight: 600;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

.btn-microsoft {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 16px;
}

.btn-microsoft:hover {
  border-color: #0078d4;
  background: #f3f9ff;
}

.login-divider {
  position: relative;
  text-align: center;
  margin: 16px 0;
}

.login-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--border);
}

.login-divider span {
  position: relative;
  background: white;
  padding: 0 12px;
  color: var(--text-muted);
  font-size: 13px;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  background: white;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.empty-state a {
  color: var(--blue);
}

.text-muted {
  color: var(--text-muted);
  font-size: 14px;
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ═══ RESPONSIVE ═══ */

/* Tablet */
@media (max-width: 1024px) {
  .metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .detail-grid {
    grid-template-columns: 1fr 280px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  /* Navbar */
  .navbar {
    padding: 0 16px;
    height: auto;
    min-height: 56px;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .nav-brand {
    flex: 1;
    min-width: 0;
  }
  .nav-links {
    width: 100%;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-start;
    order: 3;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.1);
  }
  .nav-links a {
    font-size: 13px;
  }
  .nav-user {
    display: none;
  }

  /* Container */
  .container {
    padding: 20px 16px;
  }

  /* Dashboard header */
  .dashboard-header {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  .dashboard-header .btn {
    text-align: center;
  }

  /* Metrics */
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .metric-card {
    padding: 16px;
  }
  .metric-value {
    font-size: 22px;
  }

  /* Filter bar */
  .filter-bar {
    flex-wrap: wrap;
    gap: 6px;
  }
  .filter-btn {
    padding: 5px 12px;
    font-size: 12px;
  }

  /* Table — hide less important columns on mobile */
  .hide-mobile {
    display: none;
  }
  .proposals-table table {
    min-width: auto;
  }
  .proposals-table th,
  .proposals-table td {
    padding: 10px 12px;
    font-size: 13px;
    white-space: nowrap;
  }

  /* Page header */
  .page-header {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  .page-header h1 {
    font-size: 20px;
  }
  .header-actions {
    flex-wrap: wrap;
  }
  .header-actions .btn {
    flex: 1;
    text-align: center;
    min-width: 0;
  }

  /* Detail grid */
  .detail-grid {
    grid-template-columns: 1fr;
  }

  /* Cards */
  .card {
    padding: 20px;
  }

  /* Forms */
  .form-card {
    padding: 20px;
  }
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  .form-actions {
    flex-direction: column;
  }
  .form-actions .btn {
    width: 100%;
    text-align: center;
  }

  /* Action forms */
  .action-form {
    flex-direction: column;
    gap: 8px;
  }

  /* Activity log */
  .activity-item {
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 0;
  }
  .activity-time {
    width: 100%;
    order: 3;
  }

  /* Downloads */
  .download-grid {
    flex-wrap: wrap;
  }
  .download-grid .btn {
    flex: 1;
    text-align: center;
  }

  /* Timeline */
  .timeline-content strong {
    font-size: 13px;
  }
  .timeline-content span {
    font-size: 12px;
    word-break: break-word;
  }

  /* Managed services table (proposal-new) */
  .ms-pricing-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -20px;
    padding: 0 20px;
  }

  /* Signature image */
  .card img {
    max-width: 100% !important;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .metric-card {
    padding: 12px;
  }
  .metric-value {
    font-size: 20px;
  }
  .metric-label {
    font-size: 12px;
  }
  .navbar {
    padding: 10px 12px;
  }
  .nav-title {
    font-size: 14px;
  }
  .container {
    padding: 16px 12px;
  }
  .form-card {
    padding: 16px;
  }
  .card {
    padding: 16px;
  }
  .page-header h1 {
    font-size: 18px;
  }
  .login-card {
    padding: 28px 20px;
  }
}
