/* Artery Digital admin theme */
@font-face {
  font-family: "Anek Latin";
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url("../fonts/anek-latin-latin-wght-normal.woff2") format("woff2-variations"), url("../fonts/anek-latin-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0-FF, U+131, U+152-153, U+2BB-2BC, U+2C6, U+2DA, U+2DC, U+304, U+308, U+329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Anek Latin";
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url("../fonts/anek-latin-latin-ext-wght-normal.woff2") format("woff2-variations"), url("../fonts/anek-latin-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+100-2BA, U+2BD-2C5, U+2C7-2CC, U+2CE-2D7, U+2DD-2FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --navy: #202b6d;
  --navy-700: #18215a;
  --blue: #354dce;
  --blue-600: #2a40b5;
  --blue-50: #eef1fc;
  --cyan: #71fdff;
  --peach: #fcdecb;
  --peach-50: #fff6f0;
  --bg: #f5f6fb;
  --surface: #ffffff;
  --text: #161c46;
  --text-muted: #5d6385;
  --border: #dfe2ef;
  --border-strong: #c7cbe0;
  --danger: #c62828;
  --danger-50: #fdecec;
  --success: #1b7f4b;
  --success-50: #e8f6ee;
  --radius: 10px;
  --font: "Anek Latin", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --sidebar-w: 84px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.5; color: var(--text); background: var(--bg); }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; width: var(--sidebar-w); flex: none;
  background: var(--navy); color: #fff; display: flex; flex-direction: column; align-items: center; padding: 18px 0;
}
.sidebar .brand { display: block; width: 34px; margin-bottom: 28px; }
.sidebar .brand img { width: 100%; height: auto; display: block; }
.nav { display: flex; flex-direction: column; gap: 6px; width: 100%; align-items: center; flex: 1; }
.nav a, .nav button {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: 68px; padding: 9px 4px 7px; border-radius: 10px; border: 0; background: none;
  color: #c9cff3; text-decoration: none; font-size: .72rem; letter-spacing: .02em; cursor: pointer;
}
.nav a:hover, .nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a[aria-current="page"] { background: rgba(113,253,255,.12); color: var(--cyan); }
.nav svg { width: 24px; height: 24px; fill: currentColor; }
.nav .spacer { flex: 1; }
.main { flex: 1; min-width: 0; padding: 22px 28px 40px; }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.btn-danger { color: var(--danger); border-color: #efc4c4; }
.btn-danger:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-icon { width: 40px; padding: 0; }
.btn[disabled] { opacity: .55; cursor: default; pointer-events: none; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-weight: 600; font-size: .9rem; color: var(--text); }
.field .hint { font-size: .82rem; color: var(--text-muted); }
.req { color: var(--danger); margin-left: 2px; }
.input, .select, textarea.input {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; padding: 10px 12px; }
.input:focus, .select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(53,77,206,.18); }
.field.has-error .input, .field.has-error .select, .field.has-error .tzp-button { border-color: var(--danger); }
.error-text { color: var(--danger); font-size: .84rem; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }

/* ---------- Toast & alerts ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); z-index: 1000;
  background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: .92rem;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; box-shadow: 0 8px 24px rgba(22,28,70,.25);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }
.alert { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; }
.alert-error { background: var(--danger-50); color: #8e1c1c; border: 1px solid #f3c7c7; }
.alert-success { background: var(--success-50); color: #135c37; border: 1px solid #bfe3cf; }

/* ---------- Dialog ---------- */
dialog.confirm {
  border: 0; border-radius: 14px; padding: 24px; max-width: 420px; width: calc(100% - 32px);
  box-shadow: 0 24px 64px rgba(22,28,70,.3); color: var(--text);
}
dialog.confirm::backdrop { background: rgba(22,28,70,.45); }
dialog.confirm h2 { margin: 0 0 8px; font-size: 1.25rem; }
dialog.confirm p { margin: 0 0 20px; color: var(--text-muted); }
dialog.confirm .actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Calendar page ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.toolbar .grow { flex: 1; }
.month-jump { position: relative; }
.month-title {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; cursor: pointer;
  font-size: 1.6rem; font-weight: 600; color: var(--navy); padding: 2px 8px; border-radius: 8px; letter-spacing: -.01em;
}
.month-title:hover { background: var(--blue-50); }
.month-title svg { width: 20px; height: 20px; fill: currentColor; }
.month-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; background: #fff; border: 1px solid var(--border);
  border-radius: 12px; padding: 12px; box-shadow: 0 16px 40px rgba(22,28,70,.18); width: 280px;
}
.month-pop .year-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-weight: 600; }
.month-pop .months { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.month-pop .months button { border: 0; background: var(--bg); border-radius: 8px; padding: 8px 0; cursor: pointer; }
.month-pop .months button:hover { background: var(--blue-50); color: var(--blue); }
.month-pop .months button[aria-current="true"] { background: var(--blue); color: #fff; }

.seg { display: inline-flex; background: #e9ebf5; border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; height: 34px; padding: 0 14px; border-radius: 999px; cursor: pointer; color: var(--text-muted); font-weight: 500; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(22,28,70,.15); }

.search { position: relative; display: flex; align-items: center; }
.search input { width: 0; padding: 0; border: 0; opacity: 0; transition: width .2s, opacity .2s, padding .2s; }
.search.open input { width: 220px; opacity: 1; padding: 0 12px 0 38px; border: 1px solid var(--border-strong); }
.search.open .btn-icon { position: absolute; left: 0; border-color: transparent; background: transparent; }
.tz-note { font-size: .85rem; color: var(--text-muted); margin: 0 0 12px 8px; }

.calendar-card { padding: 12px; }
#calendar {
  --fc-border-color: var(--border);
  --fc-today-bg-color: var(--peach-50);
  --fc-event-bg-color: var(--blue);
  --fc-event-border-color: var(--blue);
  --fc-page-bg-color: #fff;
  --fc-neutral-bg-color: #f3f4f9;
  --fc-list-event-hover-bg-color: var(--blue-50);
  --fc-small-font-size: .8rem;
  font-size: .92rem;
}
#calendar .fc-col-header-cell-cushion { color: var(--text-muted); font-weight: 600; text-transform: uppercase; font-size: .76rem; letter-spacing: .06em; padding: 8px 4px; text-decoration: none; }
#calendar .fc-daygrid-day-number { color: var(--text); text-decoration: none; font-weight: 500; padding: 6px 8px; }
#calendar .fc-day-today .fc-daygrid-day-number {
  background: var(--blue); color: #fff; border-radius: 999px; min-width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; margin: 4px; padding: 0 6px;
}
#calendar .fc-daygrid-day.fc-day-past:not(.fc-day-other) { background: #fafbfd; }
#calendar .fc-daygrid-day.fc-day-other {
  background: repeating-linear-gradient(135deg, #f6f7fb, #f6f7fb 6px, #eef0f7 6px, #eef0f7 7px);
}
#calendar .fc-daygrid-day.fc-day-other .fc-daygrid-day-number { color: #a3a8c3; }
#calendar .fc-daygrid-day-frame { min-height: 108px; cursor: pointer; }
#calendar .fc-daygrid-day-frame:hover { box-shadow: inset 0 0 0 2px rgba(53,77,206,.18); }
#calendar .fc-daygrid-dot-event { padding: 1px 4px; border-radius: 4px; }
#calendar .fc-daygrid-dot-event:hover { background: var(--blue-50); }
#calendar .fc-daygrid-event-dot { border-color: var(--blue); }
#calendar .fc-event-time { font-weight: 600; color: var(--navy); }
#calendar .fc-event-title { color: var(--text); overflow: hidden; text-overflow: ellipsis; }
#calendar .fc-daygrid-block-event .fc-event-title { color: #fff; font-weight: 500; }
#calendar .fc-daygrid-block-event { border-radius: 5px; padding: 1px 4px; }
#calendar .fc-daygrid-more-link { color: var(--blue); font-weight: 600; }
#calendar .fc-list-day-cushion { background: var(--bg); }
#calendar .fc-list-event { cursor: pointer; }
#calendar .fc-timegrid-event { border-radius: 6px; }
#calendar .fc-list-empty { background: #fff; }

.results { padding: 6px; }
.results h2 { font-size: 1rem; margin: 8px 10px 10px; color: var(--text-muted); font-weight: 500; }
.result {
  display: grid; grid-template-columns: 170px 1fr; gap: 12px; padding: 12px 12px; border-radius: 8px;
  text-decoration: none; color: var(--text); border-top: 1px solid var(--border);
}
.result:first-of-type { border-top: 0; }
.result:hover { background: var(--blue-50); }
.result .r-date { font-weight: 600; color: var(--navy); font-size: .92rem; }
.result .r-title { font-weight: 600; }
.result .r-meta { font-size: .85rem; color: var(--text-muted); }
.empty { padding: 28px; text-align: center; color: var(--text-muted); }

/* ---------- Event form ---------- */
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 1.6rem; color: var(--navy); font-weight: 600; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--text-muted); text-decoration: none; font-weight: 500; }
.back:hover { color: var(--blue); }
.back svg { width: 20px; height: 20px; fill: currentColor; }
.head-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; max-width: 1240px; }
.form-card { padding: 26px 28px 28px; display: flex; flex-direction: column; gap: 22px; }
.title-input {
  width: 100%; border: 0; border-bottom: 2px solid var(--border); font-size: 1.8rem; font-weight: 600; color: var(--navy);
  padding: 4px 0 8px; background: transparent; border-radius: 0;
}
.title-input::placeholder { color: #a6abc8; font-weight: 500; }
.title-input:focus { outline: none; border-bottom-color: var(--blue); }
.field.has-error .title-input { border-bottom-color: var(--danger); }
.when-grid { display: grid; grid-template-columns: 1.2fr .9fr auto .9fr 1.2fr; gap: 10px; align-items: end; }
.when-grid .dash { padding-bottom: 10px; color: var(--text-muted); }
.when-grid.all-day { grid-template-columns: 1fr auto 1fr; }
.when-grid.all-day .time-field { display: none; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); font-weight: 600; margin: 4px 0 -8px; }
.form-actions { display: flex; gap: 10px; align-items: center; padding-top: 6px; border-top: 1px solid var(--border); padding-top: 20px; }
.form-actions .grow { flex: 1; }

.side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 22px; }
.side-card { padding: 18px; }
.side-card h2 { margin: 0 0 10px; font-size: 1rem; color: var(--navy); }
.link-box { display: flex; gap: 8px; }
.link-box input { flex: 1; min-width: 0; height: 40px; font-size: .88rem; background: var(--bg); }
.side-card .muted { color: var(--text-muted); font-size: .86rem; margin: 0; }
.side-card .meta { font-size: .82rem; color: var(--text-muted); margin-top: 10px; line-height: 1.6; }
.side-list { display: flex; flex-direction: column; gap: 8px; }
.side-list .btn { justify-content: flex-start; }
.save-banner { border-left: 4px solid var(--success); }

/* Time zone picker */
.tzp { position: relative; }
.tzp-button {
  width: 100%; height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; cursor: pointer; text-align: left;
}
.tzp-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tzp-button svg { width: 18px; height: 18px; fill: var(--text-muted); flex: none; }
.tzp-pop {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 40; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 16px 40px rgba(22,28,70,.18); padding: 8px;
}
.tzp-pop input { margin-bottom: 6px; }
.tzp-list { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow: auto; }
.tzp-list li { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: .92rem; }
.tzp-list li[aria-selected="true"] { background: var(--blue-50); color: var(--blue); }
.tzp-list li.current { font-weight: 600; }

/* Quill editor */
.editor-wrap { border: 1px solid var(--border-strong); border-radius: 8px; overflow: visible; background: #fff; position: relative; }
.editor-wrap .ql-toolbar.ql-snow { border: 0; border-bottom: 1px solid var(--border); border-radius: 8px 8px 0 0; font-family: var(--font); padding: 6px 8px; }
.editor-wrap .ql-container.ql-snow { border: 0; font-family: var(--font); font-size: 1rem; }
.editor-wrap:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(53,77,206,.18); }
.editor-wrap .ql-editor:focus, .editor-wrap .ql-editor:focus-visible, .editor-wrap textarea.source:focus-visible { outline: none; }
.editor-wrap .ql-editor { min-height: 200px; max-height: 520px; overflow-y: auto; }
.editor-wrap .ql-editor.ql-blank::before { color: #a6abc8; font-style: normal; }
.editor-wrap textarea.source {
  width: 100%; min-height: 240px; border: 0; padding: 12px 15px; font-family: ui-monospace, Consolas, monospace; font-size: .85rem;
  resize: vertical; border-radius: 0 0 8px 8px; display: block;
}
.editor-wrap .ql-toolbar button.ql-active, .editor-wrap .ql-toolbar button:hover { color: var(--blue); }
.editor-wrap .ql-toolbar .ql-emoji, .editor-wrap .ql-toolbar .ql-source { width: 32px; }
.editor-wrap.source-mode .ql-formats:not(.keep) { opacity: .35; pointer-events: none; }
.editor-wrap .ql-snow .ql-tooltip { z-index: 5; }
.pop {
  position: absolute; z-index: 50; background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 16px 40px rgba(22,28,70,.18); padding: 10px;
}
.emoji-grid { display: grid; grid-template-columns: repeat(8, 32px); gap: 2px; }
.emoji-grid button { width: 32px; height: 32px; border: 0; background: none; border-radius: 6px; font-size: 1.15rem; cursor: pointer; line-height: 1; }
.emoji-grid button:hover { background: var(--blue-50); }
.img-pop { display: flex; gap: 8px; width: min(440px, 80vw); }

/* ---------- Login ---------- */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(ellipse at 20% 0%, rgba(113,253,255,.22), transparent 55%), radial-gradient(ellipse at 100% 100%, rgba(32,43,109,.55), transparent 60%), var(--blue);
}
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 32px 30px; box-shadow: 0 30px 80px rgba(16,22,70,.35); }
.login-logo { display: block; width: 150px; margin: 0 auto 18px; }
.login-logo-wrap { background: var(--navy); border-radius: 12px; padding: 16px; margin: -8px 0 22px; }
.login-card h1 { font-size: 1.35rem; margin: 0 0 18px; text-align: center; color: var(--navy); }
.login-card form { display: flex; flex-direction: column; gap: 16px; }
.login-card .btn { width: 100%; height: 46px; }
.login-foot { text-align: center; color: rgba(255,255,255,.75); font-size: .8rem; margin-top: 18px; }

/* ---------- Users ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 12px 14px; border-top: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); border-top: 0; }
.table td .row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.users-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; max-width: 1100px; }
.users-layout form { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .form-layout, .users-layout { grid-template-columns: 1fr; }
  .side { position: static; }
}
@media (max-width: 760px) {
  :root { --sidebar-w: 64px; }
  .main { padding: 16px 14px 32px; }
  .nav a, .nav button { width: 56px; font-size: .66rem; }
  .when-grid { grid-template-columns: 1fr 1fr; }
  .when-grid .dash { display: none; }
  .when-grid.all-day { grid-template-columns: 1fr 1fr; }
  .two { grid-template-columns: 1fr; }
  .form-card { padding: 18px 16px; }
  .month-title { font-size: 1.25rem; }
  .search.open input { width: 160px; }
  .result { grid-template-columns: 1fr; gap: 2px; }
  #calendar .fc-daygrid-day-frame { min-height: 72px; }
}

/* Week view: white text on solid event blocks */
#calendar .fc-timegrid-event .fc-event-time,
#calendar .fc-timegrid-event .fc-event-title { color: #fff; }
#calendar .fc-timegrid-event .fc-event-time { font-weight: 600; }
