@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink: #241C3D;
  --ink-soft: #6B6284;
  --paper: #F7F5FB;
  --panel: #FFFFFF;
  --line: #E9E4F2;
  --violet: #5B3FA0;
  --violet-deep: #45307D;
  --violet-glow: rgba(91,63,160,.14);
  --coral: #FF6B5B;
  --coral-deep: #E85040;
  --teal: #17A398;
  --red: #E14F4F;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(36,28,61,.05), 0 2px 8px rgba(36,28,61,.05);
  --shadow: 0 4px 14px rgba(36,28,61,.07), 0 14px 40px rgba(91,63,160,.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1100px 500px at 100% -10%, rgba(255,107,91,.10), transparent 60%),
    radial-gradient(900px 500px at -10% 0%, rgba(91,63,160,.12), transparent 55%),
    var(--paper);
  background-attachment: fixed;
}
h1, h2, h3, .display {
  font-family: 'Sora', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--ink);
}
a { color: var(--violet); }

/* ---------- Layout shell ---------- */
.jk-shell { min-height: 100%; display: flex; flex-direction: column; }

.jk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.72);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.jk-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 19px;
}

/* Signature mark: an animated "waveform" — literal to the brand: Speak */
.mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(155deg, var(--violet), var(--coral));
  display: flex; align-items: center; justify-content: center;
  gap: 3px;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(91,63,160,.35);
}
.mark i {
  display: inline-block;
  width: 3px;
  border-radius: 3px;
  background: #fff;
  animation: wave 1.1s ease-in-out infinite;
}
.mark i:nth-child(1) { height: 8px; animation-delay: 0s; }
.mark i:nth-child(2) { height: 15px; animation-delay: .15s; }
.mark i:nth-child(3) { height: 11px; animation-delay: .3s; }
.mark i:nth-child(4) { height: 6px; animation-delay: .45s; }
@keyframes wave {
  0%, 100% { transform: scaleY(.55); }
  50% { transform: scaleY(1); }
}
@media (prefers-reduced-motion: reduce) {
  .mark i { animation: none; }
}

.jk-role-pill {
  font-size: 11px;
  padding: 4px 11px;
  border-radius: 100px;
  background: var(--violet-glow);
  color: var(--violet-deep);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-left: 4px;
}
.jk-header-right { display: flex; align-items: center; gap: 16px; }
.jk-header-right .who { font-size: 14px; color: var(--ink-soft); font-weight: 500; }

.jk-main {
  flex: 1;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 28px 60px;
  animation: rise .5s cubic-bezier(.16,1,.3,1);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Buttons / forms ---------- */
button, .btn {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  padding: 11px 18px;
  cursor: pointer;
  background: var(--violet);
  color: #fff;
  transition: transform .1s ease, box-shadow .15s ease, opacity .12s ease;
  box-shadow: 0 2px 8px rgba(91,63,160,.25);
}
button:hover, .btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(91,63,160,.32); }
button:active, .btn:active { transform: translateY(0) scale(.98); }
button.secondary { background: #fff; color: var(--violet-deep); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
button.secondary:hover { box-shadow: var(--shadow); }
button.amber { background: linear-gradient(135deg, var(--coral), var(--coral-deep)); box-shadow: 0 2px 8px rgba(232,80,64,.3); }
button.danger { background: var(--red); }
button.ghost { background: transparent; color: var(--ink-soft); padding: 7px 11px; box-shadow: none; }
button.ghost:hover { background: var(--violet-glow); color: var(--violet-deep); transform: none; box-shadow: none; }
button:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

input, select, textarea {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fdfcfe;
  color: var(--ink);
  width: 100%;
  transition: border-color .12s ease, box-shadow .12s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px var(--violet-glow);
}
button:focus-visible { outline: 2px solid var(--violet-deep); outline-offset: 2px; }
label { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); display: block; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .03em; }
.field { margin-bottom: 16px; }

/* ---------- Cards / panels ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease;
}
.card:hover { box-shadow: var(--shadow); }
.card + .card { margin-top: 20px; }
.card h2 { margin-top: 0; font-size: 17px; }
.card-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

/* ---------- Login screen ---------- */
.jk-login-wrap {
  min-height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.jk-login-card {
  width: 100%; max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 38px 34px;
  box-shadow: var(--shadow);
  animation: rise .5s cubic-bezier(.16,1,.3,1);
}
.jk-login-card .jk-brand { justify-content: center; margin-bottom: 6px; font-size: 25px;}
.jk-login-card .mark { width: 42px; height: 42px; border-radius: 13px; }
.jk-login-sub { text-align: center; color: var(--ink-soft); font-size: 13.5px; margin-bottom: 26px; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-soft); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--violet-glow); }

/* ---------- Status badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 100px; font-size: 11.5px; font-weight: 700; letter-spacing: .01em; }
.badge-open { background: var(--violet-glow); color: var(--violet-deep); }
.badge-booked { background: rgba(255,107,91,.14); color: var(--coral-deep); }
.badge-blocked { background: rgba(107,98,132,.12); color: var(--ink-soft); }
.badge-completed { background: rgba(23,163,152,.14); color: var(--teal); }
.badge-absent { background: rgba(225,79,79,.12); color: var(--red); }
.badge-leave { background: rgba(91,63,160,.12); color: var(--violet-deep); }

/* ---------- Balance meter (signature element) ---------- */
.balance-meter { display: flex; align-items: baseline; gap: 12px; }
.balance-meter .num {
  font-family: 'Sora', sans-serif; font-size: 46px; font-weight: 800; line-height: 1;
  background: linear-gradient(135deg, var(--violet), var(--coral));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.balance-meter .label { color: var(--ink-soft); font-size: 14px; font-weight: 500; }
.balance-dots { display: flex; gap: 7px; margin-top: 14px; flex-wrap: wrap; }
.balance-dots span {
  width: 13px; height: 13px; border-radius: 50%;
  background: linear-gradient(135deg, var(--violet), var(--coral));
  display: inline-block;
}
.balance-dots span.empty { background: var(--line); }

/* ---------- Calendar grid ---------- */
.cal-day-col { min-width: 150px; }
.cal-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.cal-day-head { font-weight: 700; font-size: 13px; margin-bottom: 8px; color: var(--ink-soft); }
.slot {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 10px;
  font-size: 13.5px;
  background: #fff;
  transition: border-color .12s ease, transform .12s ease;
}
.slot:hover { transform: translateX(2px); }
.slot.open { border-color: rgba(91,63,160,.4); border-left: 3px solid var(--violet); }
.slot.booked { border-left: 3px solid var(--coral); background: rgba(255,107,91,.04); }
.slot.blocked { background: var(--paper); color: var(--ink-soft); }
.slot .t { font-weight: 700; font-family: 'Sora', sans-serif; letter-spacing: -.01em; }
.slot .actions { margin-top: 8px; display: flex; gap: 7px; flex-wrap: wrap; }
.slot .actions button { padding: 6px 11px; font-size: 12px; box-shadow: none; }

.empty-state {
  text-align: center; padding: 44px 20px; color: var(--ink-soft);
  border: 1.5px dashed var(--line); border-radius: var(--radius-sm);
}
.jk-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 13px 22px; border-radius: 12px;
  font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: all .3s cubic-bezier(.16,1,.3,1);
  box-shadow: var(--shadow);
  z-index: 999;
}
.jk-toast.jk-toast-error { background: var(--red); }
.jk-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hint { font-size: 12.5px; color: var(--ink-soft); margin-top: 4px; }
.section-title { display:flex; align-items:center; justify-content:space-between; margin-bottom: 16px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 720px) {
  .two-col { grid-template-columns: 1fr; }
  .jk-main { padding: 20px 16px 50px; }
}

/* ============================================================
   Sidebar layout (column-based shell)
   ============================================================ */
.jk-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  align-items: start;
}
.jk-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px 18px;
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--line);
}
.jk-sidebar .jk-brand { padding: 4px 10px 0; }
.jk-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 32px;
}
.jk-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 14px;
  border-radius: 11px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: background .12s ease, color .12s ease;
}
.jk-nav a .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--line);
  flex-shrink: 0;
  transition: background .12s ease, transform .12s ease;
}
.jk-nav a:hover { background: var(--violet-glow); color: var(--violet-deep); }
.jk-nav a:hover .dot { background: var(--violet); transform: scale(1.3); }
.jk-sidebar-spacer { flex: 1; }
.jk-sidebar-foot {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: 16px;
}
.jk-sidebar-foot .who { font-size: 13.5px; font-weight: 600; color: var(--ink); display: block; margin-bottom: 2px; }
.jk-sidebar-foot .role-tag { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; }
.jk-sidebar-foot button { width: 100%; margin-top: 12px; }

.jk-content { min-width: 0; }
.jk-topbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.8);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}

@media (max-width: 860px) {
  .jk-shell { grid-template-columns: 1fr; }
  .jk-sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: 14px 16px;
    gap: 18px;
  }
  .jk-sidebar .jk-brand { padding: 0; }
  .jk-nav { flex-direction: row; margin-top: 0; overflow-x: auto; gap: 4px; }
  .jk-nav a { white-space: nowrap; padding: 8px 12px; }
  .jk-sidebar-spacer { display: none; }
  .jk-sidebar-foot { display: none; }
  .jk-topbar { display: flex; }
}

/* ============================================================
   Column-based day calendar (used for schedule / open slots)
   ============================================================ */
.day-columns {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 10px;
  scroll-snap-type: x proximity;
}
.day-col {
  flex: 0 0 216px;
  scroll-snap-align: start;
}
.day-col-head {
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--line);
}
.day-col-head .dow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-soft);
}
.day-col-head .dnum {
  font-family: 'Sora', sans-serif;
  font-size: 21px;
  font-weight: 700;
}
.day-col-head.today .dnum { color: var(--violet); }
.day-col-empty {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 18px 10px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 12.5px;
}

/* Dashboard stat grid for column-style summary cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stat-card .stat-num {
  font-family: 'Sora', sans-serif;
  font-size: 30px;
  font-weight: 800;
  color: var(--violet-deep);
  line-height: 1;
}
.stat-card .stat-label {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 6px;
  font-weight: 600;
}

/* ============================================================
   Weekly availability grid + timezone controls
   ============================================================ */
.tz-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.tz-row label { margin: 0; }
.tz-row select { width: auto; min-width: 220px; }

.week-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.week-nav button { padding: 8px 14px; }
.week-nav .week-label {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 14.5px;
  color: var(--ink);
  min-width: 170px;
  text-align: center;
}

.wgrid-wrap { overflow-x: auto; }
.wgrid {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 640px;
  width: 100%;
}
.wgrid th, .wgrid td { border: none; padding: 0; }
.wgrid thead th {
  text-align: center;
  padding: 6px 4px 10px;
  font-family: 'Sora', sans-serif;
  font-size: 12.5px;
  color: var(--ink-soft);
  position: sticky; top: 0; background: var(--panel); z-index: 2;
}
.wgrid thead th .dnum { color: var(--ink); font-weight: 700; font-size: 14px; }
.wgrid .time-col {
  width: 78px;
  font-size: 11.5px;
  color: var(--ink-soft);
  text-align: right;
  padding-right: 10px;
  white-space: nowrap;
  vertical-align: middle;
}
.wgrid .gap-row td { height: 14px; }
.wcell {
  width: 100%;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  margin: 2px;
  cursor: pointer;
  transition: background .1s ease, transform .08s ease, border-color .1s ease;
}
.wcell:hover { transform: scale(1.04); }
.wcell.open { background: var(--violet-glow); border-color: var(--violet); }
.wcell.booked { background: rgba(255,107,91,.18); border-color: var(--coral); cursor: default; }
.wcell.blocked { background: repeating-linear-gradient(135deg, var(--paper), var(--paper) 4px, var(--line) 4px, var(--line) 6px); cursor: not-allowed; }
.wcell.past { opacity: .4; cursor: not-allowed; }
.wgrid td.cellwrap { padding: 1px; }
.wgrid-legend { display: flex; gap: 18px; font-size: 12px; color: var(--ink-soft); margin-top: 12px; flex-wrap: wrap; }
.wgrid-legend span { display: inline-flex; align-items: center; gap: 6px; }
.wgrid-legend i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; border: 1px solid var(--line); }
.wgrid-legend i.open { background: var(--violet-glow); border-color: var(--violet); }
.wgrid-legend i.booked { background: rgba(255,107,91,.18); border-color: var(--coral); }
.wgrid-legend i.blocked { background: repeating-linear-gradient(135deg, var(--paper), var(--paper) 4px, var(--line) 4px, var(--line) 6px); }

.copy-forward { display: flex; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.copy-forward input { width: 70px; }
