/* ============================================================
   AUSTIN'S TECH REPAIR GROUP — Employee Portal Styles
   ============================================================ */

/* ---- Login ---- */
.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--header-height));
  padding: var(--space-8) var(--space-5);
}
.login-card {
  width: min(440px, 92vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-lg);
}
.login-card .eyebrow { margin-bottom: var(--space-2); }
.login-card h1 { font-size: var(--text-xl); margin-bottom: var(--space-2); }
.login-card > p { font-size: var(--text-sm); color: var(--text-muted); margin-bottom: var(--space-5); }

/* ---- Portal App Layout ---- */
.app {
  display: flex;
  min-height: calc(100vh - var(--header-height));
  background: var(--bg);
}

/* ---- Sidebar ---- */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.brand-portal {
  padding: var(--space-5);
  border-bottom: 1px solid var(--border);
}
.brand-portal .title { font-size: var(--text-sm); font-weight: 800; font-family: var(--font-display); }
.brand-portal .sub { font-size: var(--text-xs); color: var(--text-muted); }

.portal-nav {
  flex: 1;
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.portal-nav button {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  transition: all var(--transition);
  text-align: left;
  width: 100%;
}
.portal-nav button:hover { background: var(--surface-2); color: var(--text); }
.portal-nav button.active { background: var(--primary); color: #fff; }
.portal-nav button.active i { color: #fff; }
.portal-nav button i { width: 20px; text-align: center; font-size: 1rem; }
.portal-nav .logout { color: var(--danger); margin-top: auto; }
.portal-nav .logout:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }

.nav-divider { height: 1px; background: var(--border); margin: var(--space-2) 0; }

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.portal-nav button.active .nav-badge { background: rgba(255,255,255,0.25); }

/* ---- Portal Main ---- */
.portal-main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ---- Topbar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.userbox { display: flex; align-items: center; gap: var(--space-2); }
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  font-size: var(--text-xs);
  font-weight: 700;
}
.usertext { display: flex; flex-direction: column; line-height: 1.2; }
.usertext strong { font-size: var(--text-sm); }
.usertext span { font-size: var(--text-xs); color: var(--text-muted); }

.search-box { flex: 1; max-width: 400px; }
.search-box input {
  width: 100%;
  padding: var(--space-2) var(--space-4);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}
.search-box input:focus { border-color: var(--primary); }

.iconset { display: flex; align-items: center; gap: var(--space-2); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
}
.pill.success { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.pill i { font-size: 6px; }

.pbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 700;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}
.pbtn:active { transform: scale(0.97); }
.pbtn-sm { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); }
.pbtn-primary { background: var(--primary); color: #fff; }
.pbtn-primary:hover { background: var(--primary-hover); }
.pbtn-light { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.pbtn-light:hover { border-color: var(--border-strong); }
.pbtn-success { background: var(--success); color: #fff; }
.pbtn-success:hover { opacity: 0.9; }
.pbtn-danger { background: var(--danger); color: #fff; }
.pbtn-danger:hover { opacity: 0.9; }

/* ---- Portal Sections ---- */
.portal-section {
  display: none;
  padding: var(--space-5);
  flex: 1;
  animation: pageIn 300ms ease;
}
.portal-section.active { display: block; }

.portal-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
  gap: var(--space-3);
}
.portal-section-header h2 { font-size: var(--text-xl); }
.portal-section-header p { font-size: var(--text-sm); color: var(--text-muted); }

/* ---- Stats Grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.stat-card {
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  font-size: 1.3rem;
}
.stat-icon.blue { background: color-mix(in srgb, var(--accent-blue) 15%, transparent); color: var(--accent-blue); }
.stat-icon.green { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.stat-icon.orange { background: color-mix(in srgb, var(--accent-orange) 15%, transparent); color: var(--accent-orange); }
.stat-icon.purple { background: color-mix(in srgb, var(--accent-purple) 15%, transparent); color: var(--accent-purple); }
.stat-icon.red { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.stat-info { flex: 1; }
.stat-label { font-size: var(--text-xs); color: var(--text-muted); font-weight: 600; }
.stat-value { font-size: var(--text-xl); font-weight: 800; font-family: var(--font-display); }

/* ---- Content Grid ---- */
.content-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--space-4);
}
.content-grid .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
}
.content-grid .card h3 {
  font-size: var(--text-sm);
  font-weight: 700;
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.content-grid .card h3 i { color: var(--primary); }

.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }

/* ---- Chart Containers ---- */
.chart-container {
  position: relative;
  height: 240px;
}
.chart-container-sm {
  position: relative;
  height: 200px;
}

/* ---- Activity Feed ---- */
.activity-feed { display: flex; flex-direction: column; gap: var(--space-3); }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--text-sm);
}
.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--primary);
  margin-top: 6px;
  flex-shrink: 0;
}
.activity-text { color: var(--text-muted); }
.activity-text strong { color: var(--text); }
.activity-time { font-size: var(--text-xs); color: var(--text-faint); }

/* ---- Quick Actions ---- */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-3);
}
.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-2);
  background: var(--surface-2);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.quick-action:hover { background: var(--primary-light); }
.quick-action i { font-size: 1.5rem; color: var(--primary); }
.quick-action span { font-size: var(--text-xs); font-weight: 600; }

/* ---- Filter Bar ---- */
.filter-bar {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}
.filter-bar select,
.filter-bar input {
  padding: var(--space-2) var(--space-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}
.filter-bar select:focus,
.filter-bar input:focus { border-color: var(--primary); }
.filter-bar input { flex: 1; min-width: 200px; }

/* ---- Portal Tables ---- */
.portal-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: auto;
}
.portal-table {
  width: 100%;
  border-collapse: collapse;
}
.portal-table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.portal-table td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--divider);
  white-space: nowrap;
}
.portal-table tbody tr { transition: background var(--transition); }
.portal-table tbody tr:hover { background: var(--surface-2); }
.portal-table tbody tr:last-child td { border-bottom: none; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
}
.badge.blue { background: color-mix(in srgb, var(--accent-blue) 15%, transparent); color: var(--accent-blue); }
.badge.green { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.badge.orange { background: color-mix(in srgb, var(--accent-orange) 15%, transparent); color: var(--accent-orange); }
.badge.red { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.badge.gray { background: var(--surface-2); color: var(--text-muted); }
.badge.purple { background: color-mix(in srgb, var(--accent-purple) 15%, transparent); color: var(--accent-purple); }

.action-btns { display: flex; gap: var(--space-1); }
.action-btn {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
  transition: all var(--transition);
  cursor: pointer;
}
.action-btn:hover { background: var(--surface-2); color: var(--text); }
.action-btn.danger:hover { color: var(--danger); }

/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.tab-btn {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ---- Kanban Board ---- */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-4);
}
.kanban-column {
  background: var(--surface-2);
  border-radius: var(--radius-xl);
  padding: var(--space-3);
  min-height: 200px;
}
.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
  font-weight: 700;
}
.kanban-column-header .count {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--surface);
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  margin-bottom: var(--space-2);
  cursor: pointer;
  transition: all var(--transition);
}
.kanban-card:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.kanban-card .kc-ticket { font-size: var(--text-xs); font-weight: 700; color: var(--primary); }
.kanban-card .kc-customer { font-size: var(--text-sm); font-weight: 600; margin-top: 2px; }
.kanban-card .kc-device { font-size: var(--text-xs); color: var(--text-muted); }
.kanban-card .kc-footer { display: flex; justify-content: space-between; align-items: center; margin-top: var(--space-2); }
.kanban-arrows { display: flex; gap: 2px; }
.kanban-arrow {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  color: var(--text-muted);
  transition: all var(--transition);
  cursor: pointer;
}
.kanban-arrow:hover { background: var(--primary); color: #fff; }

/* ---- Time Clock ---- */
.clock-display {
  font-size: var(--text-3xl);
  font-weight: 900;
  font-family: var(--font-mono);
  margin-bottom: var(--space-4);
}
.clock-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-sm);
  font-weight: 700;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
}
.clock-btn.in { background: var(--success); color: #fff; }
.clock-btn.out { background: var(--danger); color: #fff; }

/* ---- Markup Calculator ---- */
.markup-calculator { display: flex; flex-direction: column; gap: var(--space-3); }
.portal-field { display: flex; flex-direction: column; gap: var(--space-1); }
.portal-field label { font-size: var(--text-xs); font-weight: 600; color: var(--text-muted); }
.portal-field input,
.portal-field select,
.portal-field textarea {
  padding: var(--space-2) var(--space-3);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
  font-family: var(--font-body);
  width: 100%;
}
.portal-field input:focus,
.portal-field select:focus,
.portal-field textarea:focus { border-color: var(--primary); }

.markup-result {
  margin-top: var(--space-3);
  padding: var(--space-4);
  background: var(--primary-light);
  border-radius: var(--radius-lg);
  text-align: center;
}
.markup-result .price { font-size: var(--text-2xl); font-weight: 900; font-family: var(--font-display); color: var(--primary); }
.markup-result .profit { font-size: var(--text-sm); color: var(--success); font-weight: 600; }

/* ---- Barcode Lookup ---- */
#barcode-result { font-size: var(--text-sm); }
.barcode-result-item {
  padding: var(--space-3);
  background: var(--surface-2);
  border-radius: var(--radius-md);
}
.barcode-result-item .name { font-weight: 700; }
.barcode-result-item .details { font-size: var(--text-xs); color: var(--text-muted); }

/* ---- Portal Form Grid ---- */
.portal-form-grid { display: flex; flex-direction: column; gap: var(--space-4); }
.portal-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }

/* ---- Modals (dialog) ---- */
dialog {
  border: none;
  border-radius: var(--radius-2xl);
  padding: 0;
  max-width: 92vw;
  max-height: 90vh;
  width: 560px;
  box-shadow: var(--shadow-xl);
  background: var(--surface);
  color: var(--text);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(4px); }
dialog[open] { animation: modalIn 300ms cubic-bezier(0.16, 1, 0.3, 1); }

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5);
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: var(--text-lg); }
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all var(--transition);
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }

.modal-body {
  padding: var(--space-5);
  max-height: 60vh;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-5);
  border-top: 1px solid var(--border);
}

/* ---- Ticket Detail ---- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.detail-item { display: flex; flex-direction: column; gap: 2px; }
.detail-label { font-size: var(--text-xs); color: var(--text-muted); font-weight: 600; }
.detail-value { font-size: var(--text-sm); font-weight: 600; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
  .col-8 { grid-column: span 12; }
  .col-6 { grid-column: span 6; }
  .col-4 { grid-column: span 6; }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -260px;
    top: var(--header-height);
    bottom: 0;
    z-index: 900;
    transition: left 300ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  .sidebar.open { left: 0; }
  .col-4, .col-6, .col-8 { grid-column: span 12; }
  .portal-form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .topbar { flex-wrap: wrap; }
  .search-box { order: 3; max-width: 100%; width: 100%; }
}

@media (max-width: 480px) {
  .portal-section { padding: var(--space-3); }
  .stats-grid { grid-template-columns: 1fr; }
  .kanban-board { grid-template-columns: 1fr; }
}