/* SKYVISION Customer Care – simple, large, readable */
:root {
  --brand: #0b5cab;
  --brand-2: #e8f1fb;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1c2430;
  --muted: #6b7585;
  --line: #e2e6ec;
  --red: #d93025;
  --orange: #e8710a;
  --green: #188038;
  --blue: #1a73e8;
  --radius: 14px;
  --nav-h: 64px;
  font-size: 17px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Noto Sans Malayalam", "Noto Sans", system-ui, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.45;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { margin: .4em 0; line-height: 1.25; }
h2 { font-size: 1.3rem; } h3 { font-size: 1.1rem; margin-top: 1.2em; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }
.mt { margin-top: .6rem; } .mb { margin-bottom: .8rem; }
.row { display: flex; align-items: center; } .between { justify-content: space-between; }
.gap { gap: .5rem; } .wrap { flex-wrap: wrap; } .end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: .7rem; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: .7rem; }
@media (min-width: 600px) { .grid2 { grid-template-columns: 1fr 1fr; } }

/* top bar & navigation */
#topbar { display: none; }
body.logged-in #topbar {
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 20; background: var(--brand); color: #fff;
  padding: .6rem 1rem; padding-top: calc(.6rem + env(safe-area-inset-top));
}
.brand { font-weight: 700; font-size: 1.1rem; }
#topbar .muted { color: #cfe0f5; }
.bell { position: relative; font-size: 1.4rem; color: #fff; }
.bell .count { position: absolute; top: -6px; right: -10px; background: var(--red); color: #fff;
  border-radius: 10px; font-size: .7rem; padding: 1px 6px; font-weight: 700; }
#topbar .chip { background: rgba(255,255,255,.15); color: #fff; border-color: transparent; }

#shell { display: block; }
#view { padding: 1rem; max-width: 760px; margin: 0 auto; }
#sidenav { display: none; }
#bottomnav { display: none; }
body.logged-in #bottomnav {
  display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  background: #fff; border-top: 1px solid var(--line); height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); overflow-x: auto;
}
#bottomnav a { flex: 1; min-width: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--muted); font-size: .72rem; gap: 2px; }
#bottomnav a .ico { font-size: 1.35rem; }
#bottomnav a.on { color: var(--brand); font-weight: 700; }

/* computer screens for staff: side menu, wide content */
@media (min-width: 1000px) {
  body.logged-in { padding-bottom: 0; }
  body.logged-in #bottomnav { display: none; }
  body.logged-in #shell { display: flex; }
  body.logged-in #sidenav { display: flex; flex-direction: column; width: 230px; flex-shrink: 0; background: #fff;
    border-right: 1px solid var(--line); min-height: calc(100vh - 56px); position: sticky; top: 56px; align-self: flex-start; padding: .5rem 0; }
  #sidenav .who { padding: .8rem 1rem; border-bottom: 1px solid var(--line); margin-bottom: .4rem; }
  #sidenav a { display: flex; gap: .7rem; padding: .7rem 1rem; color: var(--text); }
  #sidenav a.on { background: var(--brand-2); color: var(--brand); font-weight: 700; border-right: 3px solid var(--brand); }
  body.is-staff #view { max-width: 1250px; flex: 1; }
  body.logged-in #view { flex: 1; }
}
.desk { display: none; } .mob { display: block; }
@media (min-width: 1000px) { .desk { display: table; } .mob { display: none; } }
@media (max-width: 480px) { .hide-sm { display: none; } }

/* cards, buttons, inputs */
.card { display: block; background: var(--card); border-radius: var(--radius); padding: .9rem 1rem;
  margin-bottom: .7rem; box-shadow: 0 1px 2px rgba(0,0,0,.06); border: 1px solid var(--line); color: var(--text); }
a.card:active { background: var(--brand-2); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 0; border-radius: 10px;
  background: var(--brand); color: #fff; padding: .7rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer; min-height: 46px; }
.btn.sm { padding: .35rem .7rem; min-height: 36px; font-size: .9rem; }
.btn.big { min-height: 58px; font-size: 1.1rem; width: 100%; }
.btn.full { width: 100%; }
.btn.ghost { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); }
.btn.danger { background: var(--red); } .btn.green { background: var(--green); } .btn.blue { background: var(--blue); }
.btn.wa { background: #25d366; color: #fff; margin: .4rem 0 .6rem; }
.btn:disabled { opacity: .6; }
.btn.rec, .iconbtn.rec { background: var(--red) !important; color: #fff !important; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.filebtn { cursor: pointer; }
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .95rem; }
label.check { flex-direction: row; align-items: center; gap: .6rem; font-weight: 400; }
input, select, textarea { font: inherit; padding: .7rem .8rem; border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; width: 100%; color: var(--text); min-height: 46px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); }
input[type=checkbox] { width: 22px; height: 22px; min-height: 0; }
input.num { width: 80px; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 30px; padding: .45rem .9rem; font: inherit; cursor: pointer; color: var(--text); }
.chip.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* login */
.login { max-width: 420px; margin: 8vh auto 0; text-align: center; display: flex; flex-direction: column; gap: .6rem; align-items: stretch; }
.login .logo { font-size: 3.5rem; }
.login form { text-align: left; }
.login > .chip { align-self: center; }

/* customer home */
.hello { margin-bottom: .6rem; }
.bigbtns { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.bigbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; text-align: center;
  min-height: 110px; border-radius: var(--radius); color: #fff; font-weight: 700; font-size: 1.02rem; padding: .6rem; }
.bigbtn span { font-size: 2rem; }
.bigbtn.red { background: #c5221f; } .bigbtn.blue { background: #1967d2; } .bigbtn.green { background: #137333; } .bigbtn.gray { background: #5f6368; }
.conn dl { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; margin: .5rem 0 0; font-size: .92rem; }
.conn dt { color: var(--muted); } .conn dd { margin: 0; }

/* new ticket */
.catgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; }
.cat { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .8rem .4rem; border-radius: 12px;
  border: 2px solid var(--line); background: #fff; font: inherit; font-size: .92rem; cursor: pointer; min-height: 96px; text-align: center; }
.cat span { font-size: 1.8rem; }
.cat.on { border-color: var(--brand); background: var(--brand-2); font-weight: 700; }
.thumbs { display: flex; flex-wrap: wrap; gap: .5rem; }
.thumb { position: relative; }
.thumb img { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; }
.thumb.audio audio { height: 40px; max-width: 240px; }
.thumb button { position: absolute; top: -6px; right: -6px; border: 0; border-radius: 50%; width: 24px; height: 24px;
  background: var(--red); color: #fff; cursor: pointer; }

/* badges & SLA */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 20px; font-size: .78rem; font-weight: 600;
  background: #eceff3; color: var(--text); white-space: nowrap; }
.st-registered { background: #e8eaed; } .st-assigned { background: #d2e3fc; color: #174ea6; }
.st-on_the_way { background: #fde293; color: #7a4b00; } .st-in_progress { background: #feefc3; color: #7a4b00; }
.st-resolved { background: #ceead6; color: #0d652d; } .st-closed { background: #e6f4ea; color: #137333; }
.st-reopened { background: #fad2cf; color: #a50e0e; }
.pr-low { background: #e8eaed; } .pr-medium { background: #e8f0fe; color: #174ea6; }
.pr-high { background: #fde7c8; color: #9c4400; } .pr-critical { background: #fad2cf; color: #a50e0e; }
.sla-green { border-left: 5px solid var(--green); } .sla-orange { border-left: 5px solid var(--orange); } .sla-red { border-left: 5px solid var(--red); }
.badge.sla-green { background: #e6f4ea; border: 0; } .badge.sla-orange { background: #fef0e0; border: 0; } .badge.sla-red { background: #fce8e6; color: var(--red); border: 0; }
.ticket { padding: .75rem .9rem; }

/* ticket screen */
.back { display: inline-block; margin-bottom: .5rem; font-weight: 600; }
.code { text-align: center; background: #fffbea; border-color: #f6d860; }
.bigcode { font-size: 2.6rem; letter-spacing: .5rem; font-weight: 700; color: var(--brand); }
.bigcode-in { font-size: 1.8rem; letter-spacing: .5rem; text-align: center; }
.stars { display: flex; gap: .3rem; font-size: 2rem; margin: .5rem 0; }
.stars button { background: none; border: 0; font-size: 2rem; cursor: pointer; padding: 0; }
.stars button.dim { filter: grayscale(1); opacity: .35; }
.tabs { display: flex; gap: .3rem; margin: .8rem 0 .5rem; border-bottom: 2px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: none; font: inherit; padding: .6rem .8rem; cursor: pointer; color: var(--muted); white-space: nowrap; }
.tabs button.on { color: var(--brand); font-weight: 700; border-bottom: 3px solid var(--brand); margin-bottom: -2px; }
.timeline { list-style: none; padding: 0 0 0 1rem; border-left: 3px solid var(--line); margin: .5rem 0; }
.timeline li { position: relative; padding: 0 0 1rem .8rem; }
.timeline li::before { content: ""; position: absolute; left: -1.55rem; top: .3rem; width: 14px; height: 14px; border-radius: 50%; background: var(--brand); }

/* chat */
.chat { display: flex; flex-direction: column; gap: .5rem; max-height: 55vh; overflow-y: auto; padding: .5rem;
  background: #eef2f6; border-radius: var(--radius); min-height: 140px; }
.msg { max-width: 82%; background: #fff; border-radius: 14px 14px 14px 4px; padding: .5rem .75rem; align-self: flex-start; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.msg.mine { align-self: flex-end; background: #d9fdd3; border-radius: 14px 14px 4px 14px; }
.msg .who { font-size: .75rem; font-weight: 700; color: var(--brand); }
.msg.role-technician .who { color: #b06000; } .msg.role-customer .who { color: #137333; }
.msg .text { white-space: pre-wrap; word-break: break-word; }
.msg .time { font-size: .7rem; color: var(--muted); text-align: right; }
.msg img { max-width: 220px; max-height: 220px; border-radius: 8px; display: block; }
.msg audio { max-width: 240px; height: 40px; }
.composer { display: flex; gap: .4rem; align-items: center; margin-top: .5rem; position: sticky; bottom: calc(var(--nav-h) + 6px); background: var(--bg); padding: .3rem 0; }
@media (min-width: 1000px) { .composer { bottom: 0; } }
.composer input[name=body] { flex: 1; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  border: 0; background: #fff; font-size: 1.3rem; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.iconbtn.send { background: var(--brand); color: #fff; }

/* dashboard */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; margin-bottom: .7rem; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { display: flex; flex-direction: column; align-items: flex-start; background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: .8rem 1rem; font: inherit; cursor: pointer; border-top: 4px solid var(--brand); text-align: left; }
.stat b { font-size: 1.8rem; } .stat span { color: var(--muted); font-size: .9rem; }
.stat.orange { border-top-color: var(--orange); } .stat.red { border-top-color: var(--red); } .stat.green { border-top-color: var(--green); }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
@media (min-width: 1000px) { .filters { grid-template-columns: 1fr 1fr 1fr 2fr; } }
.tbl { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.tbl th, .tbl td { padding: .55rem .6rem; text-align: left; border-bottom: 1px solid var(--line); font-size: .92rem; vertical-align: top; }
.tbl th { background: #f8f9fb; font-size: .82rem; color: var(--muted); }
.tbl tbody tr[data-go] { cursor: pointer; } .tbl tbody tr[data-go]:hover { background: var(--brand-2); }
.tbl tr.sla-red td:first-child { box-shadow: inset 5px 0 var(--red); } .tbl tr.sla-orange td:first-child { box-shadow: inset 5px 0 var(--orange); }
.tbl tr.sla-green td:first-child { box-shadow: inset 5px 0 var(--green); }
.tbl tr.sla-red, .tbl tr.sla-orange, .tbl tr.sla-green { border-left: 0; }
.tbl input { min-height: 38px; padding: .35rem .5rem; }
.card .tbl { border: 0; }
.card:has(.tbl) { overflow-x: auto; }

.notif.unread { border-left: 5px solid var(--brand); background: #f5f9ff; }
.job .plain { color: var(--text); display: block; }
.empty { text-align: center; color: var(--muted); padding: 1.5rem .5rem; }

/* popups, messages */
.modal-wrap { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: #fff; width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 1.1rem 1.1rem calc(1.1rem + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .modal-wrap { align-items: center; } .modal { border-radius: 18px; } }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px); transform: translate(-50%, 30px); opacity: 0; transition: .3s;
  background: #202124; color: #fff; padding: .7rem 1.1rem; border-radius: 10px; z-index: 60; max-width: 90vw; text-align: center; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast-err { background: var(--red); }
.offline-bar, .update-bar { background: #fbbc04; color: #202124; text-align: center; padding: .4rem; font-weight: 600; font-size: .9rem; }
.update-bar { background: #d2e3fc; display: flex; gap: .6rem; justify-content: center; align-items: center; }
.spin { width: 18px; height: 18px; border: 3px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; display: inline-block; animation: sp 1s linear infinite; }
.btn.ghost .spin { border-color: rgba(11,92,171,.3); border-top-color: var(--brand); }
@keyframes sp { to { transform: rotate(360deg); } }
details summary { cursor: pointer; color: var(--muted); margin: .4rem 0; }
