/* Saracens EMS — black & gold theme */
:root {
  --bg: #0a0a0c;
  --bg-2: #101014;
  --card: #16161c;
  --card-2: #1c1d24;
  --input: #1e1f27;
  --border: #26272f;
  --border-2: #33343e;
  --text: #eceae4;
  --muted: #9a988f;
  --gold: #d4af37;
  --gold-2: #e0c05a;
  --gold-dark: #8e6f1f;
  --gold-soft: rgba(212, 175, 55, 0.12);
  --green: #2ecc8f;
  --red: #e05656;
  --radius: 12px;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
}

a { color: var(--gold-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- top bar ---------------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: 60px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 18px;
  background: linear-gradient(180deg, #0d0d10, #0a0a0c);
  border-bottom: 1px solid var(--border);
}
.topbar .burger {
  background: none; border: none; color: var(--text);
  font-size: 22px; cursor: pointer; padding: 6px 10px; border-radius: 8px;
}
.topbar .burger:hover { background: var(--card-2); }
.topbar .brand { display: flex; align-items: center; gap: 10px; }
.topbar .brand img { height: 38px; width: 38px; object-fit: contain; }
.topbar .brand span { font-weight: 700; font-size: 17px; letter-spacing: 0.3px; }
.topbar .spacer { flex: 1; }
.avatar-chip {
  width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #121212; font-weight: 700; font-size: 14px;
  border: none; cursor: pointer;
}
.user-menu { position: relative; }
.user-menu .menu {
  display: none; position: absolute; right: 0; top: 48px;
  background: var(--card); border: 1px solid var(--border-2);
  border-radius: 10px; min-width: 190px; padding: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
}
.user-menu.open .menu { display: block; }
.user-menu .menu a, .user-menu .menu .who {
  display: block; padding: 9px 12px; border-radius: 7px; color: var(--text);
}
.user-menu .menu .who { color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.user-menu .menu a:hover { background: var(--gold-soft); text-decoration: none; }

/* ---------------- sidebar ---------------- */
.sidebar {
  position: fixed; top: 60px; left: 0; bottom: 0; z-index: 40;
  width: 240px; overflow-y: auto;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  transition: transform 0.2s ease;
}
body.sidebar-closed .sidebar { transform: translateX(-100%); }
body.sidebar-closed .main { margin-left: 0; }

.sidebar .nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; margin-bottom: 4px;
  border-radius: 10px; color: var(--text);
  font-weight: 500; cursor: pointer; border: none; background: none;
  width: 100%; font-size: 15px; text-align: left; font-family: inherit;
}
.sidebar .nav-link:hover { background: var(--card-2); text-decoration: none; }
.sidebar .nav-link.active {
  background: var(--gold-soft); color: var(--gold-2);
  border-left: 3px solid var(--gold);
}
.sidebar .nav-link .ico { width: 20px; text-align: center; opacity: 0.85; }
.sidebar .nav-link .caret { margin-left: auto; font-size: 11px; transition: transform 0.15s; }
.sidebar .group.open .caret { transform: rotate(180deg); }
.sidebar .submenu { display: none; padding-left: 18px; }
.sidebar .group.open .submenu { display: block; }
.sidebar .divider { height: 1px; background: var(--border); margin: 12px 6px; }

/* ---------------- layout ---------------- */
.main { margin-left: 240px; padding: 84px 28px 40px; transition: margin 0.2s ease; }
.breadcrumb { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--gold-2); }
.breadcrumb .sep { margin: 0 8px; opacity: 0.5; }
.page-title { font-size: 26px; font-weight: 700; margin-bottom: 22px; }

.grid { display: grid; gap: 22px; }
.grid.detail { grid-template-columns: 360px 1fr; align-items: start; }
@media (max-width: 1100px) { .grid.detail { grid-template-columns: 1fr; } }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }
.col { display: flex; flex-direction: column; gap: 22px; }

/* ---------------- cards ---------------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.card h2 {
  font-size: 19px; font-weight: 700; margin-bottom: 18px;
}
.card .card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; gap: 10px; flex-wrap: wrap;
}
.card .card-head h2 { margin-bottom: 0; }

/* profile card */
.profile-card { padding: 0; overflow: hidden; }
.profile-card .inner { padding: 26px; display: flex; align-items: center; gap: 20px; }
.avatar-big {
  width: 96px; height: 96px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 700; color: #121212;
  background: linear-gradient(135deg, var(--gold-2), var(--gold-dark));
}
.profile-card .name { font-size: 24px; font-weight: 700; }
.profile-card .role { color: var(--muted); margin-top: 6px; font-size: 14px; }
.action-row { display: flex; }
.action-row a {
  flex: 1; text-align: center; padding: 12px 0; color: #121212;
  font-weight: 600; font-size: 14px;
}
.action-row a:hover { text-decoration: none; filter: brightness(1.1); }
.action-row .a-email { background: var(--green); }
.action-row .a-call { background: var(--gold); }
.action-row .a-action { background: var(--red); color: #fff; }

/* ---------------- forms ---------------- */
label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 7px; }
.field { margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=tel], select, textarea {
  width: 100%; padding: 11px 13px;
  background: var(--input); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 9px;
  font-size: 14.5px; font-family: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
input::placeholder, textarea::placeholder { color: #62636c; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
textarea { min-height: 96px; resize: vertical; }
input[type=file] { color: var(--muted); font-size: 13.5px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px; border-radius: 9px;
  border: none; cursor: pointer;
  font-size: 14.5px; font-weight: 600; font-family: inherit;
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  color: #131313;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.secondary {
  background: var(--card-2); color: var(--text);
  border: 1px solid var(--border-2);
}
.btn.secondary:hover { border-color: var(--gold); color: var(--gold-2); }
.btn.small { padding: 7px 14px; font-size: 13px; }
.btn.danger { background: var(--red); color: #fff; }

/* ---------------- notes feed ---------------- */
.notes-feed { display: flex; flex-direction: column; }
.note {
  display: flex; gap: 13px; padding: 15px 4px;
  border-bottom: 1px solid var(--border);
}
.note:last-child { border-bottom: none; }
.note .avatar-sm {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; color: #121212;
  background: linear-gradient(135deg, var(--gold-2), var(--gold-dark));
}
.note .meta { font-size: 13.5px; margin-bottom: 5px; }
.note .meta .who { font-weight: 700; }
.note .meta .when-date { color: var(--gold-2); font-weight: 600; margin-right: 10px; }
.note .note-actions { align-self: flex-start; display: flex; gap: 2px; }
.note .note-act {
  background: none; border: none; cursor: pointer; color: var(--muted);
  padding: 4px; border-radius: 6px; display: inline-flex;
}
.note .note-act:hover { color: var(--gold-2); background: var(--gold-soft); }
.note .note-act.danger:hover { color: var(--red); background: rgba(224, 86, 86, 0.1); }
.note .note-act .ic { color: currentColor; vertical-align: 0; }
.note .body.editing { display: none; }
.note .note-edit { display: none; margin-top: 4px; }
.note .note-edit.open { display: block; }
.note .note-edit textarea { min-height: 72px; margin-bottom: 8px; }
.note .note-edit-row { display: flex; gap: 8px; align-items: center; }
.note .note-edit-row input[type=date] { max-width: 170px; }
.pill-btn { background: none; border: none; padding: 0; cursor: pointer; font-family: inherit; }
.pill-btn:hover .pill { filter: brightness(1.25); }
.note .meta .when { color: var(--muted); margin-left: 8px; font-size: 12.5px; }
.note .meta .flag {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; margin-left: 8px;
  border-radius: 50%; background: var(--gold-soft); color: var(--gold-2);
  font-size: 10.5px; font-weight: 700; vertical-align: middle;
}
.note .body { color: #cfcdc5; font-size: 14px; line-height: 1.5; }
.note-form textarea { margin-bottom: 10px; }

/* ---------------- tables ---------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th {
  text-align: left; padding: 12px 14px; color: var(--muted);
  font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border-2);
}
td { padding: 13px 14px; border-bottom: 1px solid var(--border); }
tbody tr:hover { background: var(--card-2); }
.emp-cell { display: flex; align-items: center; gap: 12px; }
.emp-cell .avatar-sm {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #121212;
  background: linear-gradient(135deg, var(--gold-2), var(--gold-dark));
}
.pill {
  display: inline-block; padding: 4px 12px; border-radius: 99px;
  font-size: 12.5px; font-weight: 600;
}
.pill.active { background: rgba(46, 204, 143, 0.15); color: var(--green); }
.pill.inactive { background: rgba(224, 86, 86, 0.15); color: var(--red); }
.pill.gold { background: var(--gold-soft); color: var(--gold-2); }

/* ---------------- stats ---------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 24px; }
.stat {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px;
  border-top: 3px solid var(--gold);
}
.stat .label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.6px; }
.stat .value { font-size: 32px; font-weight: 700; margin-top: 6px; color: var(--gold-2); }

/* ---------------- flash messages ---------------- */
.flashes { margin-bottom: 18px; }
.flash {
  padding: 12px 16px; border-radius: 10px; margin-bottom: 8px; font-size: 14.5px;
  border: 1px solid;
}
.flash.success { background: rgba(46, 204, 143, 0.1); border-color: rgba(46, 204, 143, 0.35); color: var(--green); }
.flash.error { background: rgba(224, 86, 86, 0.1); border-color: rgba(224, 86, 86, 0.35); color: #f08c8c; }

/* ---------------- history / details ---------------- */
details.history { margin-top: 14px; }
details.history summary {
  cursor: pointer; color: var(--gold-2); font-weight: 600; font-size: 14px;
  list-style: none; padding: 6px 0;
}
details.history summary::before { content: "▸ "; }
details.history[open] summary::before { content: "▾ "; }
.history-item {
  background: var(--card-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px; margin-top: 10px; font-size: 13.5px;
}
.history-item .hi-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }

/* ---------------- login ---------------- */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 0%, #17150d 0%, var(--bg) 55%);
  padding: 20px;
}
.login-box {
  width: 100%; max-width: 420px;
  background: var(--card); border: 1px solid var(--border-2);
  border-radius: 18px; padding: 44px 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  text-align: center;
}
.login-box img { width: 110px; height: 110px; object-fit: contain; margin-bottom: 4px; }
.login-box h1 { font-size: 23px; margin-bottom: 4px; }
.login-box .sub { color: var(--gold-2); font-size: 13px; letter-spacing: 2.5px; text-transform: uppercase; margin-bottom: 30px; }
.login-box .field { text-align: left; margin-bottom: 16px; }
.login-box .btn { width: 100%; justify-content: center; margin-top: 8px; padding: 13px; font-size: 15.5px; }
.login-box .foot { margin-top: 26px; color: var(--muted); font-size: 12.5px; }
.login-box .remember-row {
  display: flex; align-items: center; gap: 9px;
  margin: 2px 0 6px; cursor: pointer;
  font-size: 13.5px; font-weight: 500; color: var(--muted); text-align: left;
}
.login-box .remember-row input {
  width: 16px; height: 16px; accent-color: var(--gold); cursor: pointer;
}
.login-box .remember-row:hover span { color: var(--text); }
.gold-line { height: 3px; width: 60px; margin: 0 auto 26px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent); }

/* error page */
.error-wrap { text-align: center; padding: 80px 20px; }
.error-wrap .code { font-size: 80px; font-weight: 800; color: var(--gold); }

/* lookup chips */
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--card-2); border: 1px solid var(--border-2);
  border-radius: 99px; padding: 6px 8px 6px 14px; font-size: 13.5px;
}
.chip form { display: inline; }
.chip button {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 14px; padding: 0 4px;
}
.chip button:hover { color: var(--red); }
.add-inline { display: flex; gap: 8px; margin-top: 12px; }
.add-inline input { flex: 1; }

/* ---------------- icons (gold outline set) ---------------- */
.ic { color: var(--gold); display: inline-block; vertical-align: -3px; flex-shrink: 0; }
.btn .ic { color: currentColor; vertical-align: -2px; }
.btn.secondary .ic { color: var(--gold); }
.btn.danger .ic { color: currentColor; }
.breadcrumb .ic { vertical-align: -2px; }
.sidebar .nav-link .ico { display: inline-flex; align-items: center; justify-content: center; width: 20px; }
.sidebar .nav-link .ico .ic { vertical-align: 0; }
.sidebar .caret { display: inline-flex; align-items: center; }
.topbar .burger { display: inline-flex; align-items: center; }
.action-row a .ic { color: currentColor; margin-right: 4px; }
.user-menu .menu a .ic { margin-right: 6px; vertical-align: -3px; }
.pill .ic { vertical-align: -2px; }
.card h2 .ic { vertical-align: -2px; margin-right: 4px; }
.avatar-sm.doc-ic { background: var(--gold-soft); }
.avatar-sm.doc-ic .ic { vertical-align: 0; }
.doc-thumb {
  width: 56px; height: 56px; flex-shrink: 0; border-radius: 10px; overflow: hidden;
  border: 1.5px solid var(--gold-dark); display: block;
}
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doc-thumb:hover { border-color: var(--gold); }

/* ---------------- employee photos ---------------- */
.avatar-sm.has-photo, .avatar-big.has-photo {
  background: none; overflow: hidden; padding: 0;
  border: 1.5px solid var(--gold-dark);
}
.avatar-sm img, .avatar-big img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block;
}
.photo-wrap { position: relative; flex-shrink: 0; }
.photo-wrap form { position: absolute; right: -2px; bottom: -2px; margin: 0; }
.photo-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--card-2); border: 1px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; margin: 0;
}
.photo-btn:hover { background: var(--gold-soft); }
.photo-btn .ic { vertical-align: 0; }

/* ---------------- settings: orderable lookup lists ---------------- */
.lookup-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.lookup-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--card-2); border: 1px solid var(--border-2);
  border-radius: 10px; padding: 7px 10px; font-size: 14px;
}
.lookup-item .pos-form { flex-shrink: 0; }
.lookup-item .pos-form select {
  width: 62px; padding: 6px 8px; font-size: 13px;
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
}
.lookup-item .val { flex: 1; }
.lookup-item .del {
  background: none; border: none; cursor: pointer; color: var(--muted);
  display: inline-flex; align-items: center; padding: 4px; border-radius: 6px;
}
.lookup-item .del:hover { color: var(--red); background: rgba(224, 86, 86, 0.1); }
.lookup-item .del .ic { color: currentColor; vertical-align: 0; }

/* ---------------- import menu ---------------- */
.import-menu { position: relative; }
.import-menu summary {
  list-style: none;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 9px; cursor: pointer;
  font-size: 13px; font-weight: 600;
  background: var(--card-2); color: var(--text);
  border: 1px solid var(--border-2);
}
.import-menu summary::-webkit-details-marker { display: none; }
.import-menu summary:hover { border-color: var(--gold); color: var(--gold-2); }
.import-menu[open] summary .caret { transform: rotate(180deg); }
.import-menu summary .caret { display: inline-flex; transition: transform 0.15s; }
.import-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30;
  width: 320px; background: var(--card); border: 1px solid var(--border-2);
  border-radius: 12px; padding: 16px;
  box-shadow: 0 14px 38px rgba(0,0,0,0.6);
}
.import-pop form { display: flex; flex-direction: column; gap: 8px; }
.import-pop label { font-size: 12.5px; color: var(--muted); font-weight: 600; margin: 0; }
.import-pop label .hint { font-weight: 400; }
.import-pop .btn { justify-content: center; margin-top: 2px; }
.import-sep { height: 1px; background: var(--border); margin: 14px 0; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  body.sidebar-open-mobile .sidebar { transform: translateX(0); }
  .main { margin-left: 0; padding: 80px 16px 30px; }
  .import-pop { right: auto; left: 0; }
}
