@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&family=Open+Sans:wght@300;400;500;600&display=swap');

:root {
  --primary: #1A56C4;
  --primary-dark: #0F3A7D;
  --primary-light: #e8f4fd;
  --accent: #00a8e8;
  --accent-light: #e0f5fd;
  --navy: #0B1A3B;
  --navy-mid: #1a2e52;
  --navy-light: #2e4160;
  --grey-bg: #F4F6FB;
  --white: #ffffff;
  --text-dark: #0B1A3B;
  --text-mid: #6B7280;
  --text-light: #9CA3AF;
  --border: #D1D5DB;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --purple: #8b5cf6;
  --sidebar-width: 240px;
  --topbar-height: 64px;
  --radius: 3px;
  --radius-sm: 3px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
}

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

body {
  font-family: 'Montserrat', sans-serif;
  background: var(--grey-bg);
  color: var(--text-dark);
  min-height: 100vh;
}

h1,h2,h3,h4,h5 { font-family: 'Montserrat', sans-serif; }

/* ── SIDEBAR ── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--navy);
  display: flex; flex-direction: column;
  z-index: 100;
  overflow: hidden;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 12px;
}

.logo-icon {
  width: 40px; height: 40px; flex-shrink: 0;
}

.logo-text { line-height: 1.1; }
.logo-text .brand { font-family: 'Montserrat', sans-serif; font-weight: 800; font-size: 18px; color: #fff; }
.logo-text .tagline { font-size: 9px; letter-spacing: .12em; color: var(--accent); text-transform: uppercase; font-weight: 600; }

.sidebar-nav { flex: 1; padding: 16px 0; overflow-y: auto; }

.nav-section-label {
  font-size: 10px; font-weight: 700; letter-spacing: .1em;
  color: rgba(255,255,255,.3); text-transform: uppercase;
  padding: 12px 20px 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 20px;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: 14px; font-weight: 500;
  border-radius: 0;
  transition: all .18s ease;
  cursor: pointer;
  position: relative;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active {
  background: rgba(0,107,182,.25);
  color: #fff;
  border-right: 3px solid var(--accent);
}
.nav-item.active .nav-icon { color: var(--accent); }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 3px; padding: 2px 7px; min-width: 20px; text-align: center;
}
.badge.red { background: var(--danger); }

.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 13px; color: #fff; flex-shrink: 0;
}
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--accent); font-weight: 500; }
.logout-btn {
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.4); padding: 4px;
  transition: color .15s;
}
.logout-btn:hover { color: rgba(255,255,255,.8); }

/* ── MAIN LAYOUT ── */
.main { margin-left: var(--sidebar-width); min-height: 100vh; }

.topbar {
  height: var(--topbar-height);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 28px;
  gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 18px; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 14px;
  cursor: pointer; border: none; transition: all .18s ease; text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,107,182,.3); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-ghost { background: transparent; color: var(--text-mid); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--grey-bg); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-danger { background: var(--danger); color: #fff; }

.icon-btn {
  background: none; border: none; cursor: pointer;
  padding: 8px; border-radius: var(--radius-sm);
  color: var(--text-mid); position: relative;
  transition: background .15s;
}
.icon-btn:hover { background: var(--grey-bg); }
.notification-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px; background: var(--danger); border-radius: 50%;
  border: 2px solid white;
}

/* ── PAGE CONTENT ── */
.page { padding: 28px; }

/* ── STAT CARDS ── */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--white); border-radius: var(--radius);
  padding: 20px 22px; box-shadow: var(--shadow);
  display: flex; justify-content: space-between; align-items: flex-start;
  transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-info .label { font-size: 12px; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: .06em; }
.stat-info .value { font-family: 'Montserrat', sans-serif; font-size: 32px; font-weight: 800; margin: 6px 0 4px; color: var(--text-dark); }
.stat-info .delta { font-size: 12px; color: var(--success); font-weight: 600; }
.stat-icon {
  width: 46px; height: 46px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.orange { background: #fff7ed; color: #ea580c; }
.stat-icon.green { background: #f0fdf4; color: var(--success); }
.stat-icon.purple { background: #f5f3ff; color: var(--purple); }

/* ── CARDS ── */
.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.card-header {
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-family: 'Montserrat', sans-serif; font-size: 15px; font-weight: 700; color: var(--text-dark); }
.card-body { padding: 16px 22px; }

/* ── STATUS BADGES ── */
.status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
}
.status::before { content:''; width: 6px; height: 6px; border-radius: 50%; }
.status-open { background: #e0f2fe; color: #0369a1; }
.status-open::before { background: #0369a1; }
.status-inprogress { background: #fff7ed; color: #c2410c; }
.status-inprogress::before { background: #ea580c; }
.status-resolved { background: #f0fdf4; color: #15803d; }
.status-resolved::before { background: var(--success); }
.status-closed { background: #f8fafc; color: #64748b; }
.status-closed::before { background: #94a3b8; }
.status-planning { background: #f5f3ff; color: #7c3aed; }
.status-planning::before { background: var(--purple); }
.status-review { background: #fefce8; color: #92400e; }
.status-review::before { background: var(--warning); }
.status-paid { background: #f0fdf4; color: #15803d; }
.status-paid::before { background: var(--success); }
.status-unpaid { background: #fef2f2; color: #b91c1c; }
.status-unpaid::before { background: var(--danger); }

/* ── PRIORITY ── */
.priority { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; }
.priority-critical { color: #b91c1c; }
.priority-high { color: #c2410c; }
.priority-medium { color: #92400e; }
.priority-low { color: #155e75; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-family: 'Montserrat', sans-serif;
  font-size: 11px; font-weight: 700; letter-spacing: .06em;
  color: var(--text-light); text-transform: uppercase;
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  background: var(--grey-bg);
}
td {
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  font-size: 14px; vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--grey-bg); }
.td-mono { font-family: monospace; font-size: 13px; color: var(--primary); font-weight: 700; }

/* ── PROGRESS BAR ── */
.progress-wrap { background: var(--border); border-radius: 3px; height: 6px; overflow: hidden; }
.progress-bar { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--primary), var(--accent)); }

/* ── TICKET SECTION DIVIDER (Manager view) ── */
.section-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 24px 0 16px;
}
.section-divider h3 { font-size: 14px; font-weight: 700; color: var(--text-mid); white-space: nowrap; }
.section-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ── TICKET ROW ── */
.ticket-row { display: grid; grid-template-columns: 110px 1fr 130px 120px 90px 100px; align-items: center; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--border); transition: background .15s; cursor: pointer; }
.ticket-row:hover { background: var(--grey-bg); }
.ticket-row:last-child { border-bottom: none; }
.ticket-num { font-family: monospace; font-size: 13px; color: var(--primary); font-weight: 700; }
.ticket-subject { font-size: 14px; font-weight: 600; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-sub { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.ticket-date { font-size: 12px; color: var(--text-light); }
.ticket-cat { font-size: 12px; background: var(--primary-light); color: var(--primary); padding: 2px 8px; border-radius: 3px; font-weight: 600; white-space: nowrap; }

/* ── PROJECT CARDS ── */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.project-card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
  transition: transform .2s, box-shadow .2s;
  cursor: pointer;
}
.project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.project-source { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-light); margin-bottom: 8px; display: flex; align-items: center; gap: 5px; }
.project-source .dot { width: 6px; height: 6px; border-radius: 50%; }
.project-source .dot.at { background: #e8580c; }
.project-source .dot.tr { background: #0052cc; }
.project-name { font-family: 'Montserrat', sans-serif; font-size: 15px; font-weight: 700; color: var(--text-dark); margin-bottom: 10px; }
.project-meta { font-size: 12px; color: var(--text-light); margin-bottom: 14px; }
.project-progress-label { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; font-weight: 600; }
.project-update { font-size: 12px; color: var(--text-mid); margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }

/* ── INVOICE TABLE ── */
.invoice-amount { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 15px; }
.invoice-amount.unpaid { color: var(--danger); }
.invoice-amount.paid { color: var(--success); }

/* ── FORM STYLES ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full-width { grid-column: 1 / -1; }
label { font-size: 13px; font-weight: 600; color: var(--text-mid); }
input, select, textarea {
  padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: 'Montserrat', sans-serif; font-size: 14px; color: var(--text-dark);
  transition: border-color .15s, box-shadow .15s;
  background: var(--white);
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,107,182,.1);
}
textarea { resize: vertical; min-height: 100px; }

/* ── ADMIN TOGGLES ── */
.toggle { position: relative; width: 42px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--danger); border-radius: 3px; cursor: pointer;
  transition: background .2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  left: 3px; top: 3px; transition: transform .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-slider { background: var(--success); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

.role-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.role-chip {
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700;
  border: 1.5px solid transparent;
}
.chip-manager { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }
.chip-billing { background: #f5f3ff; color: #7c3aed; border-color: #ddd6fe; }
.chip-employee { background: var(--grey-bg); color: var(--text-mid); border-color: var(--border); }

/* ── TWO COLUMN LAYOUT ── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ── PAGE TABS ── */
.tab-bar {
  display: flex; gap: 4px;
  background: var(--grey-bg); border-radius: var(--radius-sm);
  padding: 4px; width: fit-content; margin-bottom: 20px;
}
.tab {
  padding: 8px 18px; border-radius: 3px; border: none;
  font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 14px;
  cursor: pointer; transition: all .15s; color: var(--text-mid); background: none;
}
.tab.active { background: var(--white); color: var(--primary); box-shadow: 0 1px 4px rgba(0,0,0,.1); }

/* ── SEARCH / FILTER BAR ── */
.filter-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap input { padding-left: 38px; width: 100%; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-light); pointer-events: none; }

/* ── EMPTY STATE ── */
.empty-state { padding: 48px 24px; text-align: center; color: var(--text-light); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }

/* ── ACTIVITY FEED ── */
.activity-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 6px; }
.activity-body { flex: 1; }
.activity-text { font-size: 14px; color: var(--text-dark); }
.activity-time { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* ── PAGE TRANSITIONS ── */
.page-view { display: none; }
.page-view.active { display: block; }

/* ── LOGIN ── */
.login-page {
  min-height: 100vh;
  background: var(--navy);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.login-bg-pattern {
  position: absolute; inset: 0;
  background-image: radial-gradient(circle at 20% 80%, rgba(0,168,232,.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(0,107,182,.12) 0%, transparent 50%);
}
.login-card {
  background: rgba(255,255,255,.97); border-radius: 3px;
  padding: 48px 44px; width: 420px; max-width: 95vw;
  box-shadow: 0 24px 64px rgba(0,0,0,.4), 0 0 0 1px rgba(255,255,255,.1);
  position: relative; z-index: 1; text-align: center;
}
.login-logo { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 32px; }
.login-logo-icon { width: 64px; height: 64px; }
.login-brand { font-family: 'Montserrat', sans-serif; font-weight: 800; font-size: 26px; color: var(--navy); }
.login-brand span { color: var(--primary); }
.login-tagline { font-size: 10px; letter-spacing: .15em; text-transform: uppercase; color: var(--text-light); font-weight: 600; }
.login-heading { font-family: 'Montserrat', sans-serif; font-size: 22px; font-weight: 700; color: var(--text-dark); margin-bottom: 8px; }
.login-sub { font-size: 14px; color: var(--text-mid); margin-bottom: 32px; line-height: 1.5; }
.ms-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; padding: 14px 20px;
  background: var(--primary); color: #fff;
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 15px;
  transition: all .2s; box-shadow: 0 4px 14px rgba(0,107,182,.35);
  text-decoration: none;
}
.ms-btn:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,107,182,.45); }
.login-footer { margin-top: 24px; font-size: 12px; color: var(--text-light); display: flex; align-items: center; justify-content: center; gap: 6px; }
