:root {
  --top-bg: #29323d;
  --top-fg: #eef2f5;
  --top-muted: #a9b3be;
  --side-bg: #323d4a;
  --side-active: #3d4a5a;
  --line: #d4dadb;
  --row-hover: #e9eff4;
  --muted: #646b6e;
  --accent: #3065b0;
  --topbar-h: 52px;
  /* 21st "Claude Azure" theme: bootstrap picks these up for buttons, links and borders */
  --bs-primary: #3065b0;
  --bs-primary-rgb: 48, 101, 176;
  --bs-link-color: #3065b0;
  --bs-link-color-rgb: 48, 101, 176;
  --bs-link-hover-color: #2d5bb4;
  --bs-body-color: #29323d;
  --bs-border-color: #d4dadb;
  --bs-focus-ring-color: rgba(64, 135, 201, .25);
}

html { font-size: 14px; }
body { background: #fff; color: #29323d; }
.btn-primary {
  --bs-btn-bg: #3065b0; --bs-btn-border-color: #3065b0; --bs-btn-hover-bg: #2d5bb4; --bs-btn-hover-border-color: #2d5bb4;
  --bs-btn-active-bg: #274f9a; --bs-btn-active-border-color: #274f9a; --bs-btn-disabled-bg: #3065b0; --bs-btn-disabled-border-color: #3065b0;
  --bs-btn-focus-shadow-rgb: 64, 135, 201;
}
.btn-outline-primary {
  --bs-btn-color: #3065b0; --bs-btn-border-color: #3065b0; --bs-btn-hover-bg: #3065b0; --bs-btn-hover-border-color: #3065b0;
  --bs-btn-active-bg: #2d5bb4; --bs-btn-active-border-color: #2d5bb4; --bs-btn-disabled-color: #3065b0; --bs-btn-disabled-border-color: #3065b0;
  --bs-btn-focus-shadow-rgb: 64, 135, 201;
}

.ic { width: 18px; height: 18px; flex: none; vertical-align: -3px; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 1020;
  height: var(--topbar-h); display: flex; align-items: center; gap: 1.5rem;
  padding: 0 1rem; background: var(--top-bg); color: var(--top-fg);
}
.brand { display: flex; align-items: center; gap: .5rem; color: #fff; font-weight: 600; text-decoration: none; white-space: nowrap; }
.brand .ic { width: 22px; height: 22px; }
/* Transparent logo that looks raised: a thin light outline keeps the grey tagline readable on the dark bar. */
.brand-logo { display: flex; align-items: center; height: 38px; padding: 0; }
.brand-logo img {
  height: 100%; width: auto; display: block;
  filter: drop-shadow(0 0 .6px #fff) drop-shadow(0 0 .6px #fff) drop-shadow(0 0 .6px #fff) drop-shadow(0 2px 3px rgba(0, 0, 0, .55));
}
.brand > span:last-child { font-size: 1.05rem; }
.topnav { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.topnav a {
  color: var(--top-fg); text-decoration: none; padding: .45rem .7rem; border-radius: 4px; white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.topnav a:hover { background: rgba(255,255,255,.08); }
.topnav a.active { font-weight: 600; border-bottom-color: #fff; border-radius: 0; }
.topnav a.disabled { color: var(--top-muted); cursor: default; pointer-events: none; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.topsearch {
  display: flex; align-items: center; gap: .4rem; background: rgba(255,255,255,.1);
  border-radius: 6px; padding: .3rem .6rem; color: var(--top-muted);
}
.topsearch input { background: transparent; border: 0; outline: 0; color: #fff; width: 220px; }
.topsearch input::placeholder { color: var(--top-muted); }
.topsearch:focus-within { box-shadow: 0 0 0 2px #87a7f5; }
.btn-new { display: flex; align-items: center; padding: .3rem .45rem; }

/* Avatar */
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: .78rem; font-weight: 600; background: #dce3e9; color: #2d5bb4; border: 1px solid #c4ced8; flex: none;
}
.avatar-btn { background: #3d4a5a; color: #fff; border-color: transparent; cursor: pointer; }
.avatar-empty { background: #fff; color: var(--muted); border: 1px solid #d4dadb; cursor: pointer; }
.avatar-empty:hover { color: var(--accent); border-color: var(--accent); }

/* Shell */
.shell { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.sidebar {
  width: 200px; flex: none; background: var(--side-bg); color: var(--top-fg); padding: .75rem .5rem;
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto;
}
.sidebar h2 { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--top-muted); margin: .5rem .6rem; }
.sidebar a {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: 6px;
  color: var(--top-fg); text-decoration: none;
}
.sidebar a:hover { background: rgba(255,255,255,.06); }
.sidebar a.active { background: var(--side-active); font-weight: 600; }
.sidebar .count { margin-left: auto; font-size: .78rem; color: var(--top-muted); }
.content { flex: 1; min-width: 0; }
/* Pages without a sidebar sit inside a comfortable gutter instead of against the window edge. */
.content-pad { padding: 1.1rem clamp(1rem, 3vw, 2.25rem) 2rem; }

/* List toolbar */
.list-toolbar {
  display: flex; align-items: center; gap: .75rem; padding: .7rem 1.25rem; border-bottom: 1px solid var(--line);
  position: sticky; top: var(--topbar-h); background: #fff; z-index: 10;
}
.list-toolbar h1 { font-size: 1.05rem; margin: 0; font-weight: 600; }
.list-toolbar .meta { margin-left: auto; color: var(--muted); font-size: .85rem; }

/* Ticket rows */
.tickets { list-style: none; margin: 0; padding: 0; }
.ticket-row {
  display: flex; align-items: center; gap: 1rem; padding: .8rem 1.25rem; border-bottom: 1px solid var(--line);
}
.group-day, .group-customer { display: flex; align-items: center; gap: .5rem; border-bottom: 1px solid var(--line); }
.group-day { padding: .6rem 1.25rem; background: #3d4a5a; color: #fff; font-weight: 700; font-size: .95rem; }
.group-customer { padding: .45rem 1.25rem .45rem 2rem; background: #e8e9e6; border-left: 4px solid #9a9c99; font-size: .9rem; color: #000; font-weight: 700; }
.group-toggle { all: unset; display: flex; align-items: center; gap: .5rem; width: 100%; cursor: pointer; }
.group-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.group-toggle .chev { width: 1em; }
.group-day, .group-customer { user-select: none; }
.tickets > li[hidden] { display: none !important; }
.group-day .count, .group-customer .count { font-weight: 600; font-size: .75rem; padding: 0 .5rem; border-radius: 999px; }
.group-day .count { background: rgba(255,255,255,.22); color: #fff; }
.group-customer .count { background: #d3d4d0; color: #000; }
.ticket-row:hover { background: var(--row-hover); }
.src {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid #d4dadb; display: flex; align-items: center;
  justify-content: center; color: #16a34a; flex: none; background: #fff;
}
.src.phone { color: #3065b0; }
.src.manual { color: #9333ea; }
.ticket-main { min-width: 0; flex: 1; }
.ticket-subject { font-size: .98rem; color: #29323d; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-subject.unread { font-weight: 600; }
.ticket-meta { font-size: .8rem; color: var(--muted); display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .15rem; }
.ticket-meta .sep::before { content: "·"; }
.ticket-meta .unknown { color: #b45309; }
.ticket-side { display: flex; align-items: center; gap: 1.25rem; flex: none; }
.status-select {
  font-size: .8rem; padding: .2rem 1.6rem .2rem .55rem; border-radius: 4px; border: 1px solid transparent;
  background-color: #eef2f5; width: 13.5rem;
}
.status-select:hover, .status-select:focus { border-color: #d4dadb; }
.status-select.closed { background-color: #ecfdf5; color: #047857; }
.status-select.waiting { background-color: #fffbeb; color: #b45309; }
.msg-count { display: flex; align-items: center; gap: .25rem; color: var(--muted); font-size: .8rem; min-width: 2.5rem; }
.empty { padding: 3rem 1.25rem; text-align: center; color: var(--muted); }
.pager { display: flex; justify-content: center; gap: .5rem; padding: 1rem; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .topsearch input { width: 120px; }
  .status-select { width: 9rem; }
  .msg-count { display: none; }
}

/* Ticket detail: list | properties | conversation, each column scrolls on its own */
.ticket-page {
  display: grid; grid-template-columns: 270px 270px minmax(0, 1fr);
  height: calc(100vh - var(--topbar-h)); background: #eef2f5;
}
.ticket-page > * { overflow-y: auto; min-height: 0; }
.tp-list { background: #fff; border-right: 1px solid var(--line); }
.tp-list-head { padding: .7rem 1rem; border-bottom: 1px solid var(--line); font-weight: 600; position: sticky; top: 0; background: #fff; }
.tp-list ul { list-style: none; margin: 0; padding: 0; }
.tp-list-head { display: flex; align-items: center; gap: .5rem; z-index: 2; }
.tp-group > summary { display: flex; align-items: center; gap: .4rem; padding: .45rem 1rem; background: #e4ecf7; color: #2d5bb4; border-bottom: 1px solid #d3def0; box-shadow: inset 3px 0 0 var(--accent); font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; cursor: pointer; }
.tp-group > summary[draggable="true"] { cursor: grab; }
.tp-group.dragging { opacity: .5; outline: 2px dashed var(--accent); outline-offset: -2px; }
.tp-group.unlinked > summary { background: #fff4e0; color: #b45309; border-bottom-color: #f5d9a8; box-shadow: inset 3px 0 0 #f59e0b; }
.tp-group > summary > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-count { margin-left: auto; padding: 0 .45rem; border-radius: 9px; background: #fff; color: inherit; font-size: .72rem; }
.tp-list li a { display: block; padding: .65rem 1rem; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.tp-list li a:hover { background: var(--row-hover); }
.tp-list li.current a { background: #eaf0f8; box-shadow: inset 3px 0 0 var(--accent); }
.tp-l-subject { display: block; font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-l-meta { display: block; font-size: .76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tp-props { padding: .75rem; border-right: 1px solid var(--line); }
.card-block { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .85rem 1rem; margin-bottom: .75rem; }
.card-block h2 { font-size: .95rem; font-weight: 600; margin: 0 0 .6rem; }
.prop { margin-bottom: .65rem; }
.prop .form-label { font-size: .76rem; color: var(--muted); margin-bottom: .15rem; }
.props-dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem .75rem; margin: 0; font-size: .85rem; }
.props-dl dt { color: var(--muted); font-weight: normal; }
.props-dl dd { margin: 0; }

.tp-main { background: #fff; }
.tp-head { padding: 1rem 1.5rem 0; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 5; }
.tp-head h1 { font-size: 1.3rem; font-weight: 600; display: flex; align-items: center; gap: .6rem; margin: 0 0 .4rem; }
.tp-head .src { width: 32px; height: 32px; }
.tp-head-meta { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; font-size: .85rem; color: var(--muted); }
.tp-tabs { display: flex; gap: 1.5rem; margin-top: .75rem; }
.tp-tabs a { font-size: .78rem; letter-spacing: .03em; color: var(--muted); text-decoration: none; padding: .5rem 0; border-bottom: 2px solid transparent; }
.tp-tabs a.active { color: #29323d; font-weight: 600; border-bottom-color: var(--accent); }

.thread { padding: 1rem 1.5rem; }
.msg { border: 1px solid var(--line); border-radius: 8px; padding: .9rem 1.1rem; margin-bottom: .9rem; background: #fff; }
.msg-actions { float: right; display: flex; gap: .25rem; margin: -.3rem -.4rem 0 .5rem; }
.msg-actions .btn { --bs-btn-padding-y: .1rem; --bs-btn-padding-x: .45rem; --bs-btn-font-size: .76rem; border-color: var(--line); }
.msg header { display: flex; gap: .75rem; align-items: flex-start; margin-bottom: .6rem; }
.msg-who { min-width: 0; }
.msg-out { border-left: 3px solid var(--accent); }
.msg-note { white-space: pre-wrap; }
.msg.msg-note { background: #fffbeb; border-color: #fde68a; }
.msg-body { width: 100%; border: 0; min-height: 60px; display: block; }
.msg-files { list-style: none; padding: .5rem 0 0; margin: .5rem 0 0; border-top: 1px dashed var(--line); display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; }
.tp-history { padding: 1rem 1.5rem; }
.tp-history li { padding: .45rem 0; border-bottom: 1px solid var(--line); }
.composer { padding: 1rem 1.5rem .25rem; } /* sits above the thread, newest mail first */
.composer[hidden], .compose-bar[hidden] { display: none !important; }
.compose-bar { display: flex; gap: .5rem; padding: 1rem 1.5rem 0; }
.composer .tab-content { border: 1px solid var(--line); border-top: 0; padding: .9rem; border-radius: 0 0 8px 8px; }
.note-input { background: #fffbeb; }
a.ticket-subject { display: block; text-decoration: none; }
a.ticket-subject:hover { color: var(--accent); text-decoration: underline; }

@media (max-width: 1100px) { .ticket-page { grid-template-columns: 240px minmax(0, 1fr); } .tp-list { display: none; } }
@media (max-width: 760px) { .ticket-page { display: block; height: auto; } .tp-props { border: 0; } }

/* list pages: a centred column with side margins; long text wraps instead of widening the page */
.page-narrow { max-width: 1100px; margin: 0 auto; padding: 1rem 1.25rem; }
.page-narrow .table td { white-space: normal; overflow-wrap: break-word; }
.page-narrow .table td.text-nowrap, .page-narrow .table .btn { white-space: nowrap; }
.page-narrow .table input.form-control { min-width: 190px; }

/* Detail-page look shared by Projeler/Edit and the maintenance agreement pages */
.prj { max-width: 1180px; }

.prj-crumb { font-size: .85rem; color: var(--muted); margin-bottom: .35rem; }
.prj-crumb a { color: var(--muted); text-decoration: none; }
.prj-crumb a:hover { color: var(--accent); }

.prj-head { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem 1rem; margin-bottom: 1rem; }
.prj-head h1 { font-size: 1.45rem; font-weight: 600; margin: 0; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.prj-sub { margin: .1rem 0 0; color: var(--muted); }
.prj-actions { margin-left: auto; display: flex; gap: .5rem; }

.prj-pill { font-size: .75rem; font-weight: 600; padding: .2rem .6rem; border-radius: 999px; }
.prj-pill.open { background: #dcfce7; color: #166534; }
.prj-pill.closed { background: #dce3e9; color: #464e53; }

.prj-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.1rem; margin-bottom: 1rem; }
.prj-card h2 {
    font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
    margin: 0 0 .8rem;
}
.prj-card h2 .count { background: var(--line); color: #464e53; border-radius: 999px; padding: 0 .45rem; margin-left: .3rem; }

.fld label { display: block; font-size: .75rem; font-weight: 500; color: var(--muted); margin-bottom: .2rem; }
.fld input[readonly] { background: #f5f8fa; }
.mono { font-variant-numeric: tabular-nums; }

.prj-line { width: 100%; border-collapse: separate; border-spacing: 0; }
.prj-line th {
    font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
    background: #f5f8fa; border-bottom: 1px solid var(--line); padding: .45rem .5rem; white-space: nowrap;
}
.prj-line td { padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.prj-line tbody tr:last-child td { border-bottom: 0; }
.prj-line .num { text-align: right; font-variant-numeric: tabular-nums; }
.prj-line .strong { font-weight: 600; }
.prj-line .muted, .prj-line tr.muted td { color: var(--muted); }
.prj-line .low { color: #92400e; }
.prj-line .over { color: #b91c1c; }

.prj-note { font-size: .8rem; color: var(--muted); margin: .7rem 0 0; }

.prj-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem 1rem; }
.prj-list { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .25rem .6rem .6rem; margin-bottom: 1rem; }
.prj-list .prj-line th:first-child, .prj-list .prj-line td:first-child { padding-left: .6rem; }
.prj-list .prj-line tr.soon td { background: #fffbeb; }
.prj-list .prj-line tr.expired td { color: var(--muted); background: #f5f8fa; }
.prj-filter { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .6rem .1rem .7rem; }
.prj-filter input[type=search], .prj-filter input[type=text] { max-width: 320px; }
.prj-pill.soon { background: #fef3c7; color: #92400e; }
@media (max-width: 992px) { .prj-grid-3 { grid-template-columns: 1fr; } }

/* Firm picker dialog (Projeler/Edit, Admin/AgreementEdit) */
.picker-table { width: 100%; font-size: .9rem; }
.picker-table th { position: sticky; top: 0; background: #f5f8fa; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .4rem .5rem; }
.picker .picker-table td { padding: .4rem .5rem; border-bottom: 1px solid var(--line); cursor: pointer; }
.picker .picker-table td:first-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.picker .picker-table td:last-child { color: var(--muted); font-size: .82rem; }
.picker .picker-table tr:hover td, .picker .picker-table tr:focus td { background: #eef2f8; outline: none; }
.picker .picker-table tr.current td { background: #d3def0; font-weight: 600; }

.prj.prj-form { max-width: 820px; }
.prj.prj-wide-list { max-width: 1000px; }

/* Star rating on the customer's approval page: radios in reverse order so "~" lights the stars up to the chosen one. */
.star-rating { display: inline-flex; flex-direction: row-reverse; font-size: 2.2rem; line-height: 1; }
.star-rating input { position: absolute; opacity: 0; }
.star-rating label { color: #c8cdd3; cursor: pointer; padding: 0 .1em; }
.star-rating label:hover, .star-rating label:hover ~ label, .star-rating input:checked ~ label { color: #f5a623; }
.star-rating input:focus-visible + label { outline: 2px solid #3065b0; border-radius: 4px; }

/* "Ticket'a ayır" popover on a mail's action row. */
.msg-actions details > summary { list-style: none; cursor: pointer; }
.msg-actions details > summary::-webkit-details-marker { display: none; }
.split-pop { position: absolute; right: 0; z-index: 5; width: 260px; }
