/* Design tokens and base components ported verbatim from M4L-Home's css/style.css,
   so OneDesk looks like one suite with Home/Invoice/Payroll rather than a bolt-on. */
:root{
	--bg:#f3f3f5;
	--card:#ffffff;
	--text:#1b1b1f;
	--muted:#666666;
	--border:#eeeeee;
	--shadow:0 1px 4px rgba(0,0,0,0.08);
}
:root[data-theme="dark"]{
	--bg:#11172a;
	--card:#1b2338;
	--text:#e3e7f2;
	--muted:#8b93ac;
	--border:#2c3557;
	--shadow:0 6px 20px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
body {
	margin: 0;
	font-family: 'Segoe UI', Arial, sans-serif;
	background: var(--bg);
	color: var(--text);
	min-height: 100vh;
}
a { color: inherit; }

/* Sidebar navigation (matches M4L-Invoice's dark sidebar + green accent,
   rebuilt with OneDesk's own CSS variables/icon set instead of pulling in
   AdminLTE/Bootstrap/Font Awesome as dependencies). */
.app { display: flex; min-height: 100vh; }

.sidebar {
	width: 230px; min-width: 230px; background: #1b2338; color: #c7cbe0;
	display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 20;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand-badge { height: 40px; width: 40px; border-radius: 8px; background: #fff; padding: 4px; object-fit: contain; flex: none; }
.sidebar .brand-text { line-height: 1.15; }
.sidebar .brand-text b { display: block; font-size: 15px; color: #fff; }
.sidebar .brand-text span { font-size: 11px; color: #9aa1bd; }

.nav { flex: 1; overflow-y: auto; padding: 14px 10px; }
.nav-item {
	display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px;
	color: #aeb4cf; font-size: 13.5px; font-weight: 600; margin-bottom: 3px; text-decoration: none;
	transition: background .15s, color .15s;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: #00a65a; color: #fff; }
.sidebar-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: 11.5px; color: #9aa1bd; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
	display: flex; align-items: center; justify-content: space-between;
	background: var(--card); padding: 0.85rem 1.75rem; box-shadow: var(--shadow);
	position: sticky; top: 0; z-index: 10;
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.page-title { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.menu-toggle-btn { display: none; }
/* Pre-login screens (login.php/setup.php) use a standalone .topbar > .brand
   (no sidebar) — kept separate from .sidebar .brand's own layout below. */
.topbar > .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.topbar > .brand img { height: 34px; width: auto; }
.topbar > .brand span { font-weight: 600; font-size: 1.1rem; color: var(--text); }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,20,35,.5); z-index: 15; }
.sidebar-backdrop.show { display: block; }
.icon-btn {
	width: 34px; height: 34px; border-radius: 8px; background: var(--bg); border: none;
	display: flex; align-items: center; justify-content: center; color: var(--text); cursor: pointer; text-decoration: none;
}
.icon-btn svg { width: 17px; height: 17px; }

@media (max-width: 900px) {
	.sidebar { position: fixed; left: -230px; top: 0; bottom: 0; height: 100vh; transition: left .2s; }
	.sidebar.open { left: 0; }
	.menu-toggle-btn { display: flex; }
}

.content { max-width: 1100px; margin: 0 auto; padding: 2.5rem 1.5rem; width: 100%; }

.center-card {
	display: flex; flex-direction: column; align-items: center; padding: 3rem 1.5rem; text-align: center;
}
.center-card img.logo { height: 56px; width: auto; margin-bottom: 0.75rem; }
.center-card h1 { font-size: 1.7rem; margin: 0 0 0.4rem; font-weight: 600; color: var(--text); }
.center-card p.subtitle { color: var(--muted); margin-bottom: 2rem; max-width: 480px; }

.login-form { width: 100%; max-width: 320px; text-align: left; }
.login-form label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 1rem; }
.login-form input, .login-form select { display: block; width: 100%; margin-top: 4px; padding: 0.55rem 0.7rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.95rem; box-sizing: border-box; background: var(--card); color: var(--text); }

.alert-box { border-radius: 8px; padding: 0.9rem 1.1rem; margin-bottom: 1.5rem; font-size: 0.9rem; max-width: 480px; }
.alert-error { background: #fdf3f2; color: #b3261e; border: 1px solid #f0d0cd; }
.alert-warn { background: #fff8e1; color: #8a6100; border: 1px solid #f2dfa4; }
.alert-success { background: #eefaf0; color: #1e7e34; border: 1px solid #c7ecce; }
.content .alert-box, .content .alert-error, .content .alert-warn, .content .alert-success { max-width: 100%; }

.cards {
	display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; max-width: 1100px; width: 100%; margin: 0 auto 1.75rem;
}

/* AdminLTE "small-box" style stat/module cards, matching Home/Invoice/Payroll */
.stat-card {
	border-radius: 6px; position: relative; display: block; overflow: hidden;
	box-shadow: 0 1px 3px rgba(0,0,0,.15); color: #fff; text-decoration: none;
}
.stat-card.employees { background: #1c8fb0; }
.stat-card.projects { background: #2f8a02; }
.stat-card.accounting { background: #c98a1f; }
.stat-card.admin { background: #7e6fd9; }
.stat-card-inner { padding: 22px 22px 14px; position: relative; z-index: 2; }
.stat-card-inner h2 { margin: 0 0 6px; font-size: 1.2rem; color: #fff; }
.stat-card-inner .stat-number { font-size: 2rem; font-weight: 700; margin: 0 0 4px; color: #fff; }
.stat-card-inner p { margin: 0; color: rgba(255,255,255,.88); font-size: 0.88rem; line-height: 1.5; }
.stat-card-icon { position: absolute; top: -10px; right: 6px; opacity: .22; z-index: 1; line-height: 0; }
.stat-card-icon svg { width: 90px; height: 90px; }
.stat-card-footer {
	position: relative; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 6px;
	text-align: center; padding: 9px 0; margin: 0; color: rgba(255,255,255,.92); background: rgba(0,0,0,.12);
	text-decoration: none; font-size: 0.85rem; font-weight: 600; border: none; width: 100%; cursor: pointer; font-family: inherit;
}
.stat-card-footer svg { width: 13px; height: 13px; }
.stat-card-footer:hover { background: rgba(0,0,0,.2); color: #fff; }

.panel { background: var(--card); border-radius: 10px; box-shadow: var(--shadow); padding: 1.75rem; margin-bottom: 1.5rem; }
.panel h2 { margin-top: 0; font-size: 1.25rem; color: var(--text); }
.panel h2.h-sm { font-size: 1.05rem; }

.grid-2 { display: grid; grid-template-columns: minmax(260px, 380px) 1fr; gap: 1.5rem; align-items: start; }
.grid-2 > * { min-width: 0; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

table.rights-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.rights-table th, table.rights-table td { padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--border); text-align: left; color: var(--text); }
table.rights-table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }
table.rights-table td.center, table.rights-table th.center { text-align: center; }
.table-wrap { overflow-x: auto; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.pill.on { background: rgba(51,183,108,.15); color: #1e7e34; }
.pill.off { background: var(--bg); color: var(--muted); }
.pill.warn { background: rgba(202,138,31,.15); color: #8a6100; }
.pill.neutral { background: var(--bg); color: var(--muted); }

.form-row { display: flex; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: flex-end; }
.form-row label { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 4px; }
.form-row input[type=text], .form-row input[type=email], .form-row input[type=password],
.form-row input[type=date], .form-row input[type=number], .form-row select, .form-row textarea {
	padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; min-width: 200px;
	background: var(--card); color: var(--text); font-family: inherit; width: 100%;
}
.form-row textarea { min-height: 70px; resize: vertical; }
.form-stack { display: block; margin-bottom: 1rem; }
.form-stack label { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 4px; }
.form-stack input, .form-stack select, .form-stack textarea {
	width: 100%; padding: 0.55rem 0.7rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem;
	background: var(--card); color: var(--text); font-family: inherit;
}
.form-stack textarea { min-height: 80px; resize: vertical; }
.form-check { display: flex; align-items: center; gap: 8px; margin-bottom: 1rem; }
.form-check label { font-size: 0.9rem; color: var(--text); }

.btn-primary {
	background: #2b5cff; color: #fff; border: none; border-radius: 6px; padding: 0.55rem 1.1rem;
	font-size: 0.9rem; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; text-align: center;
}
.btn-primary:hover { background: #1e46d6; }
.btn-primary.full { width: 100%; }
.btn-secondary {
	background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 0.55rem 1.1rem;
	font-size: 0.9rem; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; text-align: center;
}
.btn-secondary:hover { background: var(--border); }
.btn-sm { padding: 0.32rem 0.7rem; font-size: 0.8rem; border-radius: 5px; }

.back-link { display: inline-block; margin-bottom: 1.25rem; font-size: 0.88rem; color: #2b5cff; text-decoration: none; }
.back-link:hover { text-decoration: underline; }

.empty-hint { color: var(--muted); font-size: 0.9rem; }

.list-simple { list-style: none; margin: 0; padding: 0; }
.list-simple li { padding: 0.65rem 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 0.9rem; }
.list-simple li:last-child { border-bottom: none; }
.list-simple .muted { color: var(--muted); font-size: 0.82rem; }

.module-link { display: block; padding: 0.85rem 0; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.module-link:last-child { border-bottom: none; }
.module-link .title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.module-link .title svg { width: 16px; height: 16px; color: var(--muted); }
.module-link .desc { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }

footer.page-footer { margin-top: 2rem; font-size: 0.78rem; color: var(--muted); text-align: center; }

/* Zoho-Books-style widgets: receivable/payable progress bars, chart panels,
   and the Books module's section tile grid. */
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.6rem; }
.panel-head h2 { margin: 0; }
.panel-link { font-size: 0.82rem; font-weight: 600; color: #2b5cff; text-decoration: none; }
.panel-link:hover { text-decoration: underline; }

.period-filter { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.period-filter select, .period-filter input[type=date] {
	padding: 0.35rem 0.5rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.82rem;
	background: var(--card); color: var(--text); font-family: inherit;
}
.period-custom-range { display: inline-flex; align-items: center; gap: 0.4rem; }

.big-figure-label { font-size: 0.85rem; color: var(--muted); margin-bottom: 2px; }
.big-figure { font-size: 1.8rem; font-weight: 700; color: var(--text); margin-bottom: 0.9rem; }

.progress-bar-track { height: 10px; border-radius: 999px; background: var(--bg); overflow: hidden; display: flex; margin-bottom: 0.7rem; }
.progress-bar-track .seg.current { background: #2b5cff; }
.progress-bar-track .seg.overdue { background: #e07a1f; }

.legend-row { display: flex; gap: 1.5rem; font-size: 0.82rem; flex-wrap: wrap; }
.legend-row .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.legend-row .dot.current { background: #2b5cff; }
.legend-row .dot.overdue { background: #e07a1f; }

.chart-wrap { position: relative; height: 240px; }
.chart-wrap.donut { height: 220px; }

.cashflow-figures { display: flex; flex-direction: column; gap: 1rem; padding-left: 0.5rem; }
.cashflow-figures .row .label { font-size: 0.8rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.cashflow-figures .row .value { font-size: 1.15rem; font-weight: 700; color: var(--text); }
.cashflow-figures .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.cashflow-figures .dot.start { background: #7e6fd9; }
.cashflow-figures .dot.in { background: #2f8a02; }
.cashflow-figures .dot.out { background: #b3261e; }
.cashflow-figures .dot.end { background: #2b5cff; }

.chart-legend { display: flex; flex-direction: column; gap: 0.55rem; font-size: 0.85rem; }
.chart-legend .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chart-legend .row .name { display: flex; align-items: center; gap: 8px; }
.chart-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

.tile-section { margin-bottom: 1.75rem; }
.tile-section h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 0 0 0.6rem; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.75rem; }
.tile {
	display: block; background: var(--card); border: 1px solid var(--border); border-radius: 8px;
	padding: 0.9rem 1rem; text-decoration: none; color: var(--text); box-shadow: var(--shadow);
}
.tile:hover { border-color: #2b5cff; }
.tile .tile-name { font-weight: 600; font-size: 0.92rem; }
.tile .tile-count { font-size: 1.3rem; font-weight: 700; margin-top: 4px; }
.tile.disabled { opacity: 0.55; pointer-events: none; }
.tile .tile-hint { font-size: 0.76rem; color: var(--muted); margin-top: 4px; }
