/* ===== Timesheet Tracker App Styles ===== */
/* Pulled out from index.html to reduce file size and improve maintainability */

/* ===== RESET & VARIABLES ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:       #0d1b3e;
  --navy2:      #162347;
  --blue:       #1a56db;
  --blue-h:     #1445b5;
  --red:        #dc2626;
  --green:      #16a34a;
  --orange:     #ea580c;
  --g50:        #f9fafb;
  --g100:       #f3f4f6;
  --g200:       #e5e7eb;
  --g300:       #d1d5db;
  --g400:       #9ca3af;
  --g600:       #4b5563;
  --g800:       #1f2937;
  --white:      #ffffff;
  --shadow:     0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md:  0 4px 12px rgba(0,0,0,.15);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: var(--g100);
  color: var(--g800);
  min-height: 100vh;
}

/* ===== HEADER ===== */
.app-header {
  background: var(--navy);
  color: white;
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 52px;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-logo { font-weight: 800; font-size: 20px; letter-spacing: 1px; }
.header-sep  { color: #4a6080; }
.header-app  { color: #93c5fd; font-size: 15px; }
.header-user { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.user-avatar {
  width: 32px; height: 32px;
  background: var(--blue);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px; flex-shrink: 0;
}
.btn-logout {
  background: transparent;
  border: 1px solid rgba(255,255,255,.3);
  color: white; padding: 4px 10px;
  border-radius: 4px; cursor: pointer; font-size: 12px;
}
.btn-logout:hover { background: rgba(255,255,255,.1); }

/* ===== NAV ===== */
.app-nav {
  background: var(--navy2);
  display: flex;
  padding: 0 24px;
  gap: 2px;
  position: sticky;
  top: 52px;
  z-index: 99;
}
.app-nav a {
  color: #93c5fd; text-decoration: none;
  padding: 11px 14px; font-size: 13px;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
  user-select: none;
}
.app-nav a:hover { color: white; }
.app-nav a.active { color: white; border-bottom-color: #ef4444; }

/* ===== LAYOUT ===== */
.app-main { padding: 24px; max-width: 1400px; margin: 0 auto; }

.view { display: none; }
.view.active { display: block; }

/* ===== LOGIN ===== */
.login-wrap {
  min-height: 100vh;
  background: var(--navy);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  background: white; border-radius: 12px;
  padding: 40px; width: 400px;
  box-shadow: var(--shadow-md);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.login-brand-icon {
  background: var(--navy); color: white;
  font-weight: 800; font-size: 18px;
  padding: 6px 10px; border-radius: 6px;
}
.login-card h1 { color: var(--navy); font-size: 22px; margin-bottom: 6px; }
.login-card p  { color: var(--g600); font-size: 13px; margin-bottom: 24px; }
.login-hint {
  background: var(--g50); border: 1px solid var(--g200);
  border-radius: 6px; padding: 12px;
  margin-top: 16px; font-size: 12px; color: var(--g600); line-height: 1.7;
}

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--g300); border-radius: 6px;
  font-size: 14px; font-family: inherit;
  transition: border-color .15s;
  background: white;
}
.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,.1);
}

/* ===== BUTTONS ===== */
.btn {
  padding: 8px 16px; border-radius: 6px; border: none;
  cursor: pointer; font-size: 13px; font-weight: 500;
  font-family: inherit;
  transition: background .15s, opacity .15s;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--blue-h); }
.btn-success { background: var(--green); color: white; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-danger  { background: var(--red); color: white; }
.btn-danger:hover:not(:disabled)  { background: #b91c1c; }
.btn-warning { background: var(--orange); color: white; }
.btn-warning:hover { background: #c2410c; }
.btn-outline {
  background: white; border: 1px solid var(--g300); color: var(--g800);
}
.btn-outline:hover:not(:disabled) { background: var(--g50); }
.btn-sm  { padding: 5px 10px; font-size: 12px; }
.btn-lg  { padding: 10px 24px; font-size: 15px; }
.btn-icon {
  background: none; border: none; cursor: pointer;
  padding: 4px; color: var(--g400); font-size: 18px; line-height: 1;
}
.btn-icon:hover { color: var(--red); }

/* ===== CARDS ===== */
.card { background: white; border-radius: 8px; box-shadow: var(--shadow); margin-bottom: 20px; }
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--g200);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h2 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* ===== SUMMARY GRID ===== */
.summary-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-bottom: 20px;
}
.summary-card {
  background: white; border-radius: 8px; padding: 20px;
  box-shadow: var(--shadow); border-left: 4px solid var(--blue);
}
.summary-card.green  { border-left-color: var(--green); }
.summary-card.orange { border-left-color: var(--orange); }
.summary-card.red    { border-left-color: var(--red); }
.sc-label { font-size: 11px; color: var(--g600); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .5px; }
.sc-value { font-size: 32px; font-weight: 700; }
.sc-sub   { font-size: 12px; color: var(--g600); margin-top: 4px; }

/* ===== TABLES ===== */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th {
  background: var(--g100); padding: 10px 12px;
  text-align: left; font-size: 12px; font-weight: 600;
  color: var(--g600); border-bottom: 1px solid var(--g200);
  white-space: nowrap;
}
table td {
  padding: 10px 12px; border-bottom: 1px solid var(--g200);
  font-size: 13px;
}
table tr:last-child td { border-bottom: none; }
table tbody tr:hover td { background: var(--g50); }
table tfoot td {
  background: var(--g100); font-weight: 600;
  border-top: 2px solid var(--g300); padding: 10px 12px;
}

/* ===== TIMESHEET ===== */
.ts-controls {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.week-nav {
  display: flex; align-items: center; gap: 8px;
  background: white; border: 1px solid var(--g300);
  border-radius: 6px; padding: 6px 12px;
  font-size: 13px; font-weight: 500;
}
.week-nav button {
  background: none; border: none; cursor: pointer;
  color: var(--g600); font-size: 18px; padding: 0 2px; line-height: 1;
}
.week-nav button:hover { color: var(--blue); }

.ts-table th {
  text-align: center; font-size: 12px; font-weight: 600;
  color: var(--g600); background: var(--g100);
  border-bottom: 2px solid var(--g200); padding: 10px 6px;
}
.ts-table th.c-proj  { text-align: left; min-width: 200px; }
.ts-table th.c-day   { width: 80px; }
.ts-table th.c-total { background: #dbeafe; width: 70px; }
.ts-table td { padding: 6px; border-bottom: 1px solid var(--g200); }
.ts-table tfoot td {
  background: var(--g100); font-weight: 600;
  text-align: center; padding: 9px 6px;
  border-top: 2px solid var(--g300);
}
.ts-table tfoot td:first-child { text-align: left; padding-left: 12px; }

.ts-num {
  width: 100%; padding: 6px 4px;
  border: 1px solid var(--g300); border-radius: 4px;
  text-align: center; font-size: 13px; font-family: inherit;
}
.ts-num:focus { outline: none; border-color: var(--blue); background: #eff6ff; }
.ts-num.ot    { border-color: var(--orange); background: #fff7ed; color: var(--orange); font-weight: 600; }

.ts-total-cell { text-align: center; font-weight: 600; background: #f0f9ff; }
.ts-foot-total { background: #dbeafe !important; }

.proj-select {
  width: 100%; padding: 6px 8px;
  border: 1px solid var(--g300); border-radius: 4px;
  font-size: 12px; font-family: inherit; background: white;
}
.proj-select:focus { outline: none; border-color: var(--blue); }

.ts-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--g200);
}

.note-row { display: flex; align-items: flex-start; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--g200); }
.note-row label { font-size: 13px; font-weight: 500; padding-top: 8px; white-space: nowrap; }
.note-row textarea {
  flex: 1; padding: 8px; border: 1px solid var(--g300);
  border-radius: 6px; font-size: 13px; font-family: inherit;
  resize: vertical; min-height: 44px;
}
.note-row textarea:focus { outline: none; border-color: var(--blue); }

/* ===== PROGRESS BAR ===== */
.prog { height: 8px; background: var(--g200); border-radius: 4px; overflow: hidden; }
.prog-bar { height: 100%; background: var(--blue); border-radius: 4px; transition: width .3s; }
.prog-bar.warn { background: var(--orange); }
.prog-bar.dang { background: var(--red); }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .3px;
}
.badge-open      { background: #f0f9ff; color: #0369a1; border: 1px solid #bae6fd; }
.badge-submitted { background: #fefce8; color: #a16207; border: 1px solid #fde68a; }
.badge-approved  { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-rejected  { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-active    { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.badge-inactive  { background: var(--g100); color: var(--g600); border: 1px solid var(--g300); }

/* ===== MODAL ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 1000;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: white; border-radius: 12px;
  width: 500px; max-width: 95vw;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 25px rgba(0,0,0,.2);
}
.modal-hdr {
  padding: 20px 24px; border-bottom: 1px solid var(--g200);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-hdr h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 24px; }
.modal-ftr {
  padding: 16px 24px; border-top: 1px solid var(--g200);
  display: flex; gap: 8px; justify-content: flex-end;
}

/* ===== STAFF AVATAR ===== */
.staff-chip { display: flex; align-items: center; gap: 8px; }
.savatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--navy); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; flex-shrink: 0;
}

/* ===== PAGE TITLE ===== */
.page-title { font-size: 18px; font-weight: 600; margin-bottom: 20px; }

/* ===== FILTER BAR ===== */
.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filter-bar select, .filter-bar input {
  padding: 7px 10px; border: 1px solid var(--g300);
  border-radius: 6px; font-size: 13px; font-family: inherit; background: white;
}

/* ===== REPORT TABLE ===== */
.report-tbl th { background: var(--navy); color: white; font-size: 12px; padding: 10px; }
.report-tbl td { text-align: center; padding: 10px; border-bottom: 1px solid var(--g200); }
.report-tbl td:first-child { text-align: left; font-weight: 500; }
.report-tbl tbody tr:hover td { background: #eff6ff; }

/* ===== TOAST ===== */
#toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 12px 20px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-md); z-index: 2000;
  transition: opacity .3s; opacity: 0; pointer-events: none;
}
#toast.show { opacity: 1; }

/* ===== DAILY NOTES ===== */
.dn-input {
  width: 100%; padding: 5px 8px;
  border: 1px solid var(--g300); border-radius: 4px;
  font-size: 12px; font-family: inherit;
  transition: border-color .15s;
}
.dn-input:focus  { outline: none; border-color: var(--blue); background: #eff6ff; }
.dn-input:disabled { background: var(--g50); color: var(--g400); cursor: not-allowed; }

/* ===== TEAM STATUS ===== */
.dot { display:inline-block; width:10px; height:10px; border-radius:50%; flex-shrink:0; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .app-nav { overflow-x: auto; }
  .app-main { padding: 12px; }
}

