/* Paradise Digital Services — staff portal */
:root {
  --brand: #663399;
  --brand-dark: #4a2573;
  --brand-soft: #f1eaf8;
  --saffron: #e8a317;
  --ink: #1e1233;
  --muted: #5b5170;
  --line: #ddd2ea;
  --bg: #fbfafd;
  --card: #ffffff;
  --ok: #1b7f4d;
  --ok-soft: #e7f5ed;
  --warn: #b54708;
  --warn-soft: #fff3e0;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --info-soft: #eaf1fb;
  --radius: 14px;
  --font-body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Bricolage Grotesque", "Source Sans 3", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.55 var(--font-body);
}
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .5rem; color: var(--ink); }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
a { color: var(--brand); }
:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* Top bar ------------------------------------------------------------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  width: min(1150px, 92%);
  margin: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .7rem 0;
}
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: inherit; }
.brand img { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; }
.brand b { display: block; font: 700 1.05rem var(--font-head); color: var(--brand); }
.brand small { display: block; font-size: .75rem; color: var(--muted); font-weight: 600; letter-spacing: .03em; }
.topnav { display: flex; align-items: center; gap: .9rem; font-size: .92rem; flex-wrap: wrap; justify-content: flex-end; }
.topnav .who { color: var(--muted); }
.topnav a:not(.btn) { text-decoration: none; font-weight: 600; }

.container { width: min(1150px, 92%); margin: auto; }
.page { padding: 1.8rem 0 3rem; min-height: 70vh; }
.footer { border-top: 1px solid var(--line); padding: 1.2rem 0; color: var(--muted); font-size: .85rem; }
.footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }

/* Buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: .4rem;
  border: 2px solid var(--brand);
  background: var(--brand);
  color: #fff;
  padding: .65rem 1.1rem;
  border-radius: 10px;
  font: 600 .95rem var(--font-body);
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.ok { background: var(--ok); border-color: var(--ok); }
.btn.ok:hover { filter: brightness(1.1); }
.btn.danger { background: var(--bad); border-color: var(--bad); }
.btn.danger.ghost { background: transparent; color: var(--bad); }
.btn.danger.ghost:hover { background: var(--bad-soft); }
.btn.sm { padding: .35rem .7rem; font-size: .83rem; border-radius: 8px; }
.btn.full { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Cards, grids ------------------------------------------------------------ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.3rem;
}
.card + .card { margin-top: 1.1rem; }
.grid { display: grid; gap: 1.1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; }
.stack > * + * { margin-top: .8rem; }
.page-head { margin-bottom: 1.2rem; }
.page-head p { margin: 0; color: var(--muted); }

.stat { font: 800 2rem/1 var(--font-head); color: var(--brand); }
.stat-label { color: var(--muted); font-size: .85rem; font-weight: 600; margin-bottom: .35rem; }

.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .9rem 1.4rem; }
.kv dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.avatar { width: 128px; height: 128px; border-radius: 16px; object-fit: cover; border: 3px solid var(--brand-soft); background: var(--brand-soft); }
.avatar.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .85rem; text-align: center; }

/* Forms ------------------------------------------------------------------- */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
input[type=text], input[type=password], input[type=email], input[type=date], input[type=time],
input[type=search], input[type=number], select, textarea {
  width: 100%;
  padding: .7rem .8rem;
  border: 1px solid #cfc3dd;
  border-radius: 10px;
  font: 400 1rem var(--font-body);
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: 2px solid var(--brand-soft); }
.field { margin-bottom: 1rem; }
.hint { color: var(--muted); font-size: .82rem; margin-top: .25rem; }
.inline-form { display: flex; gap: .5rem; align-items: end; flex-wrap: wrap; }
.inline-form .field { margin: 0; }
.filters { display: flex; gap: .8rem; align-items: end; flex-wrap: wrap; }
.filters .field { margin: 0; min-width: 150px; }

/* Messages -------------------------------------------------------------- */
.messages { margin-bottom: 1.1rem; }
.alert { padding: .8rem 1rem; border-radius: 10px; margin-bottom: .6rem; border: 1px solid var(--line); background: var(--info-soft); }
.alert.success { background: var(--ok-soft); border-color: #bfe3cd; }
.alert.error { background: var(--bad-soft); border-color: #f4c5bf; }
.alert.warning { background: var(--warn-soft); border-color: #f6d6a8; }
.alert code { background: rgba(0,0,0,.07); padding: .1rem .4rem; border-radius: 6px; }

/* Tables ---------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .65rem .7rem; border-bottom: 1px solid var(--line); font-size: .9rem; vertical-align: middle; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: #faf7fd; white-space: nowrap; }
tbody tr:hover { background: #fcfaff; }
.thumb { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--brand-soft); display: block; }

.pill { display: inline-block; padding: .15rem .6rem; border-radius: 99px; font-size: .75rem; font-weight: 700; background: var(--ok-soft); color: var(--ok); white-space: nowrap; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.grey { background: #eceff3; color: #475467; }
.pill.info { background: var(--info-soft); color: #1e5aa8; }
.pill.brand { background: var(--brand-soft); color: var(--brand); }

.banner { padding: .7rem 1rem; border-radius: 10px; background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; margin-bottom: 1rem; }

/* Sign-in pages (split layout) ---------------------------------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(300px, 5fr) 6fr; }
.auth-side {
  background: linear-gradient(160deg, var(--brand-dark), var(--brand) 60%, #8a4fc0);
  color: #fff;
  padding: 3rem 2.6rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
}
.auth-side .brand b, .auth-side .brand small { color: #fff; }
.auth-side .brand img { width: 56px; height: 56px; border-radius: 14px; border: 2px solid rgba(255,255,255,.4); }
.auth-side h1 { color: #fff; font-size: 2rem; margin-bottom: .8rem; }
.auth-side p { color: rgba(255,255,255,.85); max-width: 34ch; }
.auth-side ul { padding: 0; margin: 1.4rem 0 0; list-style: none; }
.auth-side li { padding: .35rem 0 .35rem 1.7rem; position: relative; color: rgba(255,255,255,.92); }
.auth-side li::before { content: "✓"; position: absolute; left: 0; color: var(--saffron); font-weight: 800; }
.auth-side .legal { font-size: .8rem; color: rgba(255,255,255,.7); }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 2rem 1.2rem; }
.auth-card { width: min(440px, 100%); }
.auth-card .card { padding: 1.8rem; box-shadow: 0 10px 30px rgba(74, 37, 115, .08); }
.auth-card h2 { font-size: 1.5rem; }
.auth-links { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; font-size: .9rem; }
.mobile-brand { display: none; }

/* Administrator layout ----------------------------------------------- */
.admin-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--brand-dark); color: #fff; padding: 1.2rem 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar .brand b, .sidebar .brand small { color: #fff; }
.sidebar .brand { padding: .3rem .4rem 1rem; border-bottom: 1px solid rgba(255,255,255,.18); margin-bottom: 1rem; }
.sidebar nav a {
  display: flex; justify-content: space-between; align-items: center; gap: .5rem;
  padding: .6rem .75rem; border-radius: 10px; color: rgba(255,255,255,.88);
  text-decoration: none; font-weight: 600; margin-bottom: .2rem;
}
.sidebar nav a:hover { background: rgba(255,255,255,.1); }
.sidebar nav a.active { background: #fff; color: var(--brand-dark); }
.sidebar .count { background: var(--saffron); color: #1e1233; border-radius: 99px; padding: 0 .55rem; font-size: .75rem; font-weight: 800; }
.sidebar .spacer { flex: 1; }
.sidebar .me { font-size: .82rem; color: rgba(255,255,255,.75); padding: .8rem .4rem 0; border-top: 1px solid rgba(255,255,255,.18); }
.admin-main { padding: 1.8rem 2rem 3rem; min-width: 0; }
.mobile-bar { display: none; }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .7rem; }
  .sidebar .brand { border: 0; margin: 0; padding: 0 .5rem 0 0; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: .2rem; }
  .sidebar nav a { margin: 0; padding: .4rem .6rem; font-size: .88rem; }
  .sidebar .spacer, .sidebar .me { display: none; }
  .admin-main { padding: 1.2rem 4%; }
}
@media (max-width: 820px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .mobile-brand { display: flex; justify-content: center; margin-bottom: 1.2rem; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  h1 { font-size: 1.4rem; }
  .topnav .who { display: none; }
  .brand small { display: none; }
  .avatar { width: 96px; height: 96px; }
}
@media print {
  .topbar, .sidebar, .footer, .btn { display: none !important; }
}

/* Employee dashboard ---------------------------------------------------- */
.dash-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.profile-row { display: flex; gap: 1.4rem; align-items: flex-start; }
@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .profile-row { flex-direction: column; }
}

/* Manual attendance sheet ------------------------------------------------ */
.sheet-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(170px, 1.1fr) minmax(0, 3fr);
  gap: .8rem 1.2rem;
  align-items: center;
  padding: .9rem 0;
  border-bottom: 1px solid var(--line);
}
.sheet-row:last-child { border-bottom: 0; }
.sheet-form { display: grid; grid-template-columns: 130px 110px 110px minmax(120px, 1fr) auto; gap: .5rem; align-items: center; }
.sheet-form select, .sheet-form input { padding: .5rem .6rem; font-size: .9rem; }
@media (max-width: 1100px) {
  .sheet-row { grid-template-columns: 1fr 1fr; }
  .sheet-form { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .sheet-form input[type=text], .sheet-form button { grid-column: 1 / -1; }
}
.alert.info { background: var(--info-soft); border-color: #c9dcf5; }

/* Leave added by a manager or administrator (not applied for by the employee) */
tr.added-by-staff td { background: var(--brand-soft); }
.balance-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; }
.balance-card { border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.1rem; background: #fff; }
.balance-card .big { font-size: 2.2rem; font-weight: 800; line-height: 1; color: var(--brand); font-family: "Bricolage Grotesque", sans-serif; }
.balance-card .muted { margin-top: .35rem; }

details.edit { display: inline-block; vertical-align: top; }
details.edit > summary { list-style: none; cursor: pointer; display: inline-block; }
details.edit > summary::-webkit-details-marker { display: none; }
details.edit[open] { display: block; margin: .4rem 0; }
details.edit > form { display: grid; gap: .45rem; min-width: 15rem; max-width: 22rem; padding: .7rem; margin-top: .4rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-align: left; }
details.edit label { display: grid; gap: .15rem; font-size: .82rem; font-weight: 600; }
.pw { font-family: ui-monospace, Consolas, monospace; }
.btn.wa { background: #1f9d55; border-color: #1f9d55; }
.btn.wa:hover { background: #17803f; border-color: #17803f; }

/* ---- Phone and installed-app comfort ---- */
body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); -webkit-text-size-adjust: 100%; }
.install-bar {
  position: fixed; left: .6rem; right: .6rem; bottom: calc(.6rem + env(safe-area-inset-bottom)); z-index: 50;
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; justify-content: space-between;
  background: #fff; border: 2px solid var(--brand); border-radius: 12px; padding: .6rem .8rem;
  box-shadow: 0 6px 24px rgba(0,0,0,.2); font-weight: 600;
}
@media (max-width: 640px) {
  input, select, textarea { font-size: 16px; } /* stops phones zooming in when a box is tapped */
  .btn, button { min-height: 44px; }
  .btn.sm { min-height: 40px; }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card { padding: 1rem; }
}
@media (display-mode: standalone) { .install-bar { display: none; } }

/* Administrator layout: the side menu is a drawer, closed by default, so pages use the full width ---------- */
.admin-shell { display: block; }
.admin-top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .7rem;
  padding: .55rem 1rem; background: #fff; border-bottom: 1px solid var(--line, #e6dff0);
}
.menu-btn {
  border: 1px solid var(--line, #e6dff0); background: #fff; color: var(--brand-dark); border-radius: 10px;
  font-size: 1.35rem; line-height: 1; padding: .35rem .7rem; cursor: pointer;
}
.top-logo img { height: 34px; width: auto; border-radius: 6px; display: block; }
.top-search { flex: 1; max-width: 560px; }
.top-search input { width: 100%; padding: .5rem .8rem; border-radius: 10px; border: 1px solid var(--line, #e6dff0); background: #faf8fd; }
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 270px; max-width: 86vw; height: 100vh; z-index: 50;
  display: flex; flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 0; padding: 1.2rem 1rem;
  overflow-y: auto; transform: translateX(-105%); transition: transform .2s ease; visibility: hidden;
}
.sidebar .brand { border-bottom: 1px solid rgba(255,255,255,.18); margin: 0 0 1rem; padding: .3rem .4rem 1rem; }
.sidebar nav { display: block; }
.sidebar nav a { margin-bottom: .2rem; padding: .6rem .75rem; font-size: 1rem; }
.sidebar .spacer { display: block; }
.sidebar .me { display: block; }
body.menu-open .sidebar { transform: none; visibility: visible; box-shadow: 8px 0 30px rgba(0, 0, 0, .25); }
.menu-backdrop { position: fixed; inset: 0; background: rgba(20, 10, 40, .45); z-index: 40; }
.menu-backdrop[hidden] { display: none; }
@media print { .admin-top, .menu-backdrop { display: none !important; } }
