* {
	box-sizing: border-box;
	margin: 0;
	padding: 0
}

body {
	font-family: Arial, sans-serif;
	background: #fff9e8;
	color: #4a432f
}

button {
	font-family: inherit;
	cursor: pointer
}

.app {
	display: flex;
	min-height: 100vh
}

.sidebar {
	width: 230px;
	min-height: 100vh;
	background: #f3df9b;
	padding: 25px 15px;
	border-right: 1px solid #e2ca7d
}

.sidebar-title {
	font-size: 18px;
	font-weight: 700;
	margin-bottom: 20px;
	padding-left: 5px;
	color: #5b4d2d
}

.points-list {
	display: flex;
	flex-direction: column;
	gap: 10px
}

.point {
	width: 100%;
	padding: 15px;
	border: none;
	border-radius: 8px;
	background: #fff4c9;
	color: #5b4d2d;
	font-size: 15px;
	text-align: left;
	transition: .2s
}

.point:hover {
	background: #ffe9a3
}

.point.active {
	background: #e7c75f;
	color: #3f351c;
	font-weight: 700
}

.main {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	padding: 20px
}

.top-panel {
	display: grid;
	grid-template-columns: 1.2fr 1fr 1fr 2fr;
	gap: 15px;
	padding: 20px;
	background: #fffdf4;
	border: 1px solid #eadcae;
	border-radius: 12px;
	box-shadow: 0 2px 8px rgba(100, 80, 20, .06)
}

.company-info {
	display: flex;
	flex-direction: column;
	justify-content: center
}

.company-name {
	font-size: 22px;
	font-weight: 700;
	color: #4b3e20
}

.company-subtitle {
	margin-top: 5px;
	font-size: 13px;
	color: #8b7b52
}

.user-info {
	display: flex;
	flex-direction: column;
	justify-content: center;
	border-left: 1px solid #eadcae;
	padding-left: 20px
}

.user-name {
	font-size: 16px;
	font-weight: 600
}

.user-phone {
	margin-top: 5px;
	font-size: 13px;
	color: #8b7b52
}

.date-info {
	display: flex;
	flex-direction: column;
	justify-content: center;
	border-left: 1px solid #eadcae;
	padding-left: 20px
}

.date-label {
	font-size: 12px;
	color: #9a895c
}

.date {
	margin-top: 5px;
	font-size: 16px;
	font-weight: 600
}

.activity-info {
	display: flex;
	flex-direction: column;
	justify-content: center;
	background: #fff7d8;
	padding: 12px 15px;
	border-radius: 8px
}

.activity-label {
	font-size: 12px;
	font-weight: 700;
	color: #8b7339;
	margin-bottom: 5px
}

.activity-text {
	font-size: 14px;
	line-height: 1.4;
	color: #5d5135
}

.tabs {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 10px;
	margin-top: 20px
}

.tab {
	padding: 15px;
	border: 1px solid #e4d293;
	border-radius: 8px;
	background: #f9edbd;
	color: #625532;
	font-size: 15px;
	font-weight: 600;
	transition: .2s
}

.tab:hover {
	background: #f2dfa0
}

.tab.active {
	background: #e3c65c;
	border-color: #d4b43e;
	color: #403516
}

.content {
	flex: 1;
	margin-top: 15px;
	min-height: 500px;
	background: #fffdf7;
	border: 1px solid #eadcae;
	border-radius: 12px;
	padding: 25px
}

.content-placeholder {
	height: 100%;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	color: #a49367
}

.content-placeholder h1 {
	font-size: 24px;
	margin-bottom: 10px
}

.content-placeholder p {
	font-size: 14px
}

@media(max-width:1000px) {
	.top-panel {
		grid-template-columns: 1fr 1fr
	}

	.activity-info {
		grid-column: span 2
	}
}

@media(max-width:700px) {
	.sidebar {
		width: 180px
	}

	.main {
		padding: 10px
	}

	.top-panel {
		grid-template-columns: 1fr
	}

	.activity-info {
		grid-column: span 1
	}

	.user-info,
	.date-info {
		border-left: none;
		border-top: 1px solid #eadcae;
		padding-left: 0;
		padding-top: 15px
	}
}

/* Скрытие вкладок и точек */
.tab.invisible,
.point.invisible {
	display: none;
}

/* Информация о роли пользователя в нижней части боковой панели */
.sidebar {
	display: flex;
	flex-direction: column;
}

.sidebar-user {
	margin-top: auto;
	padding: 15px 10px 5px;
	border-top: 1px solid #e2ca7d;
}

.sidebar-user-label {
	font-size: 12px;
	color: #8b7b52;
	margin-bottom: 5px;
}

.sidebar-user-role {
	font-size: 16px;
	font-weight: 700;
	color: #4b3e20;
}

/* company-info теперь является кнопкой */
.company-info {
	width: 100%;
	border: none;
	background: transparent;
	padding: 0;
	text-align: left;
	cursor: pointer;
	font-family: inherit;
	transition: .2s;
}

.company-info:hover {
	opacity: .75;
}

.company-info:focus-visible {
	outline: 2px solid #d4b43e;
	outline-offset: 4px;
	border-radius: 6px;
}


/* Новая компоновка: деятельность находится в левой боковой панели */
.sidebar-user {
	margin-top: 24px;
	padding: 16px 10px 0;
	border-top: 1px solid #d9bd63;
}

.sidebar-activity {
	margin-top: 18px;
	padding: 13px 12px;
	background: #fff1b8;
	border: 1px solid #e4c75f;
	border-radius: 10px;
	box-shadow: 0 3px 10px rgba(122, 92, 15, .08);
}

.sidebar-activity-label {
	font-size: 12px;
	font-weight: 700;
	color: #795b0c;
	margin-bottom: 6px;
}

.sidebar-activity-text {
	font-size: 13px;
	line-height: 1.4;
	color: #4d421f;
}

/* Кнопка выбора месяца на месте даты */
.month-selector {
	width: 100%;
	border: 1px solid #e0c45d;
	border-radius: 10px;
	background: #fff2b9;
	padding: 12px 16px;
	text-align: left;
	cursor: pointer;
	font-family: inherit;
	transition: .2s ease;
}

.month-selector:hover {
	background: #ffe58a;
	border-color: #d5ae2f;
	transform: translateY(-1px);
}

.month-selector:focus-visible {
	outline: 2px solid #c49b16;
	outline-offset: 3px;
}

.month-selector .date-label {
	color: #806315;
}

.month-selector .date {
	color: #443713;
}

/* Модальное окно выбора месяца и года */
body.modal-open {
	overflow: hidden;
}

.modal-overlay {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(47, 38, 10, .58);
	opacity: 0;
	visibility: hidden;
	transition: opacity .2s ease, visibility .2s ease;
}

.modal-overlay.is-open {
	opacity: 1;
	visibility: visible;
}

.month-modal {
	width: min(390px, 100%);
	padding: 22px;
	border-radius: 16px;
	background: #fffdf4;
	border: 1px solid #e0c45d;
	box-shadow: 0 18px 60px rgba(50, 40, 10, .28);
	transform: translateY(8px) scale(.98);
	transition: transform .2s ease;
}

.modal-overlay.is-open .month-modal {
	transform: translateY(0) scale(1);
}

.month-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 15px;
	margin-bottom: 20px;
}

.month-modal-header h2 {
	font-size: 20px;
	color: #443713;
}

.modal-close {
	width: 34px;
	height: 34px;
	border: none;
	border-radius: 8px;
	background: #fff0b0;
	color: #5a4810;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
}

.modal-close:hover {
	background: #ffe184;
}

.month-controls {
	display: grid;
	grid-template-columns: 1.5fr 1fr;
	gap: 12px;
	margin-bottom: 18px;
}

.month-controls label {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.month-controls label span {
	font-size: 12px;
	font-weight: 700;
	color: #806315;
}

.month-controls select {
	width: 100%;
	padding: 11px 12px;
	border: 1px solid #ddc15a;
	border-radius: 8px;
	background: #fff8d8;
	color: #443713;
	font: inherit;
}

.month-apply {
	width: 100%;
	padding: 12px;
	border: none;
	border-radius: 9px;
	background: #e5bd38;
	color: #3f3210;
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	transition: .2s ease;
}

.month-apply:hover {
	background: #d9ad22;
	transform: translateY(-1px);
}

/* Чуть более яркая палитра */
body {
	background: #fff7d6;
	color: #403817;
}

.sidebar {
	background: #f6d96f;
	border-right-color: #d8b63e;
}

.point {
	background: #fff0ad;
	color: #4c3d14;
}

.point:hover {
	background: #ffe184;
}

.point.active {
	background: #e4bd3d;
	color: #3b2e0d;
}

.top-panel {
	background: #fffef8;
	border-color: #e2c75f;
}

.tabs .tab {
	background: #ffefaa;
	border-color: #dfc157;
	color: #514212;
}

.tabs .tab:hover {
	background: #ffe181;
}

.tabs .tab.active {
	background: #e4bd3d;
	border-color: #cfa82b;
	color: #3b2e0d;
}

.content {
	background: #fffef8;
	border-color: #e2c75f;
}

@media(max-width:700px) {
	.sidebar-user {
		margin-top: 24px;
	}

	.sidebar-activity {
		font-size: 12px;
	}

	.month-controls {
		grid-template-columns: 1fr;
	}
}

/* уведомления */
.toast-box {
    position: fixed; top: 20px; right: 20px; z-index: 1000;
    display: flex; flex-direction: column; gap: 8px;
}
.toast {
    padding: 12px 18px; border-radius: 10px; font-size: 14px;
    background: #333; color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.2);
    transition: opacity .4s, transform .4s;
}
.toast-ok { background: #2e7d32; }
.toast-error { background: #c62828; }
.toast-info { background: #444; }
.toast-hide { opacity: 0; transform: translateX(20px); }

/* состояния */
.state-message {
    padding: 32px; text-align: center; color: #888; font-size: 15px;
}
.state-error { color: #c62828; }

/* выход */
.logout-btn {
    margin-top: 6px; padding: 4px 12px; font-size: 12px;
    border: 1px solid currentColor; background: transparent;
    border-radius: 6px; cursor: pointer; color: inherit;
}

/* карточки итогов */
.report-totals, .analytics-cards {
    display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px;
}
.total-card, .analytics-card {
    flex: 1 1 140px; padding: 14px 16px; border-radius: 12px;
    background: rgba(0,0,0,.04);
}
.total-label, .analytics-label { font-size: 12px; opacity: .7; }
.total-value, .analytics-value { font-size: 20px; font-weight: 600; margin-top: 4px; }
.total-accent .total-value, .analytics-card.positive .analytics-value { color: #2e7d32; }
.analytics-card.negative .analytics-value { color: #c62828; }

/* строки таблиц */
.row-debt td { background: rgba(255, 193, 7, .12); }
.row-closed { opacity: .65; }
.row-weekend .day-number { color: #c62828; }
.day-weekday { display: block; font-size: 11px; opacity: .6; }

/* календарь */
.work-day.mine { outline: 2px solid #f9a825; }
.work-day.done { opacity: .6; }
.work-day.today { box-shadow: 0 0 0 3px rgba(46,125,50,.4); }

/* график */
.bar-chart {
    display: flex; align-items: flex-end; gap: 4px; height: 180px;
    padding: 12px; background: rgba(0,0,0,.03); border-radius: 12px;
}
.bar-column { flex: 1; display: flex; flex-direction: column;
              align-items: center; height: 100%; justify-content: flex-end; }
.bar { width: 100%; background: #f9a825; border-radius: 4px 4px 0 0; }
.bar-label { font-size: 10px; margin-top: 4px; opacity: .6; }

.hidden { display: none; }

.btn-primary, .btn-danger, .btn-small {
    padding: 9px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: .2s;
}

.btn-primary { background: #29a9d6; color: #fff; }
.btn-primary:hover { background: #197ca3; }
.btn-danger { background: #e05656; color: #fff; }
.btn-danger:hover { background: #c33f3f; }
.btn-small {
    padding: 7px 14px;
    font-size: 13px;
    background: #e5f3f9;
    color: #197ca3;
}
.btn-small:hover { background: #cfe9f4; }
.btn-small.btn-danger { background: #fbe4e4; color: #c33f3f; }
.btn-small.btn-danger:hover { background: #f6cfcf; }
.btn-primary:disabled, .btn-small:disabled { opacity: .5; cursor: default; }

/* ==========================================================
   Общие компоненты: формы, строки списков, таблицы отчётов.
   Живут здесь, а не в CSS вкладок, потому что loadCSS держит
   только один тег page-css и файл вкладки заменяет предыдущий.
   ========================================================== */

.settings-form {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid #b9dce9;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 3px 10px rgba(45, 100, 120, .08);
}

.settings-form input,
.settings-form select,
.settings-form textarea,
.settings-row input,
.settings-row select {
    padding: 9px 13px;
    border: 1px solid #cfe3ed;
    border-radius: 8px;
    font-size: 14px;
    color: #1d3545;
    background: #fff;
    outline: none;
}

.settings-form input:focus,
.settings-form select:focus,
.settings-row input:focus,
.settings-row select:focus { border-color: #29a9d6; }

.settings-form input[type="search"] { flex: 1; min-width: 220px; }
.settings-form .field-group input,
.settings-form .field-group select { width: 100%; box-sizing: border-box; }
.settings-form .field-group.grow input,
.settings-form .field-group.grow select { min-width: 0; }

.compact { padding: 7px 10px !important; font-size: 13px !important; }
.compact-num { max-width: 150px; }

.field-group { display: flex; flex-direction: column; gap: 4px; }
.field-group.grow { flex: 1; min-width: 200px; }

.field-label {
    font-size: 11px;
    font-weight: 600;
    color: #5d7b8c;
    letter-spacing: .2px;
    white-space: nowrap;
}

.field-aligned { align-self: flex-end; }

.settings-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    padding: 14px 16px;
    margin-bottom: 10px;
    border: 1px solid #b9dce9;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 3px 10px rgba(45, 100, 120, .06);
}

.settings-row.inactive { opacity: .55; }

.row-main { flex: 1 1 200px; min-width: 0; align-self: center; }
.row-title { font-weight: 600; color: #1d3545; font-size: 15px; }
.row-meta { font-size: 12px; color: #5d7b8c; margin-top: 3px; }

.settings-actions { display: flex; justify-content: flex-end; padding-top: 6px; }

.report-section-title {
    margin-bottom: 12px;
    font-size: 18px;
    font-weight: 700;
    color: #24495c;
}

.report-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #b9dce9;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 3px 10px rgba(45, 100, 120, .08);
}

.report-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.report-table thead { background: #29a9d6; }
.report-table th {
    padding: 13px 15px;
    color: #fff;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}
.report-table td {
    padding: 11px 15px;
    border-top: 1px solid #e6eef3;
    color: #1d3545;
}
.report-table tbody tr:hover td { background: #f7fcfe; }

/* мелочи, которых не хватало */
.day-status { font-size: 12px; color: #5d7b8c; }
.auth-message { text-align: center; padding: 20px 0; }
.auth-message h3 { margin: 0 0 12px; color: #1d3545; }
.auth-hint { font-size: 13px; opacity: .7; margin-top: 12px; }
