:root{
  --bg: #0b0c10;
  --card: #12131a;
  --muted: rgba(255,255,255,.65);
  --text: rgba(255,255,255,.92);
  --border: rgba(255,255,255,.10);
  --primary: #4aa3ff;
  --danger: #ff4a6a;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 16px;
  --radius-sm: 12px;
  --pad: 14px;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 800px at 10% 0%, rgba(74,163,255,.18), transparent 60%),
              radial-gradient(900px 600px at 90% 10%, rgba(255,74,106,.10), transparent 55%),
              var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

a{ color: inherit; text-decoration: none; }
.muted{ color: var(--muted); }
.small{ font-size: 0.92rem; }

/* Layout */
.topbar{
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(11,12,16,.72);
  border-bottom: 1px solid var(--border);
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 12px 14px;
}
.topbar__title{ font-weight: 650; letter-spacing: .2px; }
.topbar__spacer{ flex:1; }

/* Notifications */
.notif-btn{ position:relative; }
.notif-badge{
  position:absolute;
  top:-4px;
  right:-4px;
  min-width:18px;
  height:18px;
  padding:0 5px;
  border-radius:999px;
  background:#e33b5e;
  color:#fff;
  font-size:11px;
  font-weight:800;
  display:none;
  align-items:center;
  justify-content:center;
  line-height:18px;
}
.notif-panel__actions{ display:flex; justify-content:flex-end; margin-bottom:10px; }
.notif-list{ display:flex; flex-direction:column; gap:10px; }
.notif-item{
  border:1px solid var(--border);
  border-radius:14px;
  padding:10px 12px;
  background:rgba(255,255,255,.03);
}
.notif-item.is-unread{ box-shadow: 0 0 0 1px rgba(74,163,255,.25) inset; }
.notif-item__top{ display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.notif-item__title{ font-weight:800; }
.notif-item__time{ color:rgba(255,255,255,.65); font-size:12px; white-space:nowrap; }
.notif-item__body{ margin-top:6px; color:rgba(255,255,255,.85); font-size:13px; line-height:1.35; }
.notif-item__bottom{ margin-top:10px; display:flex; gap:8px; align-items:center; justify-content:flex-end; }
.btn--tiny{ padding:6px 10px; font-size:12px; border-radius:10px; }

.link{ color: rgba(74,163,255,.95); text-decoration:none; }
.link:hover{ text-decoration:underline; }

.container{
  padding: 14px;
 /*  max-width: 1100px; */
  margin: 0 auto;
}
.container--narrow{
  max-width: 520px;
}

/* Cards */
.card{
  background: rgba(18,19,26,.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.card__header{
  padding: 14px;
  border-bottom: 1px solid var(--border);
  display:flex;
  gap: 12px;
  align-items: start;
  justify-content: space-between;
  flex-wrap: wrap;
}
.card__title{ font-weight: 700; font-size:2rem; }
.card__actions{
  display:flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Inputs / buttons */
.input{
  width: 100%;
 /*  max-width: 260px; */
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.05);
  color: var(--text);
  outline: none;
}
.input:focus{
  border-color: rgba(74,163,255,.55);
  box-shadow: 0 0 0 4px rgba(74,163,255,.15);
}

.btn{
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 650;
  cursor: pointer;
}
.btn--primary{
  border-color: rgba(74,163,255,.40);
  background: rgba(74,163,255,.18);
}
.btn:active{ transform: translateY(1px); }

.icon-btn{
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  border-radius: 14px;
  padding: 8px 10px;
  cursor:pointer;
  min-width: 44px;
  min-height: 40px;
  display:flex;
  align-items:center;
  justify-content:center;
}

.toggle{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  user-select:none;
}
.toggle input{ width: 18px; height: 18px; }

/* Table */
.table-wrap{ overflow:auto; }
.table{
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}
.table th, .table td{
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-align:left;
  vertical-align: middle;
  white-space: nowrap;
}
.table thead th{
  color: rgba(255,255,255,.72);
  font-weight: 650;
  font-size: .95rem;
  background: rgba(255,255,255,.03);
}
.incident-row{ cursor: pointer; }
.incident-row:hover{ background: rgba(255,255,255,.03); }

.status{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: .9rem;
  background: rgba(255,255,255,.04);
}
.status-open{ border-color: rgba(74,163,255,.35); }
.status-in_progress{ border-color: rgba(255,196,74,.35); }
.status-waiting{ border-color: rgba(255,255,255,.20); }
.status-resolved{ border-color: rgba(74,255,170,.25); }

/* Sidebar */
.sidebar{
  position: fixed;
  inset: 0 auto 0 0;
  width: min(84vw, 320px);
  transform: translateX(-105%);
  transition: transform .22s ease;
  background: rgba(18,19,26,.98);
  border-right: 1px solid var(--border);
  z-index: 40;
  box-shadow: var(--shadow);
  display:flex;
  flex-direction: column;
  padding-top: var(--safe-top);
}
.sidebar--open{ transform: translateX(0); }
.sidebar__header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}
.sidebar__title{ font-weight: 800; letter-spacing: .2px; }
.sidebar__nav{ padding: 8px; display:flex; flex-direction: column; gap: 6px; }
.nav-link{
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
}
.nav-link:hover{
  background: rgba(255,255,255,.04);
  border-color: rgba(255,255,255,.08);
}
.nav-link--danger{ color: rgba(255,74,106,.95); }

.backdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 30;
}

/* Dialog content */
.incident-dialog__header{
  display:flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}
.incident-dialog__title{
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: .2px;
}

.grid{
  display:grid;
  gap: 12px;
  grid-template-columns: 1fr;
}
@media (min-width: 860px){
  .grid{ grid-template-columns: 1fr 1fr; }
  .panel--full{ grid-column: 1 / -1; }
}

.panel{
  border: 1px solid var(--border);
  background: rgba(255,255,255,.03);
  border-radius: var(--radius);
  padding: 12px;
}
.panel__title{ font-weight: 750; margin-bottom: 10px; }

.kv__row{
  display:grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(255,255,255,.10);
}
.kv__row:last-child{ border-bottom:none; }
.kv__k{ color: rgba(255,255,255,.68); font-weight: 650; }
.kv__v{ color: rgba(255,255,255,.92); }

.prose{ line-height: 1.45; }

.form{ display:flex; flex-direction: column; gap: 12px; padding: 14px; }
.form-row{ display:flex; flex-direction: column; gap: 6px; }
.note-form{ display:flex; flex-direction: column; gap: 10px; margin-top: 12px; }

/* Toast */
.toast{
  position: fixed;
  left: 50%;
  bottom: calc(14px + var(--safe-bottom));
  transform: translateX(-50%);
  background: rgba(18,19,26,.95);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  z-index: 60;
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
  pointer-events:none;
}
.toast--show{
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

/* jQuery UI light overrides */
.ui-dialog{
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow) !important;
  background: rgba(18,19,26,.98) !important;
  color: var(--text) !important;
}
.ui-dialog .ui-dialog-titlebar{
  background: rgba(255,255,255,.04) !important;
  border: none !important;
  border-bottom: 1px solid var(--border) !important;
  color: var(--text) !important;
}
.ui-dialog .ui-dialog-content{
  background: transparent !important;
  color: var(--text) !important;
}
.ui-widget input, .ui-widget select, .ui-widget textarea{ font-family: inherit; }

@media (max-width: 520px){
  .btn{ width: 100%; }
  .input{ max-width: 100%; }
}

.notes-list{ display:flex; flex-direction:column; gap:10px; }
.note{ border:1px solid var(--border); background: rgba(255,255,255,.03); border-radius: 14px; padding: 10px 12px; }
.note__meta{ margin-bottom: 6px; }
.note__body{ line-height: 1.45; white-space: normal; }


.file-upload{ display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-bottom: 12px; }
.file-upload .input{ max-width: 420px; }
.files-grid{ display:grid; gap:10px; grid-template-columns: 1fr; }
@media (min-width: 720px){ .files-grid{ grid-template-columns: 1fr 1fr; } }

.file-card{
  display:block;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.03);
  border-radius: 14px;
  padding: 10px 12px;
}
.file-card:hover{ background: rgba(255,255,255,.05); }
.file-card__name{ font-weight: 700; white-space: nowrap; overflow:hidden; text-overflow: ellipsis; }
.file-card__meta{ margin-top: 6px; }


.users-list{ display:flex; flex-direction:column; gap:10px; }
.user-chip{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  border:1px solid var(--border); background: rgba(255,255,255,.03);
  border-radius: 14px; padding: 10px 12px;
}
.user-chip__main{ min-width: 0; }
.user-chip__name{ white-space: nowrap; overflow:hidden; text-overflow:ellipsis; max-width: 60vw; }
.user-chip__meta{ white-space: nowrap; overflow:hidden; text-overflow:ellipsis; max-width: 60vw; }
.user-chip__toggle{ flex:0 0 auto; }


.card__header--stack{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.card__header-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.card__filters{
  width:100%;
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
}

.card__filters #filterStatus{
  min-width: 180px;
}

.card__filters #filterTitle{
  flex: 1 1 220px;   /* this makes it grow across the row */
  min-width: 180px;
}

.card__filters .toggle{
  flex: 0 0 auto;
}

/* Mobile: stack neatly */
@media (max-width: 520px){
  .card__filters{
    flex-direction:column;
    align-items:stretch;
  }
  .card__filters .toggle{
    justify-content:space-between;
  }
}


/* ===============================
   Enhanced select styling
   =============================== */

select.input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;

  padding-right: 42px; /* space for arrow */
  background-color: var(--panel);
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 50%,
    calc(100% - 12px) 50%;
  background-size:
    6px 6px,
    6px 6px;
  background-repeat: no-repeat;

  cursor: pointer;
  font-weight: 500;
}

/* Hover */
select.input:hover {
  border-color: var(--accent);
}

/* Focus (match text inputs) */
select.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.card__filters select.input {
  min-height: 42px;
  border-radius: 12px;
}
.card__filters select.input {
  background-color: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.18);
  font-size:1.1rem;
}


/* ===============================
   Topbar logo
   =============================== */

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar__spacer {
  flex: 1 1 auto;
}

.topbar__logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.topbar__logo img {
  height: 28px;        /* tweak as needed */
  max-width: 140px;
  width: auto;
  object-fit: contain;
  margin-right:30px;
}

@media (max-width: 480px) {
  .topbar__logo img {
    height: 22px;
    max-width: 100px;
  }
}

/* Task assignment checklist */
.checklist{
  display:flex;
  flex-direction:column;
  gap:8px;
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--surface-2);
}
.checkline{display:flex; gap:10px; align-items:flex-start;}
.checkline input{margin-top:3px;}

/* Sidebar category styling */
.nav-section-title{
  margin:14px 12px 6px;
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:var(--muted);
}
.nav-link--sub{padding-left:22px; display:flex; justify-content:space-between; align-items:center; gap:10px;}
.badge{
  display:inline-block;
  min-width:24px;
  padding:2px 8px;
  border-radius:999px;
  background:var(--surface-3);
  border:1px solid var(--border);
  font-size:12px;
  text-align:center;
}

/* Task status colours (reuse status pill class but add missing task statuses) */
.status-todo{background:rgba(0,0,0,0.06);}
.status-in_progress{background:rgba(0,0,0,0.06);}
.status-done{background:rgba(0,0,0,0.06);}
.status-cancelled{background:rgba(0,0,0,0.06);}

.pill{
  display:inline-flex;
  align-items:center;
  padding:2px 10px;
  border-radius:999px;
  font-size:12px;
  line-height:18px;
  margin-left:8px;
  white-space:nowrap;
  border:1px solid rgba(0,0,0,0.10);
}

.pill--category{
  background: rgba(52, 168, 83, 0.10); /* soft green */
}
