/*
Theme Name: Aerotight Portal
Theme URI: https://aerotight.com.au
Author: WPExperts
Description: Premium client portal for Aerotight – Australia's Airtightness Experts
Version: 2.0.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 8.0
License: Proprietary
Text Domain: aerotight
*/

/* ============================================================
   DESIGN TOKENS
   Light theme — clean, professional, technical
============================================================ */
:root {
  /* Brand */
  --brand:        #003F5C;   /* Aerotight deep navy blue */
  --brand-mid:    #1a6080;
  --brand-light:  #e8f4f8;
  --accent:       #0096C7;   /* bright link/highlight blue */
  --accent-hover: #0077a3;

  /* Neutrals */
  --bg:           #F5F7FA;   /* page background */
  --bg-card:      #FFFFFF;
  --bg-sidebar:   #FFFFFF;
  --bg-topbar:    #FFFFFF;
  --border:       #E2E8F0;
  --border-focus: #0096C7;

  /* Text */
  --text-primary:   #0F1C26;
  --text-secondary: #4A6175;
  --text-muted:     #8AA0B0;
  --text-on-brand:  #FFFFFF;

  /* Status */
  --success:      #059669;
  --success-bg:   #ECFDF5;
  --warning:      #D97706;
  --warning-bg:   #FFFBEB;
  --danger:       #DC2626;
  --danger-bg:    #FEF2F2;
  --info:         #0096C7;
  --info-bg:      #EFF8FF;

  /* Shadows */
  --shadow-xs:    0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:    0 4px 6px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg:    0 10px 24px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.04);
  --shadow-xl:    0 20px 40px rgba(0,0,0,0.10);

  /* Layout */
  --topbar-h:   60px;
  --sidebar-w:  240px;
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;

  /* Spacing */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;

  /* Typography */
  --font-ui:      'Plus Jakarta Sans', system-ui, sans-serif;
  --font-display: 'Syne', sans-serif;
  --font-mono:    'JetBrains Mono', monospace;

  /* Transitions */
  --tr-fast:   0.12s ease;
  --tr-normal: 0.2s ease;
  --tr-slow:   0.35s ease;
}

/* ============================================================
   RESET
============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font-ui); background: var(--bg); color: var(--text-primary); line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
img  { max-width: 100%; height: auto; display: block; }
a    { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
button { font-family: var(--font-ui); cursor: pointer; }
input, select, textarea { font-family: var(--font-ui); }

/* ============================================================
   PORTAL SHELL
   .at-portal-wrap   → flex column, full viewport height
   .at-topbar        → fixed height top bar
   .at-portal-body   → flex row, fills rest
     .at-sidebar     → fixed width, sticky scroll
     .at-main        → flex-1, scrollable
============================================================ */
.at-portal-wrap {
  /* Nothing here — topbar is fixed, body fills below it */
}

/* ─── Top bar ── FIXED, always on top ──────────────────── */
.at-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-6);
  gap: var(--sp-4);
  box-shadow: var(--shadow-xs);
  z-index: 100;
}

/* ─── Body ── fills viewport below topbar ───────────────── */
.at-portal-body {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: row;
}

/* ─── Sidebar ───────────────────────────────────────────── */
.at-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: 100%;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.at-sidebar::-webkit-scrollbar { width: 4px; }
.at-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ─── Main ──────────────────────────────────────────────── */
.at-main {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.at-main::-webkit-scrollbar { width: 6px; }
.at-main::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Inner padding container */
.at-main-inner {
  padding: var(--sp-8) var(--sp-8) var(--sp-12);
  max-width: 1200px;
}

/* ============================================================
   TOPBAR COMPONENTS
============================================================ */
.at-topbar-left {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
}

.at-topbar-logo-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.at-topbar-logo-img {
  height: 34px;
  width: auto;
  display: block;
}

.at-topbar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

/* Hamburger */
#at-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--tr-fast), color var(--tr-fast);
}
#at-menu-toggle:hover { background: var(--bg); color: var(--brand); }

/* Contact button */
.at-topbar-contact {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-4);
  height: 36px;
  background: var(--brand);
  color: var(--text-on-brand);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  transition: background var(--tr-fast);
  white-space: nowrap;
}
.at-topbar-contact:hover { background: var(--brand-mid); color: var(--text-on-brand); }
.at-topbar-contact svg  { width: 14px; height: 14px; flex-shrink: 0; }

/* User chip */
.at-topbar-user {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--tr-fast);
  border: 1px solid var(--border);
}
.at-topbar-user:hover { background: var(--bg); }

.at-topbar-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--brand));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700;
  color: #fff;
  font-family: var(--font-display);
  flex-shrink: 0;
}

.at-topbar-username {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Logout link */
.at-topbar-logout {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-3);
  height: 36px;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: none;
  transition: all var(--tr-fast);
  white-space: nowrap;
}
.at-topbar-logout:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.at-topbar-logout svg { width: 14px; height: 14px; }

/* ============================================================
   SIDEBAR COMPONENTS
============================================================ */
.at-sidebar-brand {
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  border-bottom: 1px solid var(--border);
}

.at-sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.at-sidebar-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--brand));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700;
  color: #fff;
  font-family: var(--font-display);
  flex-shrink: 0;
}

.at-sidebar-user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.at-sidebar-user-role {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Nav sections */
.at-nav-section {
  padding: var(--sp-5) 0 var(--sp-2);
}

.at-nav-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 var(--sp-5) var(--sp-2);
}

.at-nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0.6rem var(--sp-5);
  margin: 1px var(--sp-2);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: calc(100% - var(--sp-4));
  text-align: left;
  transition: all var(--tr-fast);
  position: relative;
}
.at-nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.7; }
.at-nav-item:hover { background: var(--brand-light); color: var(--brand); }
.at-nav-item:hover svg { opacity: 1; }
.at-nav-item.active { background: var(--brand-light); color: var(--brand); font-weight: 600; }
.at-nav-item.active svg { opacity: 1; }
.at-nav-item.active::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--sp-2));
  top: 0; bottom: 0;
  width: 3px;
  background: var(--brand);
  border-radius: 0 2px 2px 0;
}

.at-nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  line-height: 1.4;
}

/* Sidebar footer */
.at-sidebar-footer {
  margin-top: auto;
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border);
}

.at-sidebar-contact-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: var(--brand-light);
  border: 1px solid rgba(0,63,92,0.15);
  border-radius: var(--radius-md);
  color: var(--brand);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--tr-fast);
}
.at-sidebar-contact-btn:hover { background: var(--brand); color: #fff; }
.at-sidebar-contact-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

/* Sidebar backdrop */
.at-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 140;
  backdrop-filter: blur(2px);
}
.at-sidebar-backdrop.open { display: block; }

/* ============================================================
   PAGE HEADER
============================================================ */
.at-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-8);
}

.at-page-title {
  font-family: var(--font-display);
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.at-page-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: var(--sp-1);
}

/* Breadcrumb */
.at-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.at-breadcrumb a { color: var(--text-muted); }
.at-breadcrumb a:hover { color: var(--accent); }
.at-breadcrumb-sep { opacity: 0.4; }
.at-breadcrumb-current { color: var(--text-primary); font-weight: 500; }

/* ============================================================
   STAT CARDS
============================================================ */
.at-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
}

.at-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5) var(--sp-6);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--tr-normal), transform var(--tr-normal);
  position: relative;
  overflow: hidden;
}
.at-stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.at-stat-card-accent {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.at-stat-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
}

.at-stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  background: var(--brand-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--brand);
  flex-shrink: 0;
}
.at-stat-icon svg { width: 20px; height: 20px; }

.at-stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -0.03em;
}

.at-stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: var(--sp-1);
  font-weight: 500;
}

.at-stat-delta {
  font-size: 0.75rem;
  color: var(--success);
  margin-top: var(--sp-2);
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  font-weight: 500;
}

/* ============================================================
   CARDS
============================================================ */
.at-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.at-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
  gap: var(--sp-4);
}

.at-card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}

.at-card-subtitle {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.at-card-body { padding: var(--sp-6); }

/* Card grid */
.at-card-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-6); }
.at-card-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-6); }

/* ============================================================
   TABLE
============================================================ */
.at-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.at-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.at-table thead { background: var(--bg); }

.at-table th {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.at-table td {
  padding: var(--sp-4);
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.at-table tbody tr:last-child td { border-bottom: none; }
.at-table tbody tr:hover td { background: var(--bg); }

/* ============================================================
   BADGES & TAGS
============================================================ */
.at-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}
.at-badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.at-badge-active    { background: var(--success-bg); color: var(--success); }
.at-badge-pending   { background: var(--warning-bg); color: var(--warning); }
.at-badge-completed { background: var(--info-bg);    color: var(--info); }
.at-badge-design    { background: #F3EEFF; color: #7C3AED; }
.at-badge-expired   { background: var(--danger-bg);  color: var(--danger); }
.at-badge-open      { background: var(--success-bg); color: var(--success); }
.at-badge-approved  { background: var(--info-bg);    color: var(--info); }

.at-tag {
  display: inline-flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

/* ============================================================
   BUTTONS
============================================================ */
.at-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-4);
  height: 38px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-ui);
  cursor: pointer;
  border: none;
  transition: all var(--tr-fast);
  white-space: nowrap;
  line-height: 1;
}
.at-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.at-btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-xs); }
.at-btn-primary:hover { background: var(--brand-mid); box-shadow: var(--shadow-sm); color: #fff; }

.at-btn-accent { background: var(--accent); color: #fff; box-shadow: var(--shadow-xs); }
.at-btn-accent:hover { background: var(--accent-hover); box-shadow: var(--shadow-sm); color: #fff; }

.at-btn-outline { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.at-btn-outline:hover { background: var(--brand-light); color: var(--brand); }

.at-btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.at-btn-ghost:hover { background: var(--bg); color: var(--text-primary); border-color: var(--text-muted); }

.at-btn-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(220,38,38,0.2); }
.at-btn-danger:hover { background: var(--danger); color: #fff; }

.at-btn-sm { height: 30px; padding: 0 var(--sp-3); font-size: 0.8125rem; }
.at-btn-lg { height: 46px; padding: 0 var(--sp-6); font-size: 0.9375rem; }

/* ============================================================
   FORMS
============================================================ */
.at-form-group { margin-bottom: var(--sp-5); }

.at-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
}
.at-label .required { color: var(--danger); margin-left: 2px; }

.at-input,
.at-input-full,
.at-select {
  width: 100%;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  color: var(--text-primary);
  padding: 0 var(--sp-4);
  height: 42px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: var(--font-ui);
  outline: none;
  transition: border-color var(--tr-fast), box-shadow var(--tr-fast);
  box-shadow: var(--shadow-xs);
}
.at-input:focus, .at-input-full:focus, .at-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0,150,199,0.12);
}
.at-input::placeholder, .at-input-full::placeholder { color: var(--text-muted); }

.at-select {
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  padding-right: var(--sp-8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238AA0B0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
}

textarea.at-input-full { height: auto; padding: var(--sp-3) var(--sp-4); resize: vertical; min-height: 90px; }

.at-input-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: var(--sp-1); }

/* Search input (with icon) */
.at-search-wrap { position: relative; }
.at-search-wrap .at-search-icon { position: absolute; left: var(--sp-3); top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.at-search-wrap .at-input { padding-left: calc(var(--sp-3) + 16px + var(--sp-2)); }

/* Filter bar */
.at-filter-bar {
  display: flex;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
  flex-wrap: wrap;
  align-items: center;
}
.at-filter-bar .at-search-wrap { flex: 1; min-width: 200px; }

/* ============================================================
   PROJECT LIST ROWS
============================================================ */
.at-project-list { display: flex; flex-direction: column; gap: var(--sp-2); }

.at-project-row {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  transition: all var(--tr-fast);
  cursor: pointer;
}
.at-project-row:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); background: #FAFCFE; }

.at-project-info { flex: 1; min-width: 0; }
.at-project-name { font-size: 0.9375rem; font-weight: 600; color: var(--text-primary); margin-bottom: var(--sp-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.at-project-meta {
  display: flex;
  gap: var(--sp-4);
  flex-wrap: wrap;
  align-items: center;
}
.at-project-meta-item { display: flex; align-items: center; gap: 4px; font-size: 0.78rem; color: var(--text-muted); }
.at-project-meta-item svg { width: 13px; height: 13px; flex-shrink: 0; }

.at-project-actions { display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0; }

/* Progress bar */
.at-progress { height: 4px; background: var(--border); border-radius: 2px; overflow: hidden; margin-top: var(--sp-3); }
.at-progress-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--accent)); border-radius: 2px; transition: width 0.7s ease; }

/* ============================================================
   PROPOSAL CARDS
============================================================ */
.at-proposal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--sp-4); }

.at-proposal-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--tr-normal), transform var(--tr-normal);
}
.at-proposal-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.at-proposal-card-top {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-mid) 100%);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
  color: #fff;
}
.at-proposal-card-title { font-size: 0.9375rem; font-weight: 600; margin-bottom: var(--sp-1); }
.at-proposal-card-project { font-size: 0.78rem; opacity: 0.75; }
.at-proposal-card-value { font-family: var(--font-display); font-size: 1.75rem; font-weight: 700; margin-top: var(--sp-3); letter-spacing: -0.03em; }

.at-proposal-card-body { padding: var(--sp-4) var(--sp-5); }
.at-proposal-card-meta { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4); }
.at-proposal-meta-row { display: flex; flex-direction: column; gap: 2px; }
.at-proposal-meta-label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.at-proposal-meta-value { font-size: 0.875rem; color: var(--text-primary); font-weight: 500; }

.at-proposal-card-footer { display: flex; gap: var(--sp-2); padding: var(--sp-3) var(--sp-5) var(--sp-5); }
.at-proposal-card-footer .at-btn { flex: 1; justify-content: center; }

/* ============================================================
   RESOURCE CARDS
============================================================ */
.at-resource-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--sp-5); }

.at-resource-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--tr-normal);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.at-resource-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--accent); }

.at-resource-thumb { aspect-ratio: 16/9; background: var(--brand-light); position: relative; overflow: hidden; }
.at-resource-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.at-resource-card:hover .at-resource-thumb img { transform: scale(1.04); }

.at-resource-type-badge {
  position: absolute; top: var(--sp-3); left: var(--sp-3);
  background: rgba(255,255,255,0.95);
  color: var(--brand);
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 4px;
  box-shadow: var(--shadow-xs);
}

.at-resource-play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,63,92,0.45);
  opacity: 0; transition: opacity var(--tr-normal);
}
.at-resource-card:hover .at-resource-play-overlay { opacity: 1; }
.at-resource-play-btn { width: 48px; height: 48px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-lg); }
.at-resource-play-btn svg { width: 20px; height: 20px; color: var(--brand); margin-left: 3px; }

.at-resource-body { padding: var(--sp-4) var(--sp-5); flex: 1; display: flex; flex-direction: column; gap: var(--sp-2); }
.at-resource-cat  { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--accent); }
.at-resource-title { font-size: 0.9375rem; font-weight: 600; color: var(--text-primary); line-height: 1.4; }
.at-resource-excerpt { font-size: 0.8125rem; color: var(--text-muted); line-height: 1.6; flex: 1; }

.at-resource-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.at-resource-tags { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* ============================================================
   PHOTO GRID
============================================================ */
.at-photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-2); }
.at-photo-thumb {
  aspect-ratio: 4/3; border-radius: var(--radius-sm); overflow: hidden;
  cursor: pointer; position: relative; background: var(--bg);
  border: 1px solid var(--border);
}
.at-photo-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.at-photo-thumb:hover img { transform: scale(1.05); }
.at-photo-thumb-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,63,92,0.5);
  opacity: 0; transition: opacity var(--tr-normal);
  color: #fff; font-size: 1.25rem;
}
.at-photo-thumb:hover .at-photo-thumb-overlay { opacity: 1; }

/* ============================================================
   MODAL
============================================================ */
.at-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,28,38,0.5);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
}
.at-modal-overlay.active { display: flex; animation: fadeIn 0.15s ease; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.at-modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.at-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border);
}
.at-modal-title { font-size: 1.0625rem; font-weight: 700; color: var(--text-primary); }
.at-modal-close {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text-muted); cursor: pointer; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--tr-fast);
}
.at-modal-close:hover { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.at-modal-body { padding: var(--sp-6); }

/* ============================================================
   EMPTY STATE
============================================================ */
.at-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--sp-12) var(--sp-6);
  text-align: center;
}
.at-empty-icon { width: 56px; height: 56px; background: var(--brand-light); border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; margin-bottom: var(--sp-4); color: var(--brand); }
.at-empty-icon svg { width: 28px; height: 28px; }
.at-empty-title   { font-size: 1rem; font-weight: 600; color: var(--text-primary); margin-bottom: var(--sp-2); }
.at-empty-desc    { font-size: 0.875rem; color: var(--text-muted); max-width: 300px; line-height: 1.6; margin-bottom: var(--sp-5); }

/* ============================================================
   TOAST
============================================================ */
.at-toast {
  position: fixed; bottom: var(--sp-6); right: var(--sp-6); z-index: 400;
  background: var(--text-primary); color: #fff;
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-5);
  display: flex; align-items: center; gap: var(--sp-3);
  font-size: 0.875rem; font-weight: 500;
  box-shadow: var(--shadow-xl);
  transform: translateY(80px); opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease;
  max-width: 340px;
}
.at-toast.show { transform: translateY(0); opacity: 1; }
.at-toast-success { background: var(--success); }
.at-toast-error   { background: var(--danger); }

/* ============================================================
   CONTACT FLOAT
============================================================ */
.at-contact-float {
  position: fixed; bottom: var(--sp-6); right: var(--sp-6); z-index: 200;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lg);
  border: none; cursor: pointer;
  transition: all var(--tr-normal);
}
.at-contact-float:hover { background: var(--brand-mid); transform: scale(1.08); box-shadow: var(--shadow-xl); }
.at-contact-float svg { width: 20px; height: 20px; }

/* ============================================================
   PROJECT DETAIL — TABS
============================================================ */
.at-detail-tabs-wrap {
  display: flex;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-6);
  scrollbar-width: none;
  gap: 0;
  background: var(--bg-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 0 var(--sp-4);
}
.at-detail-tabs-wrap::-webkit-scrollbar { display: none; }

.at-detail-tab {
  flex-shrink: 0;
  padding: var(--sp-4) var(--sp-4);
  border: none; background: none;
  font-family: var(--font-ui); font-size: 0.875rem; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--tr-fast);
  white-space: nowrap;
}
.at-detail-tab:hover  { color: var(--brand); }
.at-detail-tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

/* ============================================================
   MISC LAYOUT HELPERS
============================================================ */
.at-divider   { border: none; border-top: 1px solid var(--border); margin: var(--sp-5) 0; }
.at-spacer-sm { height: var(--sp-4); }
.at-spacer-md { height: var(--sp-6); }
.at-spacer-lg { height: var(--sp-8); }

.at-text-muted   { color: var(--text-muted);   font-size: 0.875rem; }
.at-text-mono    { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); }
.at-text-primary { color: var(--text-primary); }
.at-text-accent  { color: var(--accent); }
.at-text-brand   { color: var(--brand); }
.at-w-full { width: 100%; }
.at-flex   { display: flex; align-items: center; gap: var(--sp-3); }
.at-mb-4   { margin-bottom: var(--sp-4); }
.at-mb-6   { margin-bottom: var(--sp-6); }
.at-mb-8   { margin-bottom: var(--sp-8); }

/* Info rows (key/value pairs) */
.at-info-row {
  display: flex; align-items: flex-start; gap: var(--sp-4);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.at-info-row:last-child { border-bottom: none; }
.at-info-label { min-width: 130px; font-weight: 500; color: var(--text-muted); flex-shrink: 0; }
.at-info-value { color: var(--text-primary); flex: 1; word-break: break-word; }

/* Contact cards */
.at-contact-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: var(--sp-4);
}
.at-contacts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--sp-4); }

/* Milestone timeline */
.at-milestone-list { display: flex; flex-direction: column; gap: 0; }
.at-milestone-row  { display: flex; gap: var(--sp-4); align-items: flex-start; padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); }
.at-milestone-row:last-child { border-bottom: none; }
.at-milestone-dot  { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); background: var(--bg); display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }
.at-milestone-dot.done { background: var(--success); border-color: var(--success); }
.at-milestone-dot.done svg { width: 10px; height: 10px; color: #fff; }

/* Drawing rows */
.at-drawing-row { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); }
.at-drawing-row:last-child { border-bottom: none; }
.at-drawing-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--brand-light); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 1rem; }

/* Defect badges */
.at-defect-open       { background: var(--danger-bg);  color: var(--danger);  padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }
.at-defect-remediated { background: var(--warning-bg); color: var(--warning); padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }
.at-defect-verified   { background: var(--success-bg); color: var(--success); padding: 3px 10px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; }

/* FAQ */
.at-faq-item { border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: var(--sp-2); overflow: hidden; }
.at-faq-question { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: var(--sp-4) var(--sp-5); background: var(--bg-card); border: none; color: var(--text-primary); font-family: var(--font-ui); font-size: 0.9375rem; font-weight: 500; cursor: pointer; text-align: left; transition: background var(--tr-fast); }
.at-faq-question:hover { background: var(--bg); }
.at-faq-icon    { font-size: 1.2rem; transition: transform 0.25s; flex-shrink: 0; color: var(--accent); }
.at-faq-answer  { max-height: 0; overflow: hidden; opacity: 0; transition: max-height 0.3s ease, opacity 0.2s ease; }

/* Revision history */
.at-revisions-panel { display: none; margin-top: var(--sp-3); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.at-revision-row    { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); font-size: 0.8125rem; }
.at-revision-row:last-child { border-bottom: none; }

/* ============================================================
   LOGIN PAGE
============================================================ */
.at-login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-card);
}

.at-login-left {
  background: linear-gradient(160deg, var(--brand) 0%, #001f30 100%);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: var(--sp-10);
  position: relative;
  overflow: hidden;
}
.at-login-left::before {
  content: '';
  position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.at-login-left-logo { position: relative; z-index: 1; }
.at-login-left-logo img { height: 42px; width: auto; }

.at-login-left-content { position: relative; z-index: 1; }
.at-login-left-title { font-family: var(--font-display); font-size: 2rem; font-weight: 700; color: #fff; line-height: 1.2; margin-bottom: var(--sp-4); }
.at-login-left-desc { font-size: 1rem; color: rgba(255,255,255,0.7); line-height: 1.7; }

.at-login-left-features { position: relative; z-index: 1; display: flex; flex-direction: column; gap: var(--sp-3); }
.at-login-feature { display: flex; align-items: center; gap: var(--sp-3); color: rgba(255,255,255,0.85); font-size: 0.875rem; }
.at-login-feature-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

.at-login-right {
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-10);
  background: var(--bg-card);
}

.at-login-form-wrap { width: 100%; max-width: 380px; }

.at-login-form-title { font-family: var(--font-display); font-size: 1.625rem; font-weight: 700; color: var(--text-primary); margin-bottom: var(--sp-2); }
.at-login-form-subtitle { font-size: 0.9rem; color: var(--text-muted); margin-bottom: var(--sp-8); }

.at-login-error {
  background: var(--danger-bg); border: 1px solid rgba(220,38,38,0.2);
  border-radius: var(--radius-sm); padding: var(--sp-3) var(--sp-4);
  font-size: 0.875rem; color: var(--danger); margin-bottom: var(--sp-5);
}

.at-login-forgot { font-size: 0.8125rem; color: var(--accent); font-weight: 500; }
.at-login-forgot:hover { color: var(--accent-hover); }

.at-login-footer { margin-top: var(--sp-8); padding-top: var(--sp-6); border-top: 1px solid var(--border); text-align: center; font-size: 0.8125rem; color: var(--text-muted); }
.at-login-footer a { color: var(--accent); font-weight: 500; }

/* ============================================================
   RESPONSIVE
============================================================ */

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

/* ── 1024px — sidebar collapses to drawer ── */
@media (max-width: 1024px) {
  #at-menu-toggle { display: flex; }

  .at-sidebar {
    display: none;
    position: fixed;
    top: var(--topbar-h);
    left: 0; bottom: 0;
    width: var(--sidebar-w);
    height: auto;
    z-index: 150;
    box-shadow: var(--shadow-xl);
  }
  .at-sidebar.open { display: flex; }
  .admin-bar .at-sidebar { top: calc(var(--topbar-h) + 32px); }

  /* Main takes full width */
  .at-portal-body { left: 0; }

  .at-topbar-contact span { display: none; }
  .at-topbar-username { display: none; }

  .at-main-inner { padding: var(--sp-6); }
  .at-card-grid-2, .at-card-grid-3 { grid-template-columns: 1fr; }
  .at-login-page { grid-template-columns: 1fr; }
  .at-login-left { display: none; }
}

/* ── 768px ── */
@media (max-width: 768px) {
  :root { --topbar-h: 54px; }

  .at-main-inner { padding: var(--sp-4); }
  .at-page-title { font-size: 1.375rem; }
  .at-stats-grid { grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }

  .at-page-header { flex-direction: column; align-items: flex-start; gap: var(--sp-3); }
  .at-page-header > .at-btn { width: 100%; }

  .at-filter-bar { flex-direction: column; }
  .at-filter-bar .at-search-wrap, .at-filter-bar .at-select { width: 100%; min-width: 0; }

  .at-proposal-grid { grid-template-columns: 1fr; }
  .at-resource-grid { grid-template-columns: 1fr; }

  .at-project-row { flex-wrap: wrap; }
  .at-project-actions { width: 100%; justify-content: flex-end; }

  .at-card-header { flex-wrap: wrap; gap: var(--sp-2); }
  .at-topbar-logout span { display: none; }

  .at-photo-grid { grid-template-columns: repeat(2, 1fr); }
  .at-contacts-grid { grid-template-columns: 1fr; }

  .at-table th, .at-table td { padding: var(--sp-3); font-size: 0.8125rem; }

  .at-modal { border-radius: var(--radius-xl) var(--radius-xl) 0 0; position: fixed; bottom: 0; left: 0; right: 0; max-width: 100%; }
  .at-modal-overlay { align-items: flex-end; padding: 0; }

  .at-info-row { flex-direction: column; gap: var(--sp-1); }
  .at-info-label { min-width: auto; }

  .at-contact-float { bottom: var(--sp-4); right: var(--sp-4); width: 44px; height: 44px; }
}

/* ── 480px ── */
@media (max-width: 480px) {
  :root { --topbar-h: 52px; }
  .at-main-inner { padding: var(--sp-3); }
  .at-page-title { font-size: 1.25rem; }
  .at-stats-grid { grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
  .at-stat-value { font-size: 1.625rem; }
  .at-stat-card  { padding: var(--sp-4); }
  .at-resource-excerpt { display: none; }
  .at-detail-tab { font-size: 0.8125rem; padding: var(--sp-3); }
  .at-topbar { padding: 0 var(--sp-3); gap: var(--sp-2); }
  .at-topbar-contact { padding: 0 var(--sp-3); }
  .at-proposal-card-value { font-size: 1.375rem; }
  .at-btn { height: 36px; }
}

/* ── 360px ── */
@media (max-width: 360px) {
  .at-topbar-logo-img { height: 26px; }
  .at-main-inner { padding: var(--sp-2); }
  .at-stats-grid { grid-template-columns: 1fr; }
}

/* ── Touch ── */
@media (hover: none) {
  .at-btn, .at-nav-item { min-height: 44px; }
  .at-input, .at-input-full, .at-select { font-size: 16px !important; min-height: 44px; }
  .at-resource-card:hover, .at-proposal-card:hover,
  .at-project-row:hover, .at-stat-card:hover { transform: none; }
}

/* ── Print ── */
@media print {
  .at-sidebar, .at-topbar, .at-contact-float { display: none !important; }
  .at-portal-wrap { display: block; height: auto; overflow: visible; }
  .at-main { overflow: visible; height: auto; }
  body { background: #fff; }
}

/* ============================================================
   WORDPRESS ADMIN BAR COMPENSATION
   WP adds margin-top:32px to html when admin bar is visible.
   We shift our fixed elements down to match.
============================================================ */
.admin-bar .at-topbar { top: 32px; }
.admin-bar .at-portal-body { top: calc(var(--topbar-h) + 32px); }

@media screen and (max-width: 782px) {
  .admin-bar .at-topbar { top: 46px; }
  .admin-bar .at-portal-body { top: calc(var(--topbar-h) + 46px); }
}

/* Hide admin bar on portal for non-staff */
body.at-portal-page:not(.at-is-staff) #wpadminbar { display: none !important; }
body.at-portal-page:not(.at-is-staff).admin-bar .at-topbar { top: 0; }
body.at-portal-page:not(.at-is-staff).admin-bar .at-portal-body { top: var(--topbar-h); }
