/* Online AMS - "clean blue, top menu" design (sample 1).
   Animations are short and switch off for people who turned animations off in Windows. */
:root {
  --ink: #1c2530;
  --muted: #627084;
  --line: #d9e0e8;
  --bg: #f2f5f9;
  --card: #ffffff;
  --brand: #14508c;
  --brand-dark: #0e3a66;
  --brand2: #1f6fc0;
  --accent: #f5b800;
  --soft: #eaf2fb;
  --ok: #1f7a4d;
  --warn: #a15c00;
  --bad: #b3261e;
  --radius: 10px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--brand); }

/* ---------- entrance animations ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop { 40% { transform: scale(1.35); } }
@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes ripple { to { transform: scale(3.2); opacity: 0; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

main > * { animation: rise .45s var(--ease) both; }
main > *:nth-child(2) { animation-delay: .05s; }
main > *:nth-child(3) { animation-delay: .1s; }
main > *:nth-child(4) { animation-delay: .15s; }
main > *:nth-child(n+5) { animation-delay: .2s; }
form > .card { animation: rise .45s var(--ease) both; }
form > .card:nth-of-type(2) { animation-delay: .06s; }
form > .card:nth-of-type(3) { animation-delay: .12s; }
form > .card:nth-of-type(n+4) { animation-delay: .18s; }

/* ---------- top menu ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 22px;
  min-height: 60px;
  background: var(--brand);
  color: #fff;
  flex-wrap: wrap;
  box-shadow: 0 2px 10px rgba(14, 58, 102, .25);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 17px; text-decoration: none; line-height: 1.15; }
.topbar .brand img { width: 42px; height: 42px; border-radius: 50%; background: #fff; padding: 2px; transition: transform .4s var(--ease); }
.topbar .brand:hover img { transform: rotate(-10deg) scale(1.06); }
.topbar .brand span { display: block; font-weight: 400; font-size: 11px; opacity: .85; margin: 0; }
.topbar nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.topbar nav a { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; padding: 9px 13px; border-radius: 8px; opacity: .82;
  transition: background .2s, opacity .2s, transform .2s; }
.topbar nav a svg { width: 19px; height: 19px; flex: none; }
.topbar nav a:hover { opacity: 1; background: rgba(255, 255, 255, .14); transform: translateY(-1px); }
.topbar nav a.on { opacity: 1; font-weight: 600; background: rgba(255, 255, 255, .22); }
.topbar .who { display: flex; gap: 12px; align-items: center; font-size: 13px; margin: 0; }
.topbar .link { background: none; border: 1px solid rgba(255, 255, 255, .7); color: #fff; cursor: pointer; font: inherit; padding: 4px 12px; border-radius: 7px; transition: background .2s; }
.topbar .link:hover { background: rgba(255, 255, 255, .18); }

main { max-width: 1080px; margin: 0 auto; padding: 26px 18px 56px; }

h1 { font-size: 24px; margin: 2px 0 16px; }
h2 { font-size: 16px; margin: 0 0 12px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(20, 40, 70, .04); }

.headrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.headrow h1 { margin: 0; }

/* ---------- home tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 22px; }
.tiles > * { animation: rise .5s var(--ease) both; }
.tiles > *:nth-child(2) { animation-delay: .06s; }
.tiles > *:nth-child(3) { animation-delay: .12s; }
.tiles > *:nth-child(4) { animation-delay: .18s; }
.tile { position: relative; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); overflow: hidden;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s; }
.tile:hover { transform: translateY(-5px); box-shadow: 0 12px 26px rgba(20, 40, 70, .13); border-color: var(--brand); }
.tile .main { display: flex; flex-direction: column; gap: 6px; padding: 20px 20px 14px; text-decoration: none; color: inherit; flex: 1; }
.tile .ico { width: 46px; height: 46px; border-radius: 12px; background: var(--soft); color: var(--brand); display: grid; place-items: center; transition: transform .3s; }
.tile .ico svg { width: 24px; height: 24px; }
.tile:hover .ico { transform: rotate(-8deg) scale(1.1); }
.tile strong { display: block; font-size: 17px; color: var(--ink); margin: 4px 0 0; }
.tile span.sub { color: var(--muted); font-size: 13px; }
.tile .count { position: absolute; right: 14px; top: 14px; background: var(--accent); color: #2a2118; border-radius: 20px; padding: 2px 10px; font-size: 13px; font-weight: 700; }
.tile .more { display: block; padding: 9px 20px; border-top: 1px solid var(--line); font-size: 13px; text-decoration: none; color: var(--brand); transition: background .2s, padding-left .2s; }
.tile .more:hover { background: var(--soft); padding-left: 26px; }
.legend { color: var(--muted); font-size: 13px; }
.legend b { background: var(--accent); color: #2a2118; border-radius: 20px; padding: 1px 9px; font-size: 12px; }

/* ---------- buttons ---------- */
.btn { position: relative; overflow: hidden; display: inline-block; padding: 9px 18px; border-radius: 9px; border: 1.5px solid var(--brand); background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: background .2s, border-color .2s, transform .15s, box-shadow .2s; }
.btn:hover { background: var(--brand2); border-color: var(--brand2); transform: translateY(-2px); box-shadow: 0 8px 18px rgba(20, 80, 140, .3); }
.btn:active { transform: none; box-shadow: none; }
.btn.ghost { background: #fff; color: var(--brand); border-color: var(--brand); }
.btn.ghost:hover { background: var(--soft); box-shadow: none; }
.btn.danger { background: #fff; color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: #fbe4e2; box-shadow: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.small { padding: 5px 11px; font-size: 13px; border-radius: 7px; }
.btn .ripple { position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .5); transform: scale(0); animation: ripple .6s linear; pointer-events: none; }
.btn.ghost .ripple, .btn.danger .ripple { background: rgba(20, 80, 140, .18); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* ---------- lists ---------- */
table.list { width: 100%; border-collapse: collapse; background: var(--card); }
table.list th, table.list td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f7f9fc; }
table.list tr { transition: background .15s; }
table.list tr:hover td { background: var(--soft); }
table.list tr:last-child td { border-bottom: 0; }
table.list td a { font-weight: 600; text-decoration: none; }
table.list td a:hover { text-decoration: underline; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.empty { padding: 28px; text-align: center; color: var(--muted); }

.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.pending { background: #fff3dc; color: var(--warn); }
.badge.done { background: #e1f3ea; color: var(--ok); }
.badge.cancelled { background: #fbe4e2; color: var(--bad); }

.flash { padding: 11px 15px; border-radius: 9px; margin-bottom: 14px; border: 1px solid var(--line); background: var(--soft); animation: rise .45s var(--ease) both; }
.flash.ok { background: #e1f3ea; border-color: #a9d8c0; color: #14553a; }
.flash.error { background: #fbe4e2; border-color: #efb3ae; color: #7d1a15; }
ul.errors { margin: 0; padding-left: 18px; }

form.search { display: flex; gap: 8px; }
.syncnote { margin: -6px 0 10px; font-size: 13px; color: var(--muted); }

/* ---------- forms ---------- */
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px 14px; }
.grid > .f { grid-column: span 4; }
.grid > .f.w2 { grid-column: span 2; }
.grid > .f.w3 { grid-column: span 3; }
.grid > .f.w6 { grid-column: span 6; }
.grid > .f.w8 { grid-column: span 8; }
.grid > .f.w12 { grid-column: span 12; }
@media (max-width: 720px) { .grid > .f, .grid > .f.w2, .grid > .f.w3, .grid > .f.w6, .grid > .f.w8 { grid-column: span 12; } }

label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .03em; }
input[type=text], input[type=password], input[type=date], input[type=time], input[type=datetime-local], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 9px 12px; border: 1.5px solid #c3ccd8; border-radius: 9px; font: inherit; background: #fff; color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(20, 80, 140, .16); }
input[readonly], input:disabled, select:disabled, textarea:disabled { background: #f1f4f8; color: #3c4756; }
.ro { padding: 9px 12px; background: #f1f4f8; border: 1.5px solid var(--line); border-radius: 9px; min-height: 41px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.radios { display: flex; gap: 18px; flex-wrap: wrap; padding: 8px 0; }
.radios label, label.check { display: inline-flex; align-items: center; gap: 6px; text-transform: none; font-size: 14px; font-weight: 400; color: var(--ink); letter-spacing: 0; margin: 0; cursor: pointer; }
input[type=radio], input[type=checkbox] { accent-color: var(--brand); }
.total { font-size: 20px; font-weight: 700; }
.mismatch { color: var(--bad); }

table.rows { width: 100%; border-collapse: collapse; }
table.rows th { text-align: left; font-size: 12px; text-transform: uppercase; color: var(--muted); padding: 4px 6px; }
table.rows td { padding: 4px 6px; vertical-align: top; }
table.rows tbody tr { animation: rise .3s var(--ease) both; }

.docno { font-size: 14px; color: var(--muted); }
.docno b { color: var(--ink); font-size: 16px; }

/* ---------- login ---------- */
.login { max-width: 380px; margin: 7vh auto 0; padding: 30px 28px; text-align: center; border-radius: 14px; box-shadow: 0 18px 44px rgba(20, 40, 70, .12); animation: rise .6s var(--ease) both; }
.login .logo { width: 104px; height: 104px; animation: float 4s ease-in-out infinite; }
.login h1 { text-align: center; font-size: 22px; margin: 8px 0 0; }
.login .tag { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.login form { text-align: left; }
.login .f { margin-bottom: 14px; }
.login .btn { width: 100%; padding: 11px 18px; }
.login .hint { text-align: center; margin-top: 12px; }

/* ---------- single-card form (leave application, admin account) ---------- */
.narrow { max-width: 640px; margin: 0 auto; }
.simple { padding: 24px 26px; }
.simple .step { margin-bottom: 20px; animation: rise .45s var(--ease) both; }
.simple .step:nth-of-type(2) { animation-delay: .05s; }
.simple .step:nth-of-type(3) { animation-delay: .1s; }
.simple .step:nth-of-type(n+4) { animation-delay: .15s; }
.simple .step > label { font-size: 15px; font-weight: 600; color: var(--ink); text-transform: none; letter-spacing: 0; margin-bottom: 6px; }
.simple input, .simple select { font-size: 16px; padding: 11px 13px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.choices .choice { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 12px; border: 1.5px solid #c3ccd8; border-radius: 9px; cursor: pointer;
  font-size: 15px; font-weight: 400; color: var(--ink); text-transform: none; letter-spacing: 0; background: #fff;
  transition: border-color .2s, background .2s, transform .15s; }
.choices .choice:hover { border-color: var(--brand); transform: translateY(-2px); }
.choices .choice:has(input:checked) { border-color: var(--brand); background: var(--soft); font-weight: 600; }
.choices .choice input { width: auto; margin: 0; padding: 0; }
.choices.off .choice { opacity: .5; cursor: default; transform: none; }
.mini { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
.person { margin-top: 8px; padding: 10px 12px; background: var(--soft); border-radius: 9px; display: flex; flex-direction: column; gap: 2px; animation: rise .35s var(--ease) both; }
.person .bal { font-size: 13px; color: var(--muted); }
.when { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: start; }
.when select { margin-top: 6px; }
.daysbox { min-width: 104px; text-align: center; background: var(--soft); border-radius: 10px; padding: 8px 12px; align-self: stretch; }
.daysbox b { display: inline-block; font-size: 30px; line-height: 1.5; color: var(--brand); }
.daysbox b.pop { animation: pop .35s ease; }
.opts { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 10px; }
.splitbox { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 10px; padding: 12px; border: 1.5px dashed var(--line); border-radius: 9px; animation: rise .35s var(--ease) both; }
.splitbox .hint { grid-column: 1 / -1; margin: 0; }
.approver { margin: 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); }
.approver b { color: var(--ink); }
[hidden] { display: none !important; }
@media (max-width: 560px) { .when { grid-template-columns: 1fr; } .splitbox { grid-template-columns: 1fr; } }

/* ---------- travel order form, laid out like the old program's window ---------- */
.toform { max-width: 860px; margin: 0 auto; }
.tohead { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
h2.memo { font-size: 17px; letter-spacing: .02em; margin: 0 0 8px; }
table.memo td { vertical-align: middle; }
table.memo input { padding: 6px 8px; }
.lrow { display: grid; grid-template-columns: 240px 1fr; gap: 12px; align-items: center; margin-bottom: 10px; }
.lrow > label { margin: 0; text-align: right; text-transform: none; font-size: 14px; font-weight: 600; color: var(--ink); letter-spacing: 0; }
.lrow > label small { font-weight: 400; color: var(--muted); font-style: italic; }
.duration { display: flex; align-items: center; gap: 10px; }
.duration input { max-width: 190px; }
@media (max-width: 640px) { .lrow { grid-template-columns: 1fr; gap: 4px; } .lrow > label { text-align: left; } .tohead { grid-template-columns: 1fr; } }

.pw { position: relative; display: block; }
.pw input { padding-right: 68px; }
.pwtoggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--brand); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px 8px; border-radius: 6px; transition: background .2s; }
.pwtoggle:hover { background: var(--soft); }

/* ---------- print preview pop-up ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(15, 25, 40, .6); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadein .2s ease both; }
.modalbox { background: #fff; border-radius: 12px; width: min(1320px, 100%); height: 100%; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 10px 40px rgba(0, 0, 0, .45); animation: rise .35s var(--ease) both; }
.modalhead { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.modalhead small { color: var(--muted); flex: 1; min-width: 200px; }
.modalbtns { display: flex; gap: 8px; }
.modalbox iframe { flex: 1; width: 100%; border: 0; background: #7a8794; }

.sign { display: none; }

@media (max-width: 760px) {
  .topbar { position: static; padding: 8px 12px; gap: 10px; }
  .topbar nav a { padding: 8px 10px; }
}

/* People who switched animations off in Windows get none here either. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .no-print, .actions, .hint { display: none !important; }
  body { background: #fff; font-size: 13px; }
  main { max-width: none; padding: 0; }
  .card { border: 0; padding: 0 0 10px; box-shadow: none; }
  input, select, textarea, .ro { border: 0 !important; border-bottom: 1px solid #999 !important; border-radius: 0 !important; background: #fff !important; padding-left: 0 !important; box-shadow: none !important; }
  .sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 50px; }
  .sign div { border-top: 1px solid #000; padding-top: 4px; text-align: center; }
  .sign small { display: block; color: #444; }
}
