/* AMG Tickets: colours sampled from the AMG Tech logo */
:root {
  --brand: #1b78a6;
  --brand-dark: #145a7c;
  --brand-soft: #e6f1f7;
  --ink: #1d2733;
  --bg: #f3f6f9;
  --card: #ffffff;
  --muted: #6b7785;
  --border: #dde4eb;
  --ok: #1a7f37;
  --bad: #c62828;
  --warn: #b26a00;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 40, 64, .06), 0 4px 14px rgba(16, 40, 64, .05);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main.wrap { flex: 1; width: 100%; padding-top: 22px; padding-bottom: 36px; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
h2 { font-size: 1.1rem; margin: 0 0 .8rem; }
h3 { font-size: 1rem; margin: .4rem 0 .6rem; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.inline { display: inline; margin: 0; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* Top bar */
.topbar { background: #fff; border-bottom: 1px solid var(--border); box-shadow: 0 1px 0 rgba(0,0,0,.02); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand img { height: 34px; width: auto; }
.brand span { border-inline-start: 2px solid var(--border); padding-inline-start: 10px; color: var(--brand-dark); }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a:not(.btn) { color: var(--ink); padding: 6px 12px; border-radius: 8px; }
.nav a:not(.btn):hover { background: var(--brand-soft); text-decoration: none; }
.nav a.on { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.nav .btn { margin-inline-start: 8px; }
.topbar-end { margin-inline-start: auto; display: flex; align-items: center; gap: 14px; }
.user-chip { background: var(--bg); border: 1px solid var(--border); border-radius: 99px; padding: 2px 12px; font-size: .9em; cursor: pointer; list-style: none; white-space: nowrap; }
.user-chip::-webkit-details-marker { display: none; }
.user-menu { position: relative; }
.user-menu-box { position: absolute; inset-inline-end: 0; top: calc(100% + 8px); background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 8px; min-width: 190px; z-index: 20; }
.user-menu-box a, .user-menu-box .link-btn { display: block; width: 100%; text-align: start; padding: 7px 10px; border-radius: 6px; color: var(--ink); }
.user-menu-box a:hover, .user-menu-box .link-btn:hover { background: var(--brand-soft); text-decoration: none; }
.user-menu-box form { margin: 0; }
[dir=ltr].nowrap, .notif-list [dir=ltr], .mini-meta [dir=ltr] { white-space: nowrap; }
.link-btn { background: none; border: 0; color: var(--brand); cursor: pointer; font: inherit; padding: 0; }
.link-btn:hover { text-decoration: underline; }
.bell { position: relative; font-size: 1.2rem; line-height: 1; }
.bell:hover { text-decoration: none; }
.badge { border-radius: 99px; padding: 0 7px; font-size: .72rem; font-weight: 700; line-height: 1.6; }
.badge-new { background: #ff9f1c; color: #222; }
.badge-bell { position: absolute; top: -8px; inset-inline-end: -10px; background: var(--bad); color: #fff; }
.footer { padding: 18px 16px 26px; text-align: center; }

/* Buttons & forms */
.btn {
  display: inline-block; border: 1px solid var(--border); background: #fff; color: var(--ink);
  border-radius: 8px; padding: 8px 16px; font: inherit; cursor: pointer; text-align: center; white-space: nowrap;
}
.btn:hover { background: #f0f4f8; text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-success { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-success:hover { background: #146c2e; }
.btn-warn { color: var(--warn); border-color: #e8c27a; }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-danger:hover { background: #a31f1f; }
.btn-sm { padding: 4px 12px; font-size: .9em; }
.btn-lg { padding: 11px 26px; font-size: 1.05em; font-weight: 600; }
.btn-block { display: block; width: 100%; margin-top: 8px; }

label { display: block; margin-bottom: 12px; font-weight: 600; font-size: .92em; }
input[type=text], input[type=password], input[type=search], input[type=date], input[type=month],
input[type=email], input[type=number], input[type=url], input:not([type]), select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 9px 11px; font: inherit; font-weight: normal;
  border: 1px solid var(--border); border-radius: 8px; background: #fff; color: var(--ink);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid #cfe4f0; border-color: var(--brand); }
.form-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.error, .errorlist { color: var(--bad); font-size: .88em; margin: -6px 0 10px; list-style: none; padding: 0; }
.file-label { margin: 0; font-weight: normal; }
.file-label input { display: inline; width: auto; border: 0; padding: 0; max-width: 100%; }
input[type=file] { font: inherit; font-size: .9em; color: var(--muted); max-width: 100%; }
input[type=file]::file-selector-button {
  font: inherit; border: 1px solid var(--border); background: #fff; color: var(--ink);
  border-radius: 8px; padding: 6px 12px; margin-inline-end: 10px; cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: var(--brand-soft); border-color: var(--brand); }

/* Cards & layout */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card-accent { border-top: 3px solid var(--brand); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.narrow { max-width: 420px; margin: 40px auto; }
.medium { max-width: 760px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head p { margin: 0; }
.search { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search input, .search select { margin: 0; width: auto; min-width: 150px; }
.search input[type=search] { min-width: 220px; }
.pill { background: var(--brand-soft); color: var(--brand-dark); border-radius: 99px; padding: 4px 12px; font-size: .9em; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: var(--brand-soft); border: 1px solid #bcd8e8; }
.flash-success { background: #e6f4ea; border-color: #b7dfc1; }
.flash-error { background: #fdecea; border-color: #f5c2bd; }

/* Login */
.login-card { text-align: center; }
.login-card form { text-align: start; }
.login-logo { height: 70px; margin: 6px auto 10px; display: block; }
.login-card h1 { font-size: 1.2rem; margin-bottom: 18px; color: var(--brand-dark); }

/* Landing */
.hero { text-align: center; padding: 48px 16px 34px; background: linear-gradient(180deg, #fff, var(--brand-soft)); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); }
.hero-logo { height: 110px; width: auto; margin-bottom: 10px; }
.hero h1 { font-size: 2rem; color: var(--brand-dark); }
.lead { font-size: 1.12rem; color: #3d4b59; max-width: 640px; margin: 0 auto 22px; }
.hero-projects { margin-top: 24px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 20px; }
.step { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.step-n { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; margin-bottom: 8px; }
.step p { margin: 0; color: #4a5866; }

/* Project & platform badges */
.proj { --proj: var(--brand); display: inline-block; padding: 1px 10px; border-radius: 99px; font-size: .8em; font-weight: 600; white-space: nowrap;
  color: var(--proj); background: color-mix(in srgb, var(--proj) 12%, #fff); border: 1px solid color-mix(in srgb, var(--proj) 35%, #fff); }
.proj-lg { font-size: .95em; padding: 4px 16px; }
.plat { display: inline-block; font-size: .78em; color: var(--muted); margin-inline-start: 6px; white-space: nowrap; }
.mini-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 14px; flex-wrap: wrap; }
.tab { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { text-decoration: none; color: var(--ink); }
.tab.active { color: var(--brand); border-color: var(--brand); font-weight: 600; }
.count { background: #e8edf3; color: var(--muted); border-radius: 99px; padding: 0 8px; font-size: .8em; }
.tab.active .count { background: var(--brand-soft); color: var(--brand); }

/* Tables */
.table-wrap { overflow-x: auto; }
.list-card { padding: 0; overflow: hidden; }
table.tickets { width: 100%; border-collapse: collapse; background: var(--card); }
table.tickets th, table.tickets td { padding: 11px 12px; border-bottom: 1px solid var(--border); text-align: start; vertical-align: middle; }
table.tickets th { font-size: .8em; color: var(--muted); font-weight: 600; background: #f8fafc; white-space: nowrap; }
table.tickets tbody tr { cursor: pointer; }
table.tickets tbody tr:hover { background: #f4f9fc; }
table.tickets tbody tr:last-child td { border-bottom: 0; }
table.plain th { background: none; }
.num { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.empty { text-align: center; padding: 40px; background: var(--card); border: 1px dashed var(--border); border-radius: var(--radius); color: var(--muted); }

/* Status & priority */
.status { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .8em; font-weight: 600; white-space: nowrap; }
.status-new { background: #fff1d6; color: #8a5300; }
.status-assigned { background: #e3ecfd; color: #1d4fb8; }
.status-in_progress { background: #e9e3fd; color: #5b33b8; }
.status-done { background: #fde7f3; color: #a3266d; }
.status-resolved { background: #e3f4e8; color: var(--ok); }
.status-cancelled { background: #eceff2; color: #6b7785; text-decoration: line-through; }
.prio { font-size: .75em; padding: 1px 7px; border-radius: 4px; margin-inline-start: 6px; background: #eef1f4; color: var(--muted); }
.prio-high { background: #fff1d6; color: #8a5300; }
.prio-urgent { background: #fdecea; color: var(--bad); font-weight: 700; }
.overdue { color: var(--bad); font-weight: 600; }
.ok { color: var(--ok); font-weight: 600; }

/* Stats (dashboard + report) */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { display: block; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); color: var(--ink); border-top: 3px solid var(--border); }
a.stat:hover { text-decoration: none; border-color: var(--brand); }
.stat .v { font-size: 2rem; font-weight: 700; line-height: 1.2; }
.stat .l { color: var(--muted); font-size: .88em; }
.stat.accent { border-top-color: var(--brand); } .stat.accent .v { color: var(--brand); }
.stat.ok { border-top-color: var(--ok); } .stat.ok .v { color: var(--ok); }
.stat.bad { border-top-color: var(--bad); } .stat.bad .v { color: var(--bad); }
.stat.warn { border-top-color: #e8a33a; } .stat.warn .v { color: var(--warn); }
.bar { background: #eef1f4; border-radius: 4px; height: 10px; }
.bar span { display: block; height: 100%; background: var(--brand); border-radius: 4px; min-width: 2px; }

/* App layout: sidebar + content (logged-in pages) */
body.has-sidebar { flex-direction: row; }
.sidebar {
  position: sticky; top: 0; height: 100vh; width: 260px; flex: 0 0 260px;
  background: #fff; border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px; overflow-y: auto;
}
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { padding: 26px 30px 40px; width: 100%; max-width: 1320px; }
.side-brand { display: flex; align-items: center; gap: 10px; color: var(--brand-dark); font-weight: 700; padding: 0 6px; }
.side-brand:hover { text-decoration: none; }
.side-brand img { height: 34px; width: auto; }
.side-brand span { border-inline-start: 2px solid var(--border); padding-inline-start: 10px; }
.side-new { margin: 18px 0 6px; padding: 10px; font-weight: 600; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-label { font-size: .74rem; font-weight: 700; color: var(--muted); margin: 16px 10px 6px; letter-spacing: .02em; }
.side-link {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px; color: var(--ink); width: 100%; text-align: start;
}
.side-link:hover { background: var(--brand-soft); text-decoration: none; }
.side-link.on { background: var(--brand); color: #fff; font-weight: 600; }
.side-link.on .count { background: rgba(255, 255, 255, .25); color: #fff; }
.count-hot { background: #ff9f1c; color: #222; font-weight: 700; }
.side-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 10px; }
.side-foot form { margin: 0; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; list-style: none; }
.side-user::-webkit-details-marker { display: none; }
.side-user:hover { background: var(--bg); }
.side-user-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.side-foot .user-menu-box { top: auto; bottom: calc(100% + 6px); inset-inline-start: 0; inset-inline-end: auto; width: 100%; }
.nav-toggle, .nav-backdrop, .mobile-bar { display: none; }
.public-main { padding-top: 22px; padding-bottom: 36px; }

.stats-compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stats-compact .stat { padding: 12px 16px; }
.stats-compact .stat .v { font-size: 1.6rem; }
.toolbar { margin-bottom: 14px; }
table.tickets td.col-title { min-width: 220px; }
table.tickets td.col-proj .plat { display: block; margin: 4px 0 0; }
@media (max-width: 1250px) { .col-hide-md { display: none; } }
.toolbar input[type=search] { flex: 1 1 260px; }

/* Ticket type (urgent / problem / improvement) */
.kind { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: .76em; font-weight: 700; white-space: nowrap; vertical-align: 1px; }
.kind-blocking { background: #fdecea; color: var(--bad); border: 1px solid #f5c2bd; }
.kind-issue { background: #fff6e5; color: #8a5300; }
.kind-improvement { background: #e8f6ee; color: var(--ok); }
.kind-picker { border: 0; padding: 0; margin: 0 0 16px; }
.kind-picker legend { font-weight: 600; font-size: .92em; margin-bottom: 8px; padding: 0; }
.kind-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.kind-option {
  display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 12px; cursor: pointer;
  border: 2px solid var(--border); border-radius: 10px; background: #fff; font-weight: normal;
}
.kind-option input { margin: 4px 0 0; accent-color: var(--brand); }
.kind-icon { font-size: 1.4rem; line-height: 1; }
.kind-text b { display: block; font-size: .95em; }
.kind-text small { color: var(--muted); }
.kind-option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.kind-opt-blocking:has(input:checked) { border-color: var(--bad); background: #fdecea; }

/* "Seen by the manager" */
.seen-banner { margin: 10px 0 4px; padding: 8px 12px; border-radius: 8px; background: #fff6e5; color: #8a5300; font-size: .92em; }
.seen-banner.is-seen { background: #e8f6ee; color: var(--ok); }
.seen { display: inline-block; margin-inline-start: 6px; font-size: .75em; color: var(--ok); font-weight: 600; white-space: nowrap; }
.seen-not { color: var(--muted); font-weight: normal; }

/* Instant-notification toasts */
.toasts { position: fixed; bottom: 18px; inset-inline-end: 18px; z-index: 50; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 36px)); }
.toast {
  display: block; background: #fff; color: var(--ink); border-radius: 10px; padding: 12px 16px;
  box-shadow: 0 8px 30px rgba(16, 40, 64, .22); border-inline-start: 4px solid var(--brand);
  animation: toast-in .25s ease; transition: opacity .5s, transform .5s;
}
.toast:hover { text-decoration: none; background: var(--brand-soft); }
.toast b { display: block; margin-bottom: 2px; }
.toast span { font-size: .9em; color: #3d4b59; }
.toast-urgent { border-inline-start-color: var(--bad); background: #fff8f7; }
.toast-out { opacity: 0; transform: translateY(10px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.notify-enable { margin-top: 10px; background: #fff6e5; border: 1px dashed #e8c27a; cursor: pointer; font: inherit; color: #8a5300; }
.notify-enable:hover { background: #ffefcc; }

/* Show/hide password button inside the field */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-inline-end: 44px; }
.pw-toggle {
  position: absolute; inset-inline-end: 6px; top: calc(50% + 2px); transform: translateY(-50%);
  border: 0; background: none; cursor: pointer; font-size: 1.05rem; line-height: 1;
  padding: 6px; border-radius: 6px; opacity: .45; filter: grayscale(1);
}
.pw-toggle:hover, .pw-toggle:focus-visible { opacity: .9; background: var(--brand-soft); }
.pw-toggle.on { opacity: 1; filter: none; }

/* Checkbox lists (e.g. projects a director oversees) */
.check-list > label { margin-bottom: 6px; }
.check-list label div { display: flex; flex-wrap: wrap; gap: 8px; }
.check-list label div div { display: block; }
.check-list label div label {
  display: flex; align-items: center; gap: 6px; margin: 0; padding: 6px 12px; font-weight: normal;
  border: 1px solid var(--border); border-radius: 99px; cursor: pointer; background: #fff;
}
.check-list label div label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.check-list input[type=checkbox] { accent-color: var(--brand); margin: 0; }

/* Forms: checkboxes & help text */
label.check { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
label.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); }
.help { color: var(--muted); font-size: .84em; margin: -6px 0 12px; }
.role-help { background: var(--bg); border-radius: 8px; padding: 10px 12px; margin-top: -4px; line-height: 1.8; }

/* Team & projects */
.person { display: inline-flex; align-items: center; gap: 10px; }
.person-lg { display: flex; margin-bottom: 14px; }
.avatar-sm { width: 28px; height: 28px; font-size: .85em; }
.role { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .8em; font-weight: 600; white-space: nowrap; }
.role-employee { background: #eef1f4; color: #4a5866; }
.role-developer { background: #e9e3fd; color: #5b33b8; }
.role-manager { background: var(--brand-soft); color: var(--brand-dark); }
.role-director { background: #fff1d6; color: #8a5300; }
.row-off { opacity: .55; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.project-card { display: block; color: var(--ink); border-top: 4px solid var(--proj, var(--brand)); margin: 0; }
.project-card:hover { text-decoration: none; border-color: var(--proj); box-shadow: 0 4px 18px rgba(16, 40, 64, .1); }
.project-card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.project-stats { display: flex; gap: 24px; margin-top: 14px; }
.project-stats b { display: block; font-size: 1.5rem; color: var(--proj, var(--brand)); }
.project-stats span { color: var(--muted); font-size: .85em; }
input[type=color] { height: 42px; padding: 4px; cursor: pointer; }

.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.notif-title { font-weight: 700; font-size: 1.02rem; color: var(--ink); }
.notif-event { color: #3d4b59; font-size: .92em; margin-top: 2px; }
.notif-event b { font-weight: 600; }
.empty-pad { padding: 24px; margin: 0; }
.notif-list li { border-bottom: 1px solid var(--border); }
.notif-list li:last-child { border-bottom: 0; }
.notif-list a { display: block; padding: 14px 18px; color: var(--ink); }
.notif-list a:hover { background: #f4f9fc; text-decoration: none; }
.notif-list li.unread a { background: var(--brand-soft); border-inline-start: 3px solid var(--brand); }
.notif-body { color: #3d4b59; margin: 4px 0; font-size: .92em; }

/* Ticket detail: on desktop the side panel spans both rows; on phones it moves
   between the ticket and the activity log so actions are reachable without scrolling. */
.detail-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start;
  grid-template-areas: "main side" "act side"; grid-template-rows: auto 1fr;
}
.d-main { grid-area: main; }
.d-activity { grid-area: act; }
.d-side { grid-area: side; }
.detail-grid > .card { margin-bottom: 0; }
.ticket-head { display: flex; gap: 10px; align-items: baseline; }
.ticket-head .num { font-size: 1.2rem; }
.ticket-head + .mini-meta { margin-bottom: 12px; }
.gallery { display: flex; flex-wrap: wrap; gap: 10px; }
.gallery img { width: 150px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 9px 14px; margin: 0; }
.facts dt { color: var(--muted); font-size: .88em; }
.facts dd { margin: 0; }
aside form { margin-bottom: 10px; }
aside textarea { margin-top: 0; }
.cancel-box { margin-top: 12px; border-top: 1px dashed var(--border); padding-top: 10px; }
.cancel-box summary { cursor: pointer; color: var(--bad); font-size: .9em; }
.cancel-box form { margin-top: 8px; }

.timeline { list-style: none; margin: 0 0 16px; padding: 0; }
.timeline li { padding: 10px 14px; border-inline-start: 3px solid var(--border); margin-bottom: 8px; background: #fafbfc; border-start-end-radius: 8px; border-end-end-radius: 8px; }
.timeline li.comment { background: #fff; border: 1px solid var(--border); border-inline-start: 3px solid #9aa5b1; }
.timeline li.event-assigned { border-inline-start-color: var(--brand); background: #f1f7fb; }
.timeline li.event-resolved { border-inline-start-color: var(--ok); background: #f1f9f3; }
.timeline li.event-done { border-inline-start-color: #a3266d; }
.timeline li.event-reopened { border-inline-start-color: var(--warn); }
.timeline li.event-cancelled { border-inline-start-color: var(--bad); background: #fdf3f2; }
.timeline .body { margin-top: 6px; }
.comment-form textarea { margin-bottom: 8px; }

@media (max-width: 900px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "side" "act"; grid-template-rows: auto; }
  .steps { grid-template-columns: 1fr; }
  /* Sidebar becomes a slide-in menu opened from the ☰ button */
  .mobile-bar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 15;
  }
  .menu-btn { font-size: 1.5rem; cursor: pointer; line-height: 1; padding: 4px 8px; border-radius: 8px; }
  .menu-btn:hover { background: var(--brand-soft); }
  .mobile-bar .side-brand img { height: 30px; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; inset-inline-start: 0; height: auto; z-index: 30;
    transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 30px rgba(0, 0, 0, .15);
  }
  [dir=rtl] .sidebar { transform: translateX(100%); }
  .nav-toggle:checked ~ .sidebar { transform: none; }
  .nav-toggle:checked ~ .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(16, 32, 48, .35); z-index: 25; }
  .content { padding: 16px; }
  .stats-compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Phones: list tables (tickets, users) become stacked cards */
@media (max-width: 700px) {
  table.rtable, table.rtable tbody { display: block; }
  table.rtable thead { display: none; }
  table.rtable tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
    padding: 14px 16px; border-bottom: 1px solid var(--border);
  }
  table.rtable tbody tr:last-child { border-bottom: 0; }
  table.rtable td { display: block; padding: 0; border: 0; }
  table.rtable td.num:first-child { order: 0; }
  table.rtable td.col-title { order: 1; flex: 1 1 60%; min-width: 0; font-weight: 600; white-space: normal; }
  table.rtable td.col-sub { order: 2; flex: 0 0 100%; margin-top: -4px; font-size: .85em; text-align: start; }
  [dir=rtl] table.rtable td.col-sub { text-align: right; }
  table.rtable td.col-proj, table.rtable td.col-status { order: 3; }
  table.rtable td.col-proj .plat { display: inline-block; margin: 0 6px 0 0; }
  table.rtable td.col-meta { order: 4; font-size: .85em; color: var(--muted); }
  table.rtable td.col-meta::before { content: attr(data-label) ": "; }
  .col-bar { display: none; }
  .page-head h1 { font-size: 1.3rem; }
  .card { padding: 16px; }
}

@media (max-width: 640px) {
  .topbar-inner { gap: 10px; padding-top: 8px; padding-bottom: 8px; }
  .topbar-end { margin-inline-start: 0; flex-wrap: wrap; }
  .two-col { grid-template-columns: 1fr; }
  .kind-options { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .v { font-size: 1.6rem; }
  .search input, .search select, .search input[type=search] { min-width: 0; flex: 1 1 140px; }
  .hero h1 { font-size: 1.5rem; }
  .hero-logo { height: 80px; }
}
