/* ============================================================
   KLS Accounting Public / Client Portal Styles
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

.kls-portal-wrap {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	color: #1f2937;
	max-width: 960px;
	margin: 0 auto;
	padding: 24px 16px;
}

/* ----- Header ----- */
.kls-portal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	background: #1a1f36;
	color: #fff;
	border-radius: 12px;
	padding: 20px 24px;
	margin-bottom: 24px;
}

.kls-portal-header-left {
	display: flex;
	align-items: center;
	gap: 20px;
}

.kls-portal-logo {
	display: flex;
	align-items: center;
}

.kls-portal-logo .kls-logo-img {
	max-width: 100%;
	width: 160px;
	height: auto;
	display: block;
}

.kls-portal-client-name h1 {
	font-size: 22px;
	font-weight: 700;
	margin: 0;
	color: #fff;
}

.kls-portal-code {
	font-size: 12px;
	font-weight: 600;
	color: rgba(255,255,255,.6);
	letter-spacing: .5px;
}

.kls-portal-header-right {
	display: flex;
	align-items: center;
	gap: 12px;
}

.kls-portal-logout {
	color: rgba(255,255,255,.7);
	text-decoration: none;
	font-size: 13px;
	padding: 6px 12px;
	border: 1px solid rgba(255,255,255,.3);
	border-radius: 8px;
	transition: background .15s;
}

.kls-portal-logout:hover {
	background: rgba(255,255,255,.1);
}

/* ----- Notification Bell ----- */
.kls-notif-bell-wrap {
	position: relative;
}

.kls-notif-bell-btn {
	background: none;
	border: none;
	cursor: pointer;
	padding: 6px;
	border-radius: 8px;
	color: rgba(255,255,255,.85);
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	transition: background .15s, color .15s;
}

.kls-notif-bell-btn:hover,
.kls-notif-bell-btn:focus-visible {
	background: rgba(255,255,255,.12);
	color: #fff;
	outline: none;
}

.kls-bell-icon {
	width: 22px;
	height: 22px;
	display: block;
}

.kls-notif-badge {
	position: absolute;
	top: 2px;
	right: 2px;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	background: #ef4444;
	color: #fff;
	border-radius: 9px;
	font-size: 11px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
	border: 2px solid #1a1f36;
	box-sizing: border-box;
	pointer-events: none;
}

.kls-notif-dropdown {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	width: 340px;
	max-width: 92vw;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	box-shadow: 0 8px 32px rgba(0,0,0,.16);
	z-index: 9999;
	overflow: hidden;
	animation: klsNotifSlideIn .15s ease-out;
}

@keyframes klsNotifSlideIn {
	from { opacity: 0; transform: translateY(-6px); }
	to   { opacity: 1; transform: translateY(0); }
}

.kls-notif-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px 10px;
	border-bottom: 1px solid #f3f4f6;
}

.kls-notif-title {
	font-size: 14px;
	font-weight: 700;
	color: #1f2937;
}

.kls-notif-read-all-btn {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 12px;
	color: #3b82f6;
	font-weight: 500;
	padding: 0;
	transition: color .1s;
}
.kls-notif-read-all-btn:hover { color: #1d4ed8; }

.kls-notif-list {
	max-height: 380px;
	overflow-y: auto;
	overflow-x: hidden;
}

.kls-notif-loading,
.kls-notif-empty {
	padding: 28px 16px;
	text-align: center;
	font-size: 14px;
	color: #6b7280;
}

.kls-notif-item {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 12px 16px;
	border-bottom: 1px solid #f3f4f6;
	cursor: pointer;
	transition: background .12s;
	text-decoration: none;
	color: inherit;
}
.kls-notif-item:last-child { border-bottom: none; }
.kls-notif-item:hover { background: #f9fafb; }
.kls-notif-item.kls-notif-unread { background: #eff6ff; }
.kls-notif-item.kls-notif-unread:hover { background: #dbeafe; }

.kls-notif-icon {
	flex-shrink: 0;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 16px;
}
.kls-notif-icon-task      { background: #e0f2fe; }
.kls-notif-icon-note      { background: #fef9c3; }
.kls-notif-icon-doc       { background: #dcfce7; }
.kls-notif-icon-fin       { background: #ede9fe; }
.kls-notif-icon-timer     { background: #fee2e2; }
.kls-notif-icon-msg       { background: #fce7f3; }
.kls-notif-icon-default   { background: #f3f4f6; }

.kls-notif-body {
	flex: 1;
	min-width: 0;
}

.kls-notif-item-title {
	font-size: 13px;
	font-weight: 600;
	color: #111827;
	margin: 0 0 2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.kls-notif-item-message {
	font-size: 12px;
	color: #6b7280;
	margin: 0 0 4px;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.kls-notif-item-time {
	font-size: 11px;
	color: #9ca3af;
}

.kls-notif-unread-dot {
	flex-shrink: 0;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #3b82f6;
	margin-top: 4px;
}

.kls-notif-dismiss-btn {
	flex-shrink: 0;
	background: none;
	border: none;
	cursor: pointer;
	color: #9ca3af;
	font-size: 16px;
	line-height: 1;
	padding: 2px 4px;
	border-radius: 4px;
	opacity: 0;
	transition: opacity .15s, color .15s, background .15s;
	margin-left: 4px;
	align-self: flex-start;
}
.kls-notif-item:hover .kls-notif-dismiss-btn,
.kls-notif-item:focus-within .kls-notif-dismiss-btn {
	opacity: 1;
}
.kls-notif-dismiss-btn:hover {
	color: #ef4444;
	background: #fee2e2;
	opacity: 1;
}
.kls-notif-dismiss-btn:focus-visible {
	outline: 2px solid #3b82f6;
	opacity: 1;
}

/* Toast Notification */
.kls-notif-toast {
	position: fixed;
	bottom: 24px;
	right: 24px;
	min-width: 280px;
	max-width: 360px;
	background: #1a1f36;
	color: #fff;
	border-radius: 10px;
	padding: 14px 18px;
	box-shadow: 0 8px 24px rgba(0,0,0,.22);
	z-index: 99999;
	display: flex;
	align-items: flex-start;
	gap: 12px;
	animation: klsToastIn .25s ease-out;
	font-size: 13px;
	line-height: 1.4;
}
@keyframes klsToastIn {
	from { opacity:0; transform: translateY(16px); }
	to   { opacity:1; transform: translateY(0); }
}
.kls-notif-toast-icon { font-size: 20px; flex-shrink:0; margin-top:1px; }
.kls-notif-toast-body { flex:1; min-width:0; }
.kls-notif-toast-title { font-weight:700; margin-bottom:2px; }
.kls-notif-toast-msg   { color:rgba(255,255,255,.75); }
.kls-notif-toast-close {
	background:none; border:none; cursor:pointer; color:rgba(255,255,255,.5);
	font-size:18px; line-height:1; padding:0; flex-shrink:0;
}
.kls-notif-toast-close:hover { color:#fff; }

@media (max-width: 600px) {
	.kls-notif-dropdown {
		width: calc(100vw - 16px);
		right: -8px;
	}
	.kls-notif-toast {
		left: 12px;
		right: 12px;
		min-width: 0;
	}
}


.kls-portal-kpis {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 16px;
	margin-bottom: 24px;
}

.kls-portal-kpi {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	padding: 16px;
	display: flex;
	align-items: center;
	gap: 12px;
	box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.kls-kpi-icon {
	width: 44px;
	height: 44px;
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 20px;
	flex-shrink: 0;
}

.kls-icon-blue   { background: #eff6ff; }
.kls-icon-green  { background: #f0fdf4; }
.kls-icon-yellow { background: #fefce8; }
.kls-icon-orange { background: #fff7ed; }
.kls-icon-purple { background: #faf5ff; }

.kls-kpi-number {
	font-size: 24px;
	font-weight: 700;
	line-height: 1;
}

.kls-kpi-label {
	font-size: 12px;
	color: #6b7280;
	margin-top: 4px;
}

.kls-text-green  { color: #10b981; }
.kls-text-red    { color: #ef4444; }
.kls-text-orange { color: #f59e0b; }

/* ----- Tabs ----- */
.kls-portal-tabs {
	display: flex;
	gap: 4px;
	border-bottom: 2px solid #e5e7eb;
	margin-bottom: 20px;
}

.kls-portal-tab {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 16px;
	font-size: 14px;
	font-weight: 500;
	color: #6b7280;
	text-decoration: none;
	border-bottom: 2px solid transparent;
	margin-bottom: -2px;
	transition: color .15s;
}

.kls-portal-tab.active {
	color: #6366f1;
	border-bottom-color: #6366f1;
}

.kls-portal-tab-count {
	background: #f3f4f6;
	color: #6b7280;
	border-radius: 999px;
	padding: 1px 7px;
	font-size: 11px;
}

/* ----- Content ----- */
.kls-portal-content {
	min-height: 200px;
}

.kls-portal-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
}

.kls-portal-card {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	padding: 20px;
	margin-bottom: 20px;
	box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.kls-portal-card h3 {
	font-size: 15px;
	font-weight: 600;
	color: #1f2937;
	margin: 0 0 16px;
	padding-bottom: 12px;
	border-bottom: 1px solid #f3f4f6;
}

.kls-portal-stat-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 0;
	font-size: 14px;
	border-bottom: 1px solid #f9fafb;
}

.kls-portal-stat-row:last-child {
	border-bottom: none;
}

.kls-portal-stat-total {
	font-weight: 600;
	border-top: 1px solid #e5e7eb;
	margin-top: 4px;
	padding-top: 10px;
}

.kls-balance-due {
	color: #f59e0b;
	font-weight: 700;
}

/* ----- Recurring transactions portal ----- */
.kls-portal-rt-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.kls-portal-rt-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 0;
	border-bottom: 1px solid #f3f4f6;
	font-size: 13px;
}

.kls-portal-rt-item:last-child { border-bottom: none; }

.kls-portal-rt-vendor { flex: 1; font-weight: 500; }
.kls-portal-rt-amount { font-weight: 600; }

/* ----- Tasks portal ----- */
.kls-portal-task-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.kls-portal-task-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	padding: 12px 0;
	border-bottom: 1px solid #f3f4f6;
}

.kls-portal-task-item:last-child { border-bottom: none; }

.kls-portal-task-title {
	font-size: 14px;
	font-weight: 500;
	display: block;
}

.kls-portal-task-title.done {
	text-decoration: line-through;
	color: #9ca3af;
}

.kls-portal-task-due {
	font-size: 12px;
	color: #6b7280;
}

.kls-portal-task-badges {
	display: flex;
	gap: 6px;
	flex-shrink: 0;
}

/* ----- Documents portal ----- */
.kls-portal-doc-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.kls-portal-doc-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 0;
	border-bottom: 1px solid #f3f4f6;
}

.kls-portal-doc-item:last-child { border-bottom: none; }

.kls-portal-doc-icon { font-size: 22px; flex-shrink: 0; }

.kls-portal-doc-info { flex: 1; min-width: 0; }

.kls-portal-doc-name {
	font-size: 14px;
	font-weight: 500;
	color: #1f2937;
	text-decoration: none;
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.kls-portal-doc-name:hover { color: #6366f1; }

.kls-portal-doc-date {
	font-size: 12px;
	color: #9ca3af;
	white-space: nowrap;
}

.kls-doc-tags { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }

.kls-tag {
	background: #e0f2fe;
	color: #0369a1;
	border-radius: 999px;
	padding: 2px 8px;
	font-size: 11px;
	font-weight: 500;
}

/* ----- Badges ----- */
.kls-badge {
	display: inline-flex;
	align-items: center;
	padding: 2px 10px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 500;
}

.badge-success   { background: #d1fae5; color: #065f46; }
.badge-warning   { background: #fef9c3; color: #713f12; }
.badge-secondary { background: #f3f4f6; color: #6b7280; }
.badge-info      { background: #dbeafe; color: #1e40af; }
.badge-danger    { background: #ffedd5; color: #c2410c; }
.badge-urgent    { background: #fee2e2; color: #991b1b; }
.badge-frequency { background: #e0f2fe; color: #0369a1; }

/* ----- Messages ----- */
.kls-portal-messages {
	min-height: 200px;
	max-height: 400px;
	overflow-y: auto;
	padding: 16px;
	background: #f9fafb;
	border-radius: 8px;
	margin-bottom: 12px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.kls-portal-loading {
	color: #9ca3af;
	font-size: 13px;
	text-align: center;
	padding: 20px;
}

.kls-msg-bubble {
	max-width: 70%;
	padding: 10px 14px;
	border-radius: 12px;
	font-size: 14px;
	line-height: 1.5;
}

.kls-msg-mine {
	align-self: flex-end;
	background: #6366f1;
	color: #fff;
	border-bottom-right-radius: 4px;
}

.kls-msg-other {
	align-self: flex-start;
	background: #fff;
	border: 1px solid #e5e7eb;
	border-bottom-left-radius: 4px;
}

.kls-msg-meta {
	font-size: 11px;
	margin-top: 4px;
	opacity: .7;
}

.kls-portal-msg-form {
	display: flex;
	gap: 10px;
}

.kls-portal-textarea {
	flex: 1;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	padding: 8px 12px;
	font-size: 14px;
	resize: none;
	font-family: inherit;
}

.kls-portal-textarea:focus {
	outline: none;
	border-color: #6366f1;
}

/* ----- Buttons ----- */
.kls-portal-btn {
	display: inline-flex;
	align-items: center;
	padding: 8px 16px;
	background: #1a1f36;
	color: #fff;
	border: none;
	border-radius: 8px;
	font-size: 14px;
	font-weight: 500;
	cursor: pointer;
	text-decoration: none;
	transition: opacity .15s;
}

.kls-portal-btn:hover { opacity: .9; }

.kls-portal-btn-sm {
	padding: 4px 10px;
	font-size: 12px;
}

/* ----- Login page ----- */
.kls-portal-login {
	display: flex;
	justify-content: center;
	padding: 60px 16px;
}

.kls-portal-login-card {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 12px;
	padding: 40px;
	max-width: 400px;
	width: 100%;
	text-align: center;
	box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

.kls-portal-login-card h2 {
	font-size: 22px;
	font-weight: 700;
	color: #1f2937;
	margin: 12px 0 8px;
}

.kls-portal-login-card p {
	color: #6b7280;
	margin: 0 0 20px;
	font-size: 14px;
}

/* ----- Notice ----- */
.kls-portal-notice {
	padding: 16px 20px;
	background: #fef3c7;
	border: 1px solid #fde68a;
	border-radius: 8px;
	color: #92400e;
	font-size: 14px;
}

/* ----- Empty ----- */
.kls-portal-empty {
	text-align: center;
	padding: 40px 20px;
	color: #9ca3af;
}

.kls-portal-empty .kls-empty-icon {
	font-size: 48px;
	margin-bottom: 16px;
	line-height: 1;
	display: block;
}

.kls-portal-empty p {
	margin: 0;
	font-size: 14px;
	color: #6b7280;
	line-height: 1.5;
}

.kls-portal-no-data {
	color: #9ca3af;
	font-size: 13px;
	text-align: center;
	padding: 12px 0;
}

/* ----- Client list (staff view) ----- */
.kls-portal-client-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.kls-portal-client-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 0;
	border-bottom: 1px solid #f3f4f6;
}

.kls-portal-client-item:last-child { border-bottom: none; }
.kls-portal-client-name { flex: 1; font-weight: 500; }

.kls-code {
	background: #f3f4f6;
	padding: 2px 6px;
	border-radius: 4px;
	font-size: 11px;
}

/* ----- Responsive ----- */
@media (max-width: 640px) {
	.kls-portal-kpis {
		grid-template-columns: repeat(2, 1fr);
	}
	.kls-portal-grid {
		grid-template-columns: 1fr;
	}
	.kls-portal-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 12px;
	}
	.kls-portal-header-left {
		flex-direction: column;
		align-items: flex-start;
	}
	.kls-portal-tabs {
		overflow-x: auto;
	}
}

/* ============================================================
   Staff Portal Styles
   ============================================================ */

.kls-staff-portal {
max-width: 1200px;
}

.kls-portal-header-right {
display: flex;
align-items: center;
gap: 12px;
}

.kls-user-welcome {
font-size: 14px;
color: rgba(255,255,255,0.8);
}

.kls-btn-small {
padding: 8px 16px !important;
font-size: 13px !important;
}

.kls-btn-outline {
background: transparent !important;
border: 1px solid rgba(255,255,255,0.3) !important;
}

.kls-btn-outline:hover {
background: rgba(255,255,255,0.1) !important;
}

.kls-portal-title {
margin-bottom: 24px;
}

.kls-portal-title h1 {
font-size: 28px;
font-weight: 700;
margin: 0 0 4px;
color: #1f2937;
}

.kls-portal-title p {
font-size: 15px;
color: #6b7280;
margin: 0;
}

/* KPI Cards */
.kls-portal-kpi-row {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 16px;
margin-bottom: 24px;
}

.kls-portal-kpi-card {
background: #fff;
border: 1px solid #e5e7eb;
border-radius: 12px;
padding: 20px;
display: flex;
justify-content: space-between;
align-items: center;
}

.kls-kpi-content {
display: flex;
flex-direction: column;
}

.kls-kpi-label {
font-size: 13px;
color: #6b7280;
margin-bottom: 4px;
}

.kls-kpi-value {
font-size: 28px;
font-weight: 700;
color: #1f2937;
}

.kls-kpi-icon {
width: 48px;
height: 48px;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
font-size: 24px;
}

.kls-kpi-icon-blue   { background: #dbeafe; }
.kls-kpi-icon-yellow { background: #fef3c7; }
.kls-kpi-icon-orange { background: #ffedd5; }
.kls-kpi-icon-green  { background: #d1fae5; }
.kls-kpi-icon-purple { background: #ede9fe; }

/* Card Headers */
.kls-card-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16px;
padding-bottom: 12px;
border-bottom: 1px solid #f3f4f6;
}

.kls-card-header h3 {
margin: 0;
border: 0;
padding: 0;
}

.kls-view-all {
font-size: 13px;
color: #6b7280;
text-decoration: none;
}

.kls-view-all:hover {
color: #6366f1;
}

/* Task List */
.kls-task-list {
list-style: none;
margin: 0;
padding: 0;
}

.kls-task-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 0;
border-bottom: 1px solid #f3f4f6;
}

.kls-task-item:last-child {
border-bottom: 0;
}

.kls-task-title {
font-size: 14px;
color: #1f2937;
}

.kls-task-client {
font-size: 12px;
color: #6b7280;
}

/* Client Avatar */
.kls-client-avatar {
width: 36px;
height: 36px;
border-radius: 50%;
background: #6366f1;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
font-weight: 600;
flex-shrink: 0;
}

.kls-client-info {
flex: 1;
min-width: 0;
}

.kls-client-code {
font-size: 14px;
font-weight: 600;
color: #1f2937;
display: block;
}

.kls-client-name {
font-size: 12px;
color: #6b7280;
display: block;
}

/* Stage Badges */
.kls-stage-badge {
font-size: 11px;
padding: 4px 10px;
border-radius: 12px;
font-weight: 500;
white-space: nowrap;
}

.kls-stage-prospect            { background: #e0e7ff; color: #4338ca; }
.kls-stage-onboarding          { background: #fef3c7; color: #b45309; }
.kls-stage-document_collection { background: #fee2e2; color: #b91c1c; }
.kls-stage-setup               { background: #dbeafe; color: #1d4ed8; }
.kls-stage-monthly_bookkeeping { background: #d1fae5; color: #047857; }
.kls-stage-quarterly_review    { background: #ede9fe; color: #6d28d9; }
.kls-stage-year_end            { background: #fce7f3; color: #be185d; }

/* Workflow Card */
.kls-workflow-card {
margin-top: 24px;
}

.kls-workflow-grid {
display: grid;
grid-template-columns: repeat(6, 1fr);
gap: 16px;
margin-top: 16px;
}

.kls-workflow-item {
text-align: center;
padding: 16px 8px;
background: #f9fafb;
border-radius: 8px;
}

.kls-workflow-count {
font-size: 24px;
font-weight: 700;
color: #1f2937;
display: block;
}

.kls-workflow-label {
font-size: 11px;
color: #6b7280;
display: block;
margin-top: 4px;
}

.kls-workflow-bar {
height: 3px;
border-radius: 2px;
margin-top: 8px;
}

.kls-bar-onboarding          { background: #f59e0b; }
.kls-bar-document_collection { background: #ef4444; }
.kls-bar-setup               { background: #3b82f6; }
.kls-bar-monthly_bookkeeping { background: #10b981; }
.kls-bar-quarterly_review    { background: #8b5cf6; }
.kls-bar-year_end            { background: #ec4899; }

/* Responsive */
@media (max-width: 1024px) {
.kls-portal-kpi-row {
grid-template-columns: repeat(2, 1fr);
}
.kls-workflow-grid {
grid-template-columns: repeat(3, 1fr);
}
}

@media (max-width: 640px) {
.kls-staff-portal {
max-width: 100%;
}
.kls-portal-kpi-row {
grid-template-columns: 1fr;
}
.kls-workflow-grid {
grid-template-columns: repeat(2, 1fr);
}
}

@media (max-width: 768px) {
.kls-logo-img {
width: 140px;
}

.kls-portal-logo .kls-logo-img {
width: 120px;
}
}

@media (max-width: 480px) {
.kls-logo-img {
width: 120px;
}

.kls-portal-logo .kls-logo-img {
width: 100px;
}
}

/* ============================================================
   Timer Widget – Staff Portal
   ============================================================ */

.kls-timer-widget {
border: 2px solid #e5e7eb;
transition: border-color .3s;
margin-top: 24px;
}
.kls-timer-widget.kls-timer-running {
border-color: #22c55e;
}
.kls-timer-widget.kls-timer-paused {
border-color: #eab308;
}
.kls-timer-body {
padding: 24px;
display: flex;
flex-direction: column;
gap: 20px;
}
.kls-timer-display-row {
display: flex;
justify-content: center;
padding: 16px 0;
}
.kls-timer-clock {
font-size: 48px;
font-weight: 700;
color: #1f2937;
letter-spacing: 4px;
font-variant-numeric: tabular-nums;
}
.kls-timer-selectors {
display: flex;
gap: 12px;
flex-wrap: wrap;
}
.kls-portal-select {
flex: 1;
min-width: 180px;
padding: 12px 14px;
border: 1px solid #d1d5db;
border-radius: 8px;
font-size: 14px;
background: #fff;
color: #1f2937;
transition: border-color 0.2s, box-shadow 0.2s;
}
.kls-portal-select:focus {
outline: none;
border-color: #6366f1;
box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.kls-timer-widget .kls-portal-textarea {
width: 100%;
box-sizing: border-box;
padding: 12px 14px;
border: 1px solid #d1d5db;
border-radius: 8px;
font-size: 14px;
resize: vertical;
font-family: inherit;
min-height: 60px;
transition: border-color 0.2s, box-shadow 0.2s;
}
.kls-timer-widget .kls-portal-textarea:focus {
outline: none;
border-color: #6366f1;
box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.kls-timer-actions {
display: flex;
gap: 12px;
flex-wrap: wrap;
padding-top: 8px;
}
.kls-btn-start {
background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
color: #fff;
border: none;
padding: 14px 28px;
font-size: 15px;
font-weight: 600;
border-radius: 10px;
box-shadow: 0 4px 14px rgba(34, 197, 94, 0.35);
transition: all 0.2s ease;
display: inline-flex;
align-items: center;
gap: 8px;
}
.kls-btn-start:hover {
background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
box-shadow: 0 6px 20px rgba(34, 197, 94, 0.45);
transform: translateY(-1px);
}
.kls-btn-start:active {
transform: translateY(0);
box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}
.kls-btn-pause {
background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
color: #fff;
border: none;
padding: 14px 28px;
font-size: 15px;
font-weight: 600;
border-radius: 10px;
box-shadow: 0 4px 14px rgba(234, 179, 8, 0.35);
transition: all 0.2s ease;
display: inline-flex;
align-items: center;
gap: 8px;
}
.kls-btn-pause:hover {
background: linear-gradient(135deg, #ca8a04 0%, #a16207 100%);
box-shadow: 0 6px 20px rgba(234, 179, 8, 0.45);
transform: translateY(-1px);
}
.kls-btn-pause:active {
transform: translateY(0);
box-shadow: 0 2px 8px rgba(234, 179, 8, 0.3);
}
.kls-btn-stop {
background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
color: #fff;
border: none;
padding: 14px 28px;
font-size: 15px;
font-weight: 600;
border-radius: 10px;
box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
transition: all 0.2s ease;
display: inline-flex;
align-items: center;
gap: 8px;
}
.kls-btn-stop:hover {
background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
box-shadow: 0 6px 20px rgba(239, 68, 68, 0.45);
transform: translateY(-1px);
}
.kls-btn-stop:active {
transform: translateY(0);
box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}
.kls-portal-card + .kls-portal-card {
margin-top: 24px;
}

/* ============================================================
   Running Timers List – Staff Portal (multi-timer)
   ============================================================ */

#kls-portal-running-timers-list {
display: flex;
flex-direction: column;
gap: 12px;
padding: 16px;
}

.kls-active-timer-card {
display: flex;
align-items: center;
gap: 16px;
background: #fff;
border: 1px solid #e5e7eb;
border-radius: 12px;
padding: 14px 18px;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
transition: box-shadow 0.2s ease, transform 0.2s ease;
position: relative;
}

.kls-active-timer-card:hover {
box-shadow: 0 4px 16px rgba(99, 102, 241, 0.12);
transform: translateY(-1px);
}

/* Pulse dot */
.kls-at-pulse {
flex-shrink: 0;
width: 10px;
height: 10px;
background: #22c55e;
border-radius: 50%;
animation: kls-pulse 1.5s ease-in-out infinite;
}

@keyframes kls-pulse {
0%, 100% { opacity: 1; transform: scale(1); }
50%       { opacity: 0.5; transform: scale(1.35); }
}

/* Info section (client + task) */
.kls-at-info {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
gap: 2px;
}

.kls-at-client {
font-size: 14px;
font-weight: 600;
color: #6366f1;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.kls-at-task {
font-size: 12px;
color: #6b7280;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

/* Timer clock display */
.kls-at-timer {
flex-shrink: 0;
font-size: 20px;
font-weight: 700;
color: #1f2937;
letter-spacing: 2px;
font-variant-numeric: tabular-nums;
background: #f3f4f6;
border-radius: 8px;
padding: 6px 12px;
min-width: 104px;
text-align: center;
}

/* Actions area */
.kls-at-actions {
flex-shrink: 0;
}

/* Compact stop button inside running timer cards */
.kls-active-timer-card .kls-btn-stop {
background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
color: #fff;
border: none;
padding: 7px 14px;
font-size: 13px;
font-weight: 600;
border-radius: 8px;
box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
transition: all 0.2s ease;
display: inline-flex;
align-items: center;
gap: 5px;
cursor: pointer;
white-space: nowrap;
}

.kls-active-timer-card .kls-btn-stop:hover {
background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
transform: translateY(-1px);
}

.kls-active-timer-card .kls-btn-stop:active {
transform: translateY(0);
box-shadow: 0 1px 4px rgba(239, 68, 68, 0.3);
}

/* Paused timer card state */
.kls-active-timer-card.kls-timer-card-paused {
border-color: #eab308;
background: #fefce8;
}

/* Stop pulse animation when paused */
.kls-at-pulse.kls-at-pulse-paused {
animation: none;
background: #eab308;
opacity: 0.7;
}

/* Dim the frozen timer display */
.kls-at-timer.kls-at-timer-paused {
opacity: 0.65;
}

/* "Paused" badge inside the timer display */
.kls-timer-paused-badge {
display: inline-block;
font-size: 10px;
font-weight: 700;
background: #fef9c3;
color: #854d0e;
border: 1px solid #fde68a;
border-radius: 4px;
padding: 1px 5px;
vertical-align: middle;
margin-left: 4px;
letter-spacing: 0.5px;
text-transform: uppercase;
}

/* Compact pause button inside running timer cards */
.kls-active-timer-card .kls-btn-pause {
background: linear-gradient(135deg, #eab308 0%, #ca8a04 100%);
color: #fff;
border: none;
padding: 7px 14px;
font-size: 13px;
font-weight: 600;
border-radius: 8px;
box-shadow: 0 2px 6px rgba(234, 179, 8, 0.3);
transition: all 0.2s ease;
display: inline-flex;
align-items: center;
gap: 5px;
cursor: pointer;
white-space: nowrap;
}

.kls-active-timer-card .kls-btn-pause:hover {
background: linear-gradient(135deg, #ca8a04 0%, #a16207 100%);
box-shadow: 0 4px 12px rgba(234, 179, 8, 0.4);
transform: translateY(-1px);
}

.kls-active-timer-card .kls-btn-pause:active {
transform: translateY(0);
box-shadow: 0 1px 4px rgba(234, 179, 8, 0.3);
}

/* Responsive: stack vertically on mobile */
@media (max-width: 600px) {
.kls-active-timer-card {
flex-wrap: wrap;
gap: 10px;
}

.kls-at-info {
flex: 1 1 calc(100% - 26px);
}

.kls-at-timer {
flex: 1 0 auto;
font-size: 18px;
}

.kls-at-actions {
width: 100%;
}

.kls-active-timer-card .kls-btn-stop {
width: 100%;
justify-content: center;
}
}

/* My entries table */
.kls-portal-table {
width: 100%;
border-collapse: collapse;
font-size: 13px;
}
.kls-portal-table th,
.kls-portal-table td {
padding: 8px 10px;
text-align: left;
border-bottom: 1px solid #f3f4f6;
}
.kls-portal-table th {
font-weight: 600;
color: #6b7280;
font-size: 11px;
text-transform: uppercase;
}
.kls-portal-empty-text {
color: #9ca3af;
font-size: 13px;
padding: 12px 16px;
}

/* Timer status badges (reused from admin) */
.kls-timer-status {
display: inline-block;
padding: 2px 8px;
border-radius: 12px;
font-size: 11px;
font-weight: 600;
text-transform: capitalize;
}
.kls-timer-status-running  { background: #dcfce7; color: #166534; }
.kls-timer-status-paused   { background: #fef9c3; color: #854d0e; }
.kls-timer-status-stopped  { background: #f3f4f6; color: #6b7280; }

/* Task time display in client portal task rows */
.kls-portal-task-time {
display: inline-flex;
align-items: center;
gap: 3px;
font-size: 11px;
color: #6b7280;
background: #f3f4f6;
padding: 2px 7px;
border-radius: 10px;
}

/* ============================================================
   Portal File Manager Styles
   ============================================================ */

.kls-portal-fm {
border-radius: 12px;
border: 1px solid #e5e7eb;
overflow: hidden;
background: #fff;
margin-top: 8px;
}
.kls-portal-fm-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 14px 18px;
border-bottom: 1px solid #e5e7eb;
gap: 10px;
flex-wrap: wrap;
}
.kls-portal-fm-header h3 { margin: 0; font-size: 16px; font-weight: 600; color: #1a1f36; }
.kls-portal-fm-search {
width: 200px;
padding: 7px 12px 7px 30px;
border: 1px solid #e5e7eb;
border-radius: 8px;
font-size: 13px;
background: #f9fafb;
outline: none;
transition: border .15s;
}
.kls-portal-fm-search:focus { border-color: #6366f1; }
.kls-portal-fm-body { display: flex; min-height: 280px; }
.kls-portal-fm-sidebar {
width: 190px;
min-width: 190px;
border-right: 1px solid #e5e7eb;
padding: 10px 0;
background: #fafafa;
}
.kls-portal-fm-main { flex: 1; overflow-x: auto; }

/* Shared folder tree styles (also used in public) */
.kls-portal-fm .kls-folder-item {
display: flex;
align-items: center;
gap: 6px;
padding: 8px 12px;
cursor: pointer;
font-size: 13px;
color: #374151;
transition: background .12s;
}
.kls-portal-fm .kls-folder-item:hover { background: #f0f0f0; }
.kls-portal-fm .kls-folder-item.active { background: #eef2ff; color: #6366f1; font-weight: 600; }
.kls-portal-fm .kls-folder-root { font-weight: 600; }
.kls-portal-fm .kls-folder-icon { font-size: 15px; }
.kls-portal-fm .kls-folder-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kls-portal-fm .kls-folder-toggle { font-size: 10px; width: 14px; color: #9ca3af; transition: transform .2s; }
.kls-portal-fm .kls-folder-toggle.expanded { transform: rotate(90deg); }
.kls-portal-fm .kls-folder-toggle.kls-no-children { opacity: 0; pointer-events: none; }
.kls-portal-fm .kls-folder-children { padding-left: 0; }

/* Shared fm-table styles */
.kls-portal-fm .kls-fm-table {
width: 100%;
border-collapse: collapse;
font-size: 13px;
}
.kls-portal-fm .kls-fm-table thead th {
padding: 8px 14px;
text-align: left;
font-size: 11px;
font-weight: 600;
color: #9ca3af;
text-transform: uppercase;
letter-spacing: .05em;
border-bottom: 1px solid #f3f4f6;
background: #fafafa;
}
.kls-portal-fm .kls-fm-table td {
padding: 10px 14px;
border-bottom: 1px solid #f3f4f6;
vertical-align: middle;
}
.kls-portal-fm .kls-fm-table tr:hover { background: #f9fafb; }
.kls-portal-fm .kls-fm-name-cell { display: flex; align-items: center; gap: 8px; }
.kls-portal-fm .kls-fm-type-icon { font-size: 16px; flex-shrink: 0; }
.kls-portal-fm .kls-fm-doc-name { color: #1a1f36; text-decoration: none; font-weight: 500; }
.kls-portal-fm .kls-fm-doc-name:hover { color: #6366f1; text-decoration: underline; }
.kls-portal-fm .kls-btn-link {
background: none; border: none; padding: 0;
color: #1a1f36; font-weight: 500; font-size: 13px; cursor: pointer;
}
.kls-portal-fm .kls-btn-link:hover { color: #6366f1; }
.kls-portal-fm .kls-fm-breadcrumb {
display: flex; align-items: center; gap: 4px;
padding: 10px 16px 4px; font-size: 12px; color: #6b7280;
}
.kls-portal-fm .kls-fm-bc-item { cursor: pointer; color: #6366f1; font-weight: 500; }
.kls-portal-fm .kls-fm-bc-item:last-child { color: #374151; cursor: default; }
.kls-portal-fm .kls-fm-bc-sep { color: #9ca3af; }
.kls-portal-fm .kls-fm-count { padding: 2px 16px 6px; font-size: 12px; color: #9ca3af; }
.kls-portal-fm .kls-fm-empty { padding: 32px; text-align: center; color: #9ca3af; }
.kls-portal-fm .kls-fm-empty-icon { font-size: 32px; display: block; margin-bottom: 8px; }
.kls-portal-fm .kls-fm-empty-cell { padding: 24px 14px; color: #9ca3af; text-align: center; }

@media (max-width: 600px) {
.kls-portal-fm-body { flex-direction: column; }
.kls-portal-fm-sidebar { width: 100%; min-width: 0; border-right: none; border-bottom: 1px solid #e5e7eb; }
.kls-portal-fm-search { width: 140px; }
}

/* ============================================================
   Mobile Full-Width & Responsive Enhancements
   ============================================================ */

/* Prevent horizontal overflow on portal containers */
.kls-portal-wrap,
.kls-staff-portal {
	overflow-x: hidden;
}

/* Make both portals full-width on mobile */
@media (max-width: 768px) {
	.kls-portal-wrap {
		max-width: 100%;
		padding: 16px 12px;
	}

	.kls-staff-portal {
		max-width: 100%;
	}

	/* Header adjustments */
	.kls-portal-header {
		flex-direction: column;
		align-items: stretch;
		padding: 16px;
		border-radius: 8px;
		gap: 12px;
	}

	.kls-portal-header-left {
		flex-direction: column;
		align-items: center;
		text-align: center;
		gap: 10px;
	}

	.kls-portal-header-right {
		flex-direction: column;
		width: 100%;
		gap: 8px;
	}

	.kls-portal-header-right .kls-user-welcome {
		text-align: center;
	}

	.kls-portal-header-right .kls-btn-small,
	.kls-portal-header-right .kls-portal-logout {
		width: 100%;
		text-align: center;
		justify-content: center;
	}

	/* Client name styling */
	.kls-portal-client-name {
		text-align: center;
	}

	.kls-portal-client-name h1 {
		font-size: 18px;
	}

	/* Portal title */
	.kls-portal-title h1 {
		font-size: 22px;
	}

	.kls-portal-title p {
		font-size: 14px;
	}

	/* KPI Cards - Single column on mobile */
	.kls-portal-kpis {
		grid-template-columns: 1fr;
		gap: 12px;
	}

	.kls-portal-kpi {
		padding: 14px;
	}

	.kls-portal-kpi-row {
		grid-template-columns: 1fr;
		gap: 12px;
	}

	.kls-portal-kpi-card {
		padding: 16px;
	}

	.kls-kpi-value {
		font-size: 24px;
	}

	/* Cards */
	.kls-portal-card {
		padding: 16px;
	}

	.kls-portal-card h3 {
		font-size: 14px;
	}

	/* Tabs - Horizontal scroll with better touch */
	.kls-portal-tabs {
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		-ms-overflow-style: none;
		flex-wrap: nowrap;
		gap: 0;
		padding-bottom: 2px;
	}

	.kls-portal-tabs::-webkit-scrollbar {
		display: none;
	}

	.kls-portal-tab {
		padding: 10px 12px;
		font-size: 13px;
		white-space: nowrap;
		flex-shrink: 0;
	}

	/* Workflow grid */
	.kls-workflow-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 10px;
	}

	.kls-workflow-item {
		padding: 12px 6px;
	}

	.kls-workflow-count {
		font-size: 20px;
	}

	.kls-workflow-label {
		font-size: 10px;
	}

	/* Timer widget */
	.kls-timer-clock {
		font-size: 36px;
		letter-spacing: 2px;
	}

	.kls-timer-selectors {
		flex-direction: column;
		gap: 10px;
	}

	.kls-portal-select {
		min-width: 100%;
		width: 100%;
	}

	.kls-timer-actions {
		flex-direction: column;
		gap: 10px;
	}

	.kls-timer-actions button {
		width: 100%;
		justify-content: center;
	}

	/* Tables */
	.kls-portal-table {
		display: block;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	.kls-portal-table th,
	.kls-portal-table td {
		padding: 8px 6px;
		font-size: 12px;
	}

	/* File Manager */
	.kls-portal-fm-header {
		flex-direction: column;
		align-items: stretch;
		gap: 10px;
	}

	.kls-portal-fm-search {
		width: 100%;
	}

	/* Task items */
	.kls-portal-task-item {
		flex-direction: column;
		align-items: flex-start;
		gap: 8px;
	}

	.kls-portal-task-badges {
		align-self: flex-start;
	}

	/* Document items */
	.kls-portal-doc-item {
		flex-wrap: wrap;
	}

	.kls-portal-doc-date {
		flex-basis: 100%;
		margin-top: 4px;
	}

	/* Client list items */
	.kls-portal-client-item {
		flex-wrap: wrap;
		gap: 8px;
	}

	.kls-stage-badge {
		font-size: 10px;
		padding: 3px 8px;
	}

	/* Messages */
	.kls-msg-bubble {
		max-width: 85%;
	}

	.kls-portal-msg-form {
		flex-direction: column;
	}

	.kls-portal-msg-form .kls-portal-btn {
		width: 100%;
		justify-content: center;
	}

	/* Login card */
	.kls-portal-login-card {
		padding: 24px 16px;
	}

	/* Card header */
	.kls-card-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 8px;
	}

	/* Grid layout */
	.kls-portal-grid {
		grid-template-columns: 1fr;
		gap: 12px;
	}

	/* Touch-friendly tap targets */
	.kls-portal-btn,
	.kls-btn-small,
	.kls-portal-logout,
	.kls-portal-tab,
	.kls-view-all {
		min-height: 44px;
		display: inline-flex;
		align-items: center;
	}

	.kls-folder-item {
		min-height: 44px;
	}
}

/* Extra small devices (480px and below) */
@media (max-width: 480px) {
	.kls-portal-wrap {
		padding: 12px 8px;
	}

	.kls-portal-header {
		padding: 12px;
		margin-bottom: 16px;
	}

	.kls-portal-client-name h1 {
		font-size: 16px;
	}

	.kls-portal-title h1 {
		font-size: 20px;
	}

	.kls-portal-kpi,
	.kls-portal-kpi-card {
		padding: 12px;
	}

	.kls-kpi-icon {
		width: 40px;
		height: 40px;
		font-size: 18px;
	}

	.kls-kpi-number,
	.kls-kpi-value {
		font-size: 20px;
	}

	.kls-portal-card {
		padding: 12px;
	}

	.kls-workflow-grid {
		gap: 8px;
	}

	.kls-workflow-item {
		padding: 10px 4px;
	}

	.kls-workflow-count {
		font-size: 18px;
	}

	.kls-timer-clock {
		font-size: 28px;
	}

	.kls-btn-start,
	.kls-btn-pause,
	.kls-btn-stop {
		padding: 12px 20px;
		font-size: 14px;
	}

	.kls-portal-tab {
		padding: 8px 10px;
		font-size: 12px;
	}
}

/* ============================================================
   Portal Task Single Page
   ============================================================ */

.kls-portal-task-single {
max-width: 100%;
}

.kls-portal-task-back {
margin-bottom: 16px;
}

.kls-portal-task-back-link {
font-size: 13px;
color: #6366f1;
text-decoration: none;
font-weight: 500;
}

.kls-portal-task-back-link:hover {
text-decoration: underline;
}

/* Header card */
.kls-portal-task-header-card {
margin-bottom: 16px;
}

.kls-portal-task-title-row {
display: flex;
align-items: flex-start;
gap: 12px;
margin-bottom: 12px;
flex-wrap: wrap;
}

.kls-portal-task-title-main {
font-size: 20px;
font-weight: 700;
color: #111827;
margin: 0;
flex: 1;
}

.kls-portal-task-header-badges {
display: flex;
gap: 6px;
flex-shrink: 0;
flex-wrap: wrap;
}

.kls-portal-task-meta-row {
display: flex;
gap: 20px;
flex-wrap: wrap;
margin-bottom: 12px;
}

.kls-portal-task-meta-item {
display: flex;
flex-direction: column;
gap: 2px;
}

.kls-portal-task-meta-label {
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
color: #9ca3af;
letter-spacing: .5px;
display: block;
margin-bottom: 4px;
}

.kls-portal-task-desc {
border-top: 1px solid #f3f4f6;
padding-top: 12px;
margin-top: 4px;
}

.kls-portal-task-desc-body {
font-size: 14px;
color: #374151;
line-height: 1.6;
}

/* Progress bar */
.kls-portal-task-progress-bar-wrap {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 14px;
}

.kls-portal-task-progress-bar {
flex: 1;
height: 8px;
background: #e5e7eb;
border-radius: 4px;
overflow: hidden;
}

.kls-portal-task-progress-fill {
height: 100%;
background: #6366f1;
border-radius: 4px;
transition: width .3s;
}

.kls-portal-task-progress-pct {
font-size: 12px;
font-weight: 600;
color: #6366f1;
white-space: nowrap;
}

/* Subtasks table */
.kls-portal-task-subtasks-card,
.kls-portal-task-files-card,
.kls-portal-task-notes-card,
.kls-portal-task-comments-card,
.kls-portal-task-team-card {
margin-bottom: 16px;
}

/* Team member list */
.kls-portal-task-team-list {
display: flex;
flex-direction: column;
gap: 10px;
}

.kls-portal-task-team-member {
display: flex;
align-items: center;
gap: 10px;
padding: 8px 12px;
background: #f9fafb;
border-radius: 8px;
}

.kls-portal-task-team-name {
flex: 1;
font-size: 14px;
font-weight: 500;
color: #374151;
}

.kls-portal-subtask-title.done {
text-decoration: line-through;
color: #9ca3af;
}

.kls-portal-subtask-toggle {
width: 16px;
height: 16px;
cursor: pointer;
}

.kls-portal-subtask-row.kls-subtask-done td {
opacity: .6;
}

/* Files */
.kls-portal-file-icon {
margin-right: 6px;
}

/* Notes */
.kls-portal-task-notes-list {
display: flex;
flex-direction: column;
gap: 10px;
}

.kls-portal-task-note-item {
background: #f9fafb;
border: 1px solid #e5e7eb;
border-radius: 8px;
padding: 12px;
}

.kls-portal-task-note-header {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 6px;
}

.kls-portal-task-note-author {
font-weight: 600;
font-size: 13px;
color: #374151;
}

.kls-portal-task-note-date {
font-size: 11px;
color: #9ca3af;
margin-left: auto;
}

.kls-portal-task-note-body {
font-size: 13px;
color: #374151;
line-height: 1.5;
}

/* Comments */
.kls-portal-task-comments-feed {
display: flex;
flex-direction: column;
gap: 10px;
margin-bottom: 16px;
max-height: 420px;
overflow-y: auto;
padding-right: 4px;
}

.kls-portal-task-no-comments {
color: #9ca3af;
font-size: 13px;
text-align: center;
padding: 20px 0;
}

.kls-portal-task-comment {
background: #f9fafb;
border: 1px solid #e5e7eb;
border-radius: 8px;
padding: 10px 12px;
}

.kls-portal-task-comment.kls-portal-comment-urgent {
border-color: #ef4444;
background: #fef2f2;
}

.kls-portal-comment-header {
display: flex;
align-items: center;
gap: 6px;
margin-bottom: 6px;
flex-wrap: wrap;
}

.kls-portal-comment-avatar {
width: 26px;
height: 26px;
border-radius: 50%;
background: #6366f1;
color: #fff;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 12px;
font-weight: 700;
flex-shrink: 0;
}

.kls-portal-comment-author {
font-size: 13px;
font-weight: 600;
color: #374151;
}

.kls-portal-comment-time {
font-size: 11px;
color: #9ca3af;
margin-left: auto;
}

.kls-portal-comment-body {
font-size: 13px;
color: #374151;
line-height: 1.5;
}

/* Comment form */
.kls-portal-task-comment-form {
border-top: 1px solid #e5e7eb;
padding-top: 14px;
}

/* Comment form textarea - full width */
.kls-portal-task-comment-form .kls-portal-textarea {
    width: 100%;
    box-sizing: border-box;
}

.kls-portal-task-comment-form-footer {
display: flex;
align-items: center;
gap: 12px;
flex-wrap: wrap;
margin-top: 8px;
}

.kls-portal-comment-flag {
display: flex;
align-items: center;
gap: 5px;
font-size: 12px;
color: #6b7280;
cursor: pointer;
}

.kls-portal-task-comment-error {
color: #ef4444;
font-size: 13px;
margin-top: 8px;
}

/* Clickable task title in list */
.kls-portal-task-title a,
a.kls-portal-task-title {
color: #111827;
text-decoration: none;
}

.kls-portal-task-title a:hover,
a.kls-portal-task-title:hover {
color: #6366f1;
text-decoration: underline;
}

/* Clickable task title in staff portal */
a.kls-task-title {
color: #111827;
text-decoration: none;
font-size: 14px;
font-weight: 500;
}

a.kls-task-title:hover {
color: #6366f1;
}

@media (max-width: 600px) {
.kls-portal-task-title-row {
flex-direction: column;
}

.kls-portal-task-header-badges {
flex-direction: row;
}

.kls-portal-task-meta-row {
gap: 12px;
}

.kls-portal-task-comments-feed {
max-height: 320px;
}
}

/* Portal Upload Modal */
@keyframes kls-modal-fade-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}
@keyframes kls-modal-slide-in {
	from { opacity: 0; transform: translateY(-16px) scale(0.98); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes kls-spin {
	to { transform: rotate(360deg); }
}
.kls-portal-modal {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
	animation: kls-modal-fade-in 0.2s ease-out;
}
.kls-portal-modal-overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	backdrop-filter: blur(2px);
}
.kls-portal-modal-content {
	position: relative;
	background: #fff;
	border-radius: 16px;
	width: 100%;
	max-width: 480px;
	max-height: 90vh;
	overflow-y: auto;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
	animation: kls-modal-slide-in 0.25s ease-out;
}
.kls-portal-modal-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 20px 24px 16px;
	border-bottom: 1px solid #e5e7eb;
}
.kls-portal-modal-header h3 {
	margin: 0;
	font-size: 18px;
	font-weight: 600;
	color: #1f2937;
}
.kls-portal-modal-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	background: transparent;
	border: none;
	border-radius: 8px;
	font-size: 20px;
	cursor: pointer;
	color: #6b7280;
	line-height: 1;
	transition: background 0.15s ease, color 0.15s ease;
}
.kls-portal-modal-close:hover {
	background: #f3f4f6;
	color: #1f2937;
}
.kls-portal-modal-form {
	padding: 20px 24px;
}
.kls-portal-modal-footer {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	padding-top: 16px;
	margin-top: 8px;
	border-top: 1px solid #f3f4f6;
}
/* Upload Zone */
.kls-upload-zone {
	position: relative;
	border: 2px dashed #d1d5db;
	border-radius: 12px;
	padding: 28px 20px;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.2s ease, background 0.2s ease;
	background: #f9fafb;
}
.kls-upload-zone:hover,
.kls-upload-zone.kls-drag-over {
	border-color: #6366f1;
	background: #eef2ff;
}
.kls-upload-zone.kls-has-file {
	border-color: #10b981;
	border-style: solid;
	background: #f0fdf4;
}
.kls-upload-zone input[type="file"] {
	position: absolute;
	inset: 0;
	opacity: 0;
	cursor: pointer;
	width: 100%;
	height: 100%;
}
.kls-upload-zone-icon {
	font-size: 32px;
	line-height: 1;
	margin-bottom: 8px;
}
.kls-upload-zone-text {
	font-size: 14px;
	font-weight: 500;
	color: #374151;
	margin-bottom: 4px;
}
.kls-upload-zone-hint {
	font-size: 12px;
	color: #9ca3af;
}
/* File Preview */
.kls-file-preview {
	display: flex;
	align-items: center;
	gap: 12px;
	background: #f9fafb;
	border: 1px solid #e5e7eb;
	border-radius: 10px;
	padding: 12px 14px;
	margin-top: 10px;
}
.kls-file-preview-icon {
	font-size: 28px;
	line-height: 1;
	flex-shrink: 0;
}
.kls-file-preview-info {
	flex: 1;
	min-width: 0;
}
.kls-file-preview-name {
	font-size: 14px;
	font-weight: 500;
	color: #1f2937;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.kls-file-preview-size {
	font-size: 12px;
	color: #6b7280;
	margin-top: 2px;
}
.kls-file-preview-remove {
	background: transparent;
	border: none;
	cursor: pointer;
	font-size: 18px;
	color: #9ca3af;
	padding: 2px 4px;
	border-radius: 4px;
	transition: color 0.15s ease, background 0.15s ease;
	flex-shrink: 0;
}
.kls-file-preview-remove:hover {
	color: #dc2626;
	background: #fee2e2;
}
/* Form inputs */
.kls-form-group {
	margin-bottom: 20px;
}
.kls-form-group label {
	display: block;
	margin-bottom: 6px;
	font-weight: 500;
	font-size: 14px;
	color: #374151;
}
.kls-portal-modal-form .kls-input {
	display: block;
	width: 100%;
	border-radius: 10px;
	font-size: 14px;
	padding: 9px 12px;
	border: 1px solid #e5e7eb;
	background: #fff;
	font-family: inherit;
	color: #1f2937;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.kls-portal-modal-form .kls-input:focus {
	outline: none;
	border-color: #6366f1;
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.kls-portal-modal-form select.kls-input {
	appearance: none;
	-webkit-appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 12px center;
	padding-right: 32px;
	cursor: pointer;
}
.kls-portal-modal-form textarea.kls-input {
	resize: vertical;
	min-height: 90px;
}
/* Button variants */
.kls-portal-btn-ghost {
	background: transparent;
	color: #6b7280;
	border: 1px solid #e5e7eb;
	padding: 10px 24px;
	font-size: 14px;
}
.kls-portal-btn-ghost:hover {
	background: #f9fafb;
	color: #374151;
	border-color: #d1d5db;
	opacity: 1;
}
.kls-portal-btn-primary {
	background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
	color: #fff;
	border: none;
	padding: 10px 24px;
	font-size: 14px;
	box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
.kls-portal-btn-primary:hover {
	box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
	transform: translateY(-1px);
	opacity: 1;
}
.kls-portal-btn-primary:disabled,
.kls-portal-btn-ghost:disabled {
	opacity: 0.6;
	cursor: not-allowed;
	transform: none;
}
.kls-portal-btn-primary.kls-loading::after {
	content: '';
	display: inline-block;
	width: 14px;
	height: 14px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: #fff;
	border-radius: 50%;
	animation: kls-spin 0.6s linear infinite;
	margin-left: 8px;
	vertical-align: middle;
}
/* Error state */
.kls-portal-error {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	color: #dc2626;
	margin-top: 12px;
	padding: 10px 14px;
	background: #fef2f2;
	border: 1px solid #fecaca;
	border-radius: 8px;
	font-size: 14px;
}
.kls-portal-error::before {
	content: '⚠️';
	font-size: 14px;
	flex-shrink: 0;
	margin-top: 1px;
}
/* Help text */
.kls-help-text {
	display: block;
	color: #6b7280;
	font-size: 12px;
	margin-top: 4px;
}
/* File manager header */
.kls-portal-fm-header-actions {
	display: flex;
	gap: 10px;
	align-items: center;
}

/* ============================================================
   Overview – Year / Quarter Filter Bar
   ============================================================ */

.kls-overview-filters {
background: #fff;
border: 1px solid #e5e7eb;
border-radius: 10px;
padding: 14px 18px;
margin-bottom: 20px;
box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.kls-overview-filters form {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 12px;
}

.kls-filter-group {
display: flex;
align-items: center;
gap: 8px;
}

.kls-filter-label {
font-size: 13px;
font-weight: 500;
color: #6b7280;
white-space: nowrap;
}

.kls-filter-select {
appearance: none;
-webkit-appearance: none;
background: #f9fafb url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E") no-repeat right 10px center;
background-size: 12px 8px;
border: 1px solid #d1d5db;
border-radius: 8px;
padding: 8px 32px 8px 12px;
font-size: 14px;
font-weight: 500;
color: #1f2937;
cursor: pointer;
min-height: 44px;
transition: border-color .15s, box-shadow .15s;
}

.kls-filter-select:focus {
outline: none;
border-color: #6366f1;
box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

/* Quarter pill buttons */
.kls-quarter-pills {
display: flex;
flex-wrap: wrap;
gap: 6px;
}

.kls-quarter-pill {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 44px;
min-height: 36px;
padding: 6px 14px;
border: 1px solid #d1d5db;
border-radius: 999px;
background: #f9fafb;
color: #374151;
font-size: 13px;
font-weight: 500;
cursor: pointer;
transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
white-space: nowrap;
}

.kls-quarter-pill:hover {
background: #eef2ff;
border-color: #6366f1;
color: #6366f1;
}

.kls-quarter-pill.active {
background: #6366f1;
border-color: #6366f1;
color: #fff;
box-shadow: 0 2px 6px rgba(99,102,241,.35);
}

/* ============================================================
   Financial Performance Chart Card
   ============================================================ */

.kls-chart-card {
margin-bottom: 20px;
}

.kls-chart-card h3 {
display: flex;
align-items: center;
gap: 8px;
}

.kls-period-badge {
display: inline-flex;
align-items: center;
background: #eef2ff;
color: #6366f1;
border-radius: 999px;
padding: 2px 10px;
font-size: 12px;
font-weight: 600;
letter-spacing: .3px;
}

.kls-chart-container {
position: relative;
width: 100%;
height: auto;
overflow: visible;
}

.kls-chart-legend {
display: flex;
flex-wrap: wrap;
gap: 12px;
margin-top: 12px;
justify-content: center;
}

.kls-chart-legend-item {
display: inline-flex;
align-items: center;
gap: 6px;
font-size: 12px;
color: #374151;
font-weight: 500;
}

.kls-chart-swatch {
display: inline-block;
width: 12px;
height: 12px;
border-radius: 3px;
flex-shrink: 0;
}

/* ============================================================
   Responsive – Overview Filters & Chart
   ============================================================ */

@media (max-width: 768px) {
.kls-overview-filters form {
flex-direction: column;
align-items: stretch;
gap: 10px;
}

.kls-filter-group {
width: 100%;
}

.kls-filter-select {
flex: 1;
}

.kls-quarter-pills {
width: 100%;
}

.kls-quarter-pill {
flex: 1;
min-width: 0;
}
}

@media (max-width: 480px) {
.kls-chart-legend {
gap: 8px;
}
}

/* -------------------------------------------------------
   Client Request Notification Badge
   ------------------------------------------------------- */
.kls-portal-notification-badge {
display: inline-flex;
align-items: center;
gap: 5px;
background: #ef4444;
color: #fff;
border-radius: 20px;
padding: 4px 12px;
font-size: 13px;
font-weight: 600;
text-decoration: none;
transition: background .15s;
}
.kls-portal-notification-badge:hover {
background: #dc2626;
color: #fff;
}
.kls-badge-count {
background: #fff;
color: #ef4444;
border-radius: 50%;
min-width: 18px;
height: 18px;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 11px;
font-weight: 700;
padding: 0 4px;
}

/* -------------------------------------------------------
   Client Request Cards
   ------------------------------------------------------- */
.kls-request-list {
list-style: none;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
gap: 12px;
}

.kls-request-item {
background: #fff;
border: 1px solid #e5e7eb;
border-radius: 8px;
padding: 16px 18px;
transition: box-shadow .15s, border-color .15s;
cursor: pointer;
}
.kls-request-item:hover {
box-shadow: 0 2px 8px rgba(0,0,0,.08);
border-color: #d1d5db;
}
.kls-request-unread {
border-left: 4px solid #3b82f6;
background: #eff6ff;
}

.kls-request-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 8px;
}
.kls-request-title {
font-weight: 600;
color: #1a3c5e;
font-size: 15px;
}
.kls-request-title-done {
text-decoration: line-through;
color: #9ca3af;
}
.kls-request-badges {
display: flex;
gap: 6px;
flex-shrink: 0;
}
.kls-request-message {
color: #4b5563;
font-size: 14px;
margin: 0 0 10px;
line-height: 1.5;
}
.kls-request-footer {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
margin-top: 8px;
}
.kls-request-due {
font-size: 12px;
color: #6b7280;
}
.kls-request-done {
opacity: .7;
cursor: default;
}
.kls-request-list-completed .kls-request-item {
border-left-color: #10b981;
background: #f0fdf4;
}


/* -------------------------------------------------------
   Tasks Tab: Section hints, attachment icon, file preview
   ------------------------------------------------------- */
.kls-portal-section-hint {
color: #6b7280;
font-size: 13px;
margin: 2px 0 16px 0;
}

.kls-task-attachment-icon {
margin-left: 6px;
font-size: 14px;
}

.kls-portal-task-file-preview {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 12px;
background: #f9fafb;
border: 1px solid #e5e7eb;
border-radius: 6px;
margin-top: 8px;
}

.kls-portal-task-file-preview .kls-file-name {
flex: 1;
font-size: 13px;
color: #374151;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

.kls-portal-task-remove-file {
background: none;
border: none;
color: #9ca3af;
cursor: pointer;
font-size: 18px;
padding: 0 4px;
}

.kls-portal-task-remove-file:hover {
color: #ef4444;
}

.kls-hint {
color: #6b7280;
font-size: 12px;
margin: 2px 0 6px;
}

/* -------------------------------------------------------
   Document Management – Interactive File Handling
   ------------------------------------------------------- */

/* Toast notification */
.kls-portal-toast {
position: fixed;
bottom: 24px;
right: 24px;
padding: 12px 20px;
border-radius: 8px;
font-size: 14px;
font-weight: 500;
color: #fff;
z-index: 99999;
box-shadow: 0 4px 12px rgba(0,0,0,.18);
pointer-events: none;
}
.kls-toast-success { background: #10b981; }
.kls-toast-error   { background: #ef4444; }

/* Drag handle icon */
.kls-drag-handle {
cursor: grab;
color: #9ca3af;
opacity: 0.6;
user-select: none;
transition: opacity .15s;
}
.kls-drag-handle:hover { opacity: 1; color: #6366f1; }

/* -------------------------------------------------------
   Tasks Tab: Count badge colours and Requests Task label
   ------------------------------------------------------- */

/* Client Requests In badge — blue/info */
.kls-portal-tab-count.kls-portal-tab-count-in {
background: #dbeafe;
color: #1d4ed8;
}

/* Client Requests Out badge — orange/warning */
.kls-portal-tab-count.kls-portal-tab-count-out {
background: #ffedd5;
color: #c2410c;
}

/* "Requests Task" pill label inside merged tasks list */
.kls-portal-task-label {
display: inline-block;
padding: 2px 8px;
border-radius: 20px;
font-size: 11px;
font-weight: 600;
line-height: 1.6;
white-space: nowrap;
}
.kls-portal-task-label-request {
background: #ede9fe;
color: #6d28d9;
}

/* Dragging state for doc row */
.kls-fm-dragging { opacity: 0.45; }

/* Drop target hover highlight */
.kls-fm-drop-over {
background: #eef2ff !important;
outline: 2px dashed #6366f1;
outline-offset: -2px;
}

/* Folder sidebar drop highlight */
#kls-portal-fm .kls-folder-item.kls-fm-drop-over {
background: #eef2ff;
color: #6366f1;
}

/* Document actions dropdown */
.kls-portal-doc-actions-wrap {
position: relative;
display: inline-block;
vertical-align: middle;
}
.kls-portal-doc-actions-menu {
position: absolute;
right: 0;
top: calc(100% + 4px);
background: #fff;
border: 1px solid #e5e7eb;
border-radius: 8px;
box-shadow: 0 8px 24px rgba(0,0,0,.10);
min-width: 160px;
z-index: 1000;
padding: 4px 0;
}
.kls-portal-doc-action {
display: block;
width: 100%;
padding: 8px 14px;
background: none;
border: none;
text-align: left;
font-size: 13px;
cursor: pointer;
color: #374151;
transition: background .12s;
}
.kls-portal-doc-action:hover { background: #f9fafb; }
.kls-portal-doc-action-danger { color: #ef4444; }
.kls-portal-doc-action-danger:hover { background: #fef2f2; }
