:root {
	--cp-blue: #1F7BB6;
	--cp-blue-dark: #15618F;
	--cp-blue-light: #D6EAF5;
	--cp-green: #2E9E3F;
	--cp-green-dark: #1F7A2D;
	--cp-ink: #1E2430;
	--cp-muted: #6B7280;
	--cp-bg: #F3F5F7;
	--cp-border: #E3E7EC;
	--cp-danger: #C0392B;
	--cp-warning: #B07A0A;
}

* { box-sizing: border-box; }
body {
	margin: 0;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
	background: var(--cp-bg);
	color: var(--cp-ink);
}
a { text-decoration: none; color: inherit; }

/* ---------- Topbar ---------- */
.cp-topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 24px;
	background: linear-gradient(135deg, var(--cp-blue), var(--cp-green-dark));
	box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.cp-brand { display: flex; align-items: center; gap: 12px; }
.cp-brand img { height: 34px; width: 34px; background: #fff; border-radius: 8px; padding: 4px; }
.cp-brand-title { display: block; color: #fff; font-weight: 800; font-size: 16px; }
.cp-brand-sub { display: block; color: rgba(255,255,255,0.8); font-size: 12px; }

.cp-user-menu { position: relative; }
.cp-user-trigger {
	display: flex; align-items: center; gap: 8px;
	background: rgba(255,255,255,0.15); border: none; border-radius: 20px;
	padding: 6px 14px 6px 6px; cursor: pointer; color: #fff;
}
.cp-avatar {
	width: 28px; height: 28px; border-radius: 50%;
	background: #fff; color: var(--cp-blue-dark);
	display: flex; align-items: center; justify-content: center;
	font-weight: 800; font-size: 13px;
}
.cp-user-name { font-weight: 600; font-size: 13.5px; }
.cp-user-dropdown {
	display: none; position: absolute; right: 0; top: 44px;
	background: #fff; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.18);
	min-width: 160px; overflow: hidden; z-index: 20;
}
.cp-user-dropdown.open { display: block; }
.cp-user-dropdown a { display: flex; align-items: center; gap: 8px; padding: 12px 16px; font-size: 13.5px; }
.cp-user-dropdown a:hover { background: var(--cp-bg); }

/* ---------- Main / Footer ---------- */
.cp-main { max-width: 900px; margin: 0 auto; padding: 24px 16px 60px; }
.cp-footer { text-align: center; padding: 20px; color: var(--cp-muted); font-size: 12.5px; }

.cp-page-title { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.cp-page-title h2 { margin: 0; font-size: 20px; font-weight: 800; }
.cp-back {
	width: 34px; height: 34px; border-radius: 50%; background: #fff;
	border: 1px solid var(--cp-border); display: flex; align-items: center; justify-content: center;
}

/* ---------- Alerts ---------- */
.cp-alert {
	padding: 12px 16px; border-radius: 10px; margin-bottom: 16px;
	display: flex; align-items: center; gap: 8px; font-size: 13.5px;
}
.cp-alert-success { background: #DCF3E0; color: var(--cp-green-dark); }
.cp-alert-error { background: #FBE4E1; color: var(--cp-danger); }

/* ---------- Filter tabs ---------- */
.cp-filter-tabs {
	display: flex; gap: 6px; overflow-x: auto; margin-bottom: 18px;
	padding-bottom: 4px;
}
.cp-filter-tabs a {
	flex-shrink: 0; padding: 8px 16px; border-radius: 20px;
	font-size: 13.5px; font-weight: 600; color: var(--cp-blue-dark);
	background: var(--cp-blue-light);
}
.cp-filter-tabs a.active {
	background: linear-gradient(135deg, var(--cp-blue), var(--cp-green-dark));
	color: #fff;
}

/* ---------- Ticket grid/cards ---------- */
.cp-ticket-grid { display: grid; gap: 10px; }
.cp-ticket-card {
	background: #fff; border: 1px solid var(--cp-border); border-radius: 12px;
	padding: 14px 16px; display: block;
}
.cp-ticket-card:hover { border-color: var(--cp-blue); }
.cp-ticket-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cp-ticket-card-title { font-weight: 700; font-size: 14.5px; margin-bottom: 4px; }
.cp-ticket-card-date { color: var(--cp-muted); font-size: 12px; }

.cp-empty {
	text-align: center; padding: 60px 20px; color: var(--cp-muted);
}
.cp-empty i { font-size: 40px; margin-bottom: 10px; display: block; }

/* ---------- Badges ---------- */
.cp-badge {
	display: inline-flex; align-items: center; padding: 4px 10px;
	border-radius: 20px; font-size: 12px; font-weight: 700;
}
.badge-warning { background: #FCEFD1; color: var(--cp-warning); }
.badge-info, .badge-primary { background: var(--cp-blue-light); color: var(--cp-blue-dark); }
.badge-success { background: #DCF3E0; color: var(--cp-green-dark); }
.badge-secondary { background: #E9EAEC; color: var(--cp-muted); }
.cp-badge-white { background: rgba(255,255,255,0.9) !important; }

.cp-duration {
	display: inline-flex; align-items: center; gap: 4px;
	padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 700;
	background: var(--cp-blue-light); color: var(--cp-blue-dark);
}
.cp-duration.over { background: #FBE4E1; color: var(--cp-danger); }

/* ---------- Ticket detail header ---------- */
.cp-detail-header {
	border-radius: 14px; padding: 18px;
	background: linear-gradient(135deg, var(--cp-blue), var(--cp-green-dark));
	box-shadow: 0 6px 18px rgba(31,123,182,0.25);
	margin-bottom: 14px;
}
.cp-detail-title { color: #fff; font-weight: 800; font-size: 17px; margin-bottom: 10px; }
.cp-detail-badges { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Actions ---------- */
.cp-actions { display: flex; gap: 10px; margin-bottom: 18px; }
.cp-btn {
	border: none; border-radius: 10px; padding: 10px 18px;
	font-size: 13.5px; font-weight: 700; cursor: pointer;
	display: inline-flex; align-items: center; gap: 8px;
}
.cp-btn-success { background: var(--cp-green); color: #fff; }
.cp-btn-danger { background: var(--cp-danger); color: #fff; }
.cp-btn-primary { background: var(--cp-blue); color: #fff; }
.cp-btn-block { width: 100%; justify-content: center; padding: 13px; }

/* ---------- Thread ---------- */
.cp-thread { display: flex; flex-direction: column; gap: 10px; }
.cp-message {
	display: flex; gap: 10px; background: #fff; border: 1px solid var(--cp-border);
	border-radius: 12px; padding: 12px;
}
.cp-message-reply { margin-left: 24px; background: rgba(214,234,245,0.35); border-color: rgba(31,123,182,0.3); }
.cp-message-avatar {
	width: 26px; height: 26px; border-radius: 50%; background: var(--cp-blue-light);
	color: var(--cp-blue-dark); font-weight: 700; font-size: 11px;
	display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.cp-message-body { flex: 1; min-width: 0; }
.cp-message-head { display: flex; justify-content: space-between; margin-bottom: 6px; gap: 8px; }
.cp-message-name { font-weight: 700; font-size: 12.5px; }
.cp-message-time { color: var(--cp-muted); font-size: 11px; flex-shrink: 0; }
.cp-message-text { font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.cp-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cp-attachment-img img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; }
.cp-attachment-file {
	display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px;
	background: var(--cp-bg); border: 1px solid var(--cp-border); border-radius: 8px; font-size: 12.5px;
}

/* ---------- Login page ---------- */
.cp-login-body {
	min-height: 100vh; display: flex; align-items: center; justify-content: center;
	background: linear-gradient(135deg, var(--cp-blue), var(--cp-green-dark));
	padding: 20px;
}
.cp-login-card {
	background: #fff; border-radius: 18px; padding: 32px 28px; width: 100%; max-width: 380px;
	box-shadow: 0 15px 40px rgba(0,0,0,0.25); text-align: center;
}
.cp-login-logo { height: 52px; width: 52px; margin-bottom: 10px; }
.cp-login-card h1 { font-size: 20px; font-weight: 800; margin: 0 0 4px; }
.cp-login-sub { color: var(--cp-muted); font-size: 13px; margin: 0 0 22px; }
.cp-field { text-align: left; margin-bottom: 14px; }
.cp-field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--cp-muted); }
.cp-input {
	display: flex; align-items: center; gap: 10px;
	border: 1px solid var(--cp-border); border-radius: 10px; padding: 11px 14px;
}
.cp-input i { color: var(--cp-muted); width: 16px; }
.cp-input input { border: none; outline: none; flex: 1; font-size: 14px; font-family: inherit; }
.cp-login-card form { margin-top: 4px; }

@media (max-width: 480px) {
	.cp-topbar { padding: 10px 14px; }
	.cp-brand-sub { display: none; }
}

/* ---------- Nav (added for New Ticket / Tickets links) ---------- */
.cp-nav { display: flex; gap: 4px; }
.cp-nav a {
	display: flex; align-items: center; gap: 6px;
	color: rgba(255,255,255,0.85); font-size: 13.5px; font-weight: 600;
	padding: 8px 14px; border-radius: 20px;
}
.cp-nav a.active, .cp-nav a:hover { background: rgba(255,255,255,0.18); color: #fff; }
@media (max-width: 700px) {
	.cp-nav a span { display: none; }
	.cp-topbar { flex-wrap: wrap; gap: 10px; }
}

/* ---------- Form card (New Ticket / Reply) ---------- */
.cp-form-card {
	background: #fff; border: 1px solid var(--cp-border); border-radius: 14px;
	padding: 20px;
}
.cp-reply-card { margin-top: 18px; }
.cp-reply-card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 700; }
.cp-form-card textarea {
	width: 100%; border: 1px solid var(--cp-border); border-radius: 10px;
	padding: 12px 14px; font-size: 14px; font-family: inherit; resize: vertical;
}
.cp-form-card input[type="file"] {
	width: 100%; font-size: 13px; padding: 8px 0;
}
.cp-field-hint { font-size: 11.5px; color: var(--cp-muted); margin-top: 4px; }
