:root {
	--bg: #f4f6f9;
	--surface: #ffffff;
	--border: #e1e6ec;
	--border-strong: #c8d0d9;
	--text: #1a202c;
	--muted: #6b7280;
	--primary: #2563eb;
	--primary-hover: #1d4ed8;
	--primary-soft: #eff6ff;
	--danger: #dc2626;
	--danger-hover: #b91c1c;
	--danger-soft: #fef2f2;
	--success: #059669;
	--success-soft: #f0fdf4;
	--warn: #d97706;
	--radius: 8px;
	--radius-sm: 6px;
	--shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
	--shadow-lg: 0 4px 12px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	background: var(--bg);
	color: var(--text);
	line-height: 1.5;
	font-size: 14px;
}

/* Header / nav ------------------------------------------------------------ */

header {
	background: var(--surface);
	border-bottom: 1px solid var(--border);
	box-shadow: var(--shadow);
	position: sticky;
	top: 0;
	z-index: 10;
}

header nav {
	max-width: 1280px;
	margin: 0 auto;
	padding: 12px 20px;
	display: flex;
	gap: 4px;
	align-items: center;
	flex-wrap: wrap;
}

header nav a {
	text-decoration: none;
	color: var(--text);
	padding: 8px 14px;
	border-radius: var(--radius-sm);
	font-weight: 500;
	transition: background .12s, color .12s;
}

header nav a:hover {
	background: var(--bg);
	color: var(--primary);
}

/* Main layout ------------------------------------------------------------- */

main {
	max-width: 1280px;
	margin: 0 auto;
	padding: 20px;
}

h1 {
	margin: 8px 0 16px;
	font-size: 1.6rem;
	font-weight: 600;
	letter-spacing: -.01em;
}

h2 { margin: 20px 0 12px; font-size: 1.2rem; font-weight: 600; }
h3 { margin: 16px 0 8px; font-size: 1rem; font-weight: 600; }

/* Cards ------------------------------------------------------------------- */

.card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 16px;
	margin: 12px 0;
	box-shadow: var(--shadow);
}

.card.card-info { background: var(--primary-soft); border-color: #dbe7fa; }
.card.card-muted { background: #f8fafc; }

/* Two-column layout inside the "Новое напоминание" card:
   form on the left, test-send sidebar on the right. */
.form-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
	gap: 20px;
	align-items: start;
}

.form-main, .form-sidebar { min-width: 0; }

/* Used in the right (sidebar) column as a heading that visually matches
   a <label> in the left column — so both columns line up at the top. */
.field-label {
	font-size: 13px;
	font-weight: 500;
	color: var(--text);
	margin: 0 0 4px;
}

@media (max-width: 900px) {
	.form-layout { grid-template-columns: 1fr; }
}

/* Responsive grid --------------------------------------------------------- */

.grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 12px;
}

.grid-2 {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 16px;
}

/* Form controls ---------------------------------------------------------- */

label {
	display: block;
	font-size: 13px;
	font-weight: 500;
	color: var(--text);
	margin: 8px 0 4px;
}

label.inline {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-weight: normal;
	margin: 0;
	cursor: pointer;
	padding: 6px 12px;
	border-radius: var(--radius-sm);
	background: var(--bg);
	border: 1px solid var(--border);
}

label.inline:hover { background: #eef2f7; }

label.inline input[type=radio]:checked + span,
label.inline:has(input[type=radio]:checked) {
	background: var(--primary-soft);
	border-color: var(--primary);
	color: var(--primary);
}

input[type=text], input[type=number], input[type=time],
input[type=datetime-local], input[type=search], input[type=password],
input[type=email], input[type=url], textarea, select {
	width: 100%;
	padding: 8px 12px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	font-family: inherit;
	font-size: 14px;
	background: #fff;
	color: var(--text);
	transition: border-color .12s, box-shadow .12s;
}

input[type=checkbox], input[type=radio] {
	width: auto;
	margin: 0;
	accent-color: var(--primary);
	cursor: pointer;
}

input:focus, textarea:focus, select:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

textarea { resize: vertical; min-height: 60px; font-family: inherit; }

/* Buttons ---------------------------------------------------------------- */

button, .btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	background: var(--primary);
	color: #fff;
	border: none;
	border-radius: var(--radius-sm);
	padding: 8px 14px;
	cursor: pointer;
	font-family: inherit;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.2;
	white-space: nowrap;
	transition: background .12s, transform .04s;
}

button:hover, .btn:hover { background: var(--primary-hover); }
button:active, .btn:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }

.btn-block { width: 100%; }
.btn-icon  { padding: 6px 10px; font-size: 14px; }
.btn-sm    { padding: 4px 10px; font-size: 13px; }

.btn-secondary {
	background: var(--surface);
	color: var(--text);
	border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--bg); color: var(--primary); }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: var(--danger-hover); }

.btn-ghost {
	background: transparent;
	color: var(--muted);
	padding: 4px 8px;
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

/* Tables ------------------------------------------------------------------ */

.table-wrap {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
}

table {
	width: 100%;
	border-collapse: collapse;
	background: var(--surface);
	min-width: 720px;
}

th, td {
	padding: 10px 14px;
	text-align: left;
	border-bottom: 1px solid var(--border);
	vertical-align: top;
}

th {
	background: #f8fafc;
	font-weight: 600;
	font-size: 12px;
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: .04em;
	white-space: nowrap;
}

tbody tr { transition: background .08s; }
tbody tr:hover { background: #fafbfc; }
tbody tr:last-child td { border-bottom: none; }

td code {
	font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
	font-size: 12px;
	background: var(--bg);
	padding: 2px 6px;
	border-radius: 4px;
}

/* Action button group inside table cells */
.actions {
	display: inline-flex;
	gap: 4px;
	flex-wrap: nowrap;
	align-items: center;
}

.actions form {
	margin: 0;
	display: inline-flex;
}

/* Tabs -------------------------------------------------------------------- */

.tabs {
	display: flex;
	gap: 4px;
	flex-wrap: wrap;
	align-items: center;
	margin: 16px 0 8px;
}

.tabs-and-search {
	display: flex;
	gap: 12px;
	align-items: center;
	flex-wrap: wrap;
	margin: 16px 0 8px;
	justify-content: space-between;
}

.tab {
	padding: 8px 14px;
	border-radius: var(--radius-sm);
	text-decoration: none;
	background: var(--surface);
	color: var(--primary);
	border: 1px solid var(--border-strong);
	font-size: 14px;
	font-weight: 500;
	transition: background .12s, color .12s;
}

.tab:hover { background: var(--primary-soft); }

.tab.active {
	background: var(--primary);
	color: #fff;
	border-color: var(--primary);
}

.tab .badge {
	opacity: .7;
	font-size: 12px;
	margin-left: 2px;
}

/* Search bar in tabs row */
.search-bar {
	display: inline-flex;
	gap: 4px;
	align-items: center;
}

.search-bar input { width: 240px; }

/* Filter bar (history page) */
.filter-bar {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) auto;
	gap: 12px;
	align-items: end;
}

.filter-bar label { margin: 0; }

/* Status badges ----------------------------------------------------------- */

.status-sent {
	color: var(--success);
	font-weight: 600;
	white-space: nowrap;
}

.status-failed {
	color: var(--danger);
	font-weight: 600;
	white-space: nowrap;
}

.row-completed { opacity: .55; background: #f8fafc; }
.row-failed { background: var(--danger-soft); }

/* Pagination -------------------------------------------------------------- */

.pagination {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 16px;
	margin-top: 20px;
	padding: 12px;
	color: var(--muted);
}

.pagination a {
	color: var(--primary);
	text-decoration: none;
	padding: 4px 10px;
	border-radius: 4px;
}

.pagination a:hover { background: var(--primary-soft); }

.pagination .disabled { color: #cbd5e1; }

/* Misc ------------------------------------------------------------------- */

.muted { color: var(--muted); font-size: 12px; }
.spacer { flex: 1; }

a { color: var(--primary); }
a:hover { text-decoration: underline; }

ul.compact { margin: 4px 0; padding-left: 20px; }

/* Landing page ----------------------------------------------------------- */

.landing-hero {
	text-align: center;
	padding: 64px 16px 48px;
	background:
		radial-gradient(ellipse at top, rgba(37, 99, 235, .10), transparent 60%),
		linear-gradient(180deg, var(--surface), var(--bg));
	border-radius: var(--radius);
	margin-bottom: 32px;
}

.landing-hero h1 {
	font-size: clamp(28px, 5vw, 44px);
	line-height: 1.15;
	margin: 0 0 16px;
	letter-spacing: -.02em;
}

.hero-accent {
	background: linear-gradient(90deg, var(--primary), #8b5cf6);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.hero-sub {
	max-width: 640px;
	margin: 0 auto 24px;
	font-size: 16px;
	color: var(--muted);
}

.hero-cta {
	display: flex;
	justify-content: center;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 20px;
}

.hero-cta .btn { padding: 12px 24px; font-size: 15px; }

.hero-bullets {
	display: flex;
	justify-content: center;
	gap: 20px;
	flex-wrap: wrap;
	font-size: 13px;
}

.landing-features, .landing-steps, .landing-faq {
	padding: 32px 0;
}

.landing-features h2, .landing-steps h2, .landing-faq h2 {
	text-align: center;
	font-size: 24px;
	margin: 0 0 24px;
}

.feature-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
	gap: 16px;
}

.feature-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 20px;
	box-shadow: var(--shadow);
	transition: transform .12s, box-shadow .12s;
}

.feature-card:hover {
	transform: translateY(-2px);
	box-shadow: var(--shadow-lg);
}

.feature-icon {
	font-size: 28px;
	margin-bottom: 8px;
}

.feature-card h3 {
	margin: 0 0 6px;
	font-size: 16px;
}

.feature-card p {
	margin: 0;
	color: var(--muted);
	font-size: 14px;
	line-height: 1.5;
}

.steps-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 16px;
}

.step-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 20px;
	text-align: center;
	box-shadow: var(--shadow);
	position: relative;
}

.step-num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	background: var(--primary);
	color: #fff;
	border-radius: 50%;
	font-weight: 700;
	margin-bottom: 12px;
}

.step-card h3 {
	margin: 0 0 6px;
	font-size: 16px;
}

.step-card p {
	margin: 0;
	color: var(--muted);
	font-size: 14px;
}

.faq-item {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 12px 16px;
	margin-bottom: 8px;
	box-shadow: var(--shadow);
}

.faq-item summary {
	cursor: pointer;
	font-weight: 500;
	padding: 4px 0;
	list-style: none;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::before {
	content: "▸ ";
	color: var(--primary);
	display: inline-block;
	width: 16px;
	transition: transform .12s;
}

.faq-item[open] summary::before { content: "▾ "; }

.faq-item p {
	margin: 8px 0 0;
	color: var(--muted);
	font-size: 14px;
	line-height: 1.6;
	padding-left: 16px;
}

.landing-footer {
	text-align: center;
	padding: 32px 16px;
	margin-top: 32px;
	border-top: 1px solid var(--border);
	font-size: 13px;
}

.landing-footer a { color: var(--primary); }

/* Mobile ----------------------------------------------------------------- */

@media (max-width: 720px) {
	main { padding: 12px; }
	header nav { padding: 10px 12px; gap: 2px; }
	header nav a { padding: 6px 10px; font-size: 13px; }
	h1 { font-size: 1.35rem; }
	.search-bar input { width: 160px; }
	.filter-bar { grid-template-columns: 1fr; }
	.tabs-and-search { flex-direction: column; align-items: stretch; }
	.search-bar { width: 100%; }
	.search-bar input { flex: 1; width: auto; }
}
