*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: Roboto, -apple-system, BlinkMacSystemFont, sans-serif; background: #f8f8f8; color: #494949; line-height: 1.5; }
a { color: #BC2E24; text-decoration: none; }
a:hover { text-decoration: underline; color: #8a1f17; }
img { max-width: 100%; height: auto; }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background-color: #e8e8e8; background-image: linear-gradient(45deg, #f0f0f0 25%, transparent 25%), linear-gradient(-45deg, #f0f0f0 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #f0f0f0 75%), linear-gradient(-45deg, transparent 75%, #f0f0f0 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; }
.login-container { background: #fff; padding: 48px 40px; width: 440px; max-width: 90vw; box-shadow: 0 4px 24px rgba(0,0,0,0.15); }
.login-logo { display: block; text-align: center; margin-bottom: 24px; }
.login-logo img { height: 50px; width: auto; }
.login-container h1 { font-size: 18px; font-weight: 500; margin-bottom: 24px; text-align: center; color: #333; }
.login-back { text-align: center; margin-top: 20px; font-size: 13px; }

/* Login Form - explicit styles for inputs */
.login-form input[type="email"],
.login-form input[type="password"],
.login-form input[type="text"] { width: 100%; padding: 14px 16px; border: 1px solid #d0d0d0; font-size: 16px; background: #fff; font-family: inherit; color: #333; line-height: 1.4; box-sizing: border-box; display: block; }
.login-form input[type="email"]:focus,
.login-form input[type="password"]:focus,
.login-form input[type="text"]:focus { outline: none; border-color: #BC2E24; box-shadow: inset 0 0 0 1px #BC2E24; }
.login-form input[type="email"]:hover,
.login-form input[type="password"]:hover,
.login-form input[type="text"]:hover { border-color: #bbb; }

/* Form */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 8px; font-size: 14px; color: #696161; }
input.form-control, textarea.form-control, select.form-control { width: 100%; padding: 14px 16px; border: 1px solid #d0d0d0; font-size: 16px; transition: border-color .2s, box-shadow .2s; background: #fff; font-family: inherit; color: #333; line-height: 1.4; box-sizing: border-box; display: block; }
input.form-control:focus, textarea.form-control:focus, select.form-control:focus { outline: none; border-color: #BC2E24; box-shadow: inset 0 0 0 1px #BC2E24; }
input.form-control:hover, textarea.form-control:hover, select.form-control:hover { border-color: #bbb; }
.form-control::placeholder { color: #aaa; }
.form-control:disabled { background: #f8f8f8; color: #898d94; cursor: not-allowed; }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { appearance: auto; }
.form-row { display: flex; gap: 16px; margin-bottom: 0; }
.form-row .form-group { flex: 1; }
.input-group { display: flex; gap: 8px; }
.input-group .form-control { flex: 1; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 14px 24px; border: none; border-radius: 0; font-size: 16px; font-weight: 500; cursor: pointer; transition: all .2s; text-decoration: none; font-family: inherit; }
.btn-primary { background: #BC2E24; color: #fff; }
.btn-primary:hover { background: #a3261e; text-decoration: none; }
.btn-primary:active { background: #8a1f17; }
.btn-secondary { background: #f8f8f8; color: #494949; border: 1px solid #dadada; }
.btn-secondary:hover { background: #e8e8e8; text-decoration: none; }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Alerts */
.alert { padding: 12px 16px; margin-bottom: 16px; font-size: 14px; border-left: 4px solid; }
.alert-error { background: #fff0f0; color: #BC2E24; border-color: #BC2E24; }
.alert-info { background: #f0f5ff; color: #4854a2; border-color: #4854a2; }
.alert-success { background: #f0faf0; color: #2e7d32; border-color: #2e7d32; }

/* Nav */
.topnav { background: #fff; color: #494949; box-shadow: 0 1px 3px rgba(0,0,0,0.12); position: sticky; top: 0; z-index: 100; }
.topnav-inner { display: flex; align-items: center; gap: 16px; max-width: 1400px; margin: 0 auto; height: 52px; padding: 0 16px; }
.topnav-logo { display: flex; align-items: center; flex-shrink: 0; }
.topnav-logo img { height: 34px; width: auto; display: block; }
.topnav-user { margin-left: auto; font-size: 13px; color: #898d94; }
.topnav .btn { background: #BC2E24; color: #fff; border-radius: 0; padding: 6px 16px; font-size: 12px; }
.topnav .btn:hover { background: #8a1f17; }

/* Layout */
.container { max-width: 1400px; margin: 24px auto; padding: 0 16px; }
.dashboard-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.dashboard-header h2 { font-size: 20px; font-weight: 500; color: #333; }

/* Panel */
.panel { background: #fff; padding: 24px; margin-bottom: 24px; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.panel h3 { font-size: 16px; font-weight: 500; margin-bottom: 16px; color: #333; }
.panel h4 { font-size: 14px; font-weight: 500; margin: 16px 0 8px; color: #696161; }
.panel .form-row { margin-bottom: 12px; }

/* Checkbox group */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 8px 0 16px; }
.checkbox-group label { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; color: #494949; }
.checkbox-group input[type="checkbox"] { width: 16px; height: 16px; accent-color: #BC2E24; }

/* Table */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: 13px; }
.table th { background: #f8f8f8; font-weight: 500; color: #494949; font-size: 12px; letter-spacing: .3px; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafafa; }
.table input, .table textarea { width: 100%; }

/* Row states */
.row-filled { background: #f0faf0 !important; }
.row-expired { background: #fff0f0 !important; }
.row-expired:hover, .row-filled:hover { filter: brightness(0.97); }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; font-size: 11px; font-weight: 500; letter-spacing: .3px; }
.badge-draft { background: #f8f8f8; color: #898d94; }
.badge-sent { background: #e8f0fe; color: #4854a2; }
.badge-filled { background: #e6f4ea; color: #2e7d32; }
.badge-expired { background: #fce8e6; color: #BC2E24; }

/* Send link */
.send-link-url { font-family: monospace; font-size: 18px; background: #f8f8f8; padding: 12px 16px; word-break: break-all; margin-bottom: 16px; border: 1px solid #dadada; }

/* Modal */
.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); }
.modal-content { position: relative; background: #fff; max-width: 800px; width: 90vw; max-height: 85vh; overflow-y: auto; box-shadow: 0 4px 24px rgba(0,0,0,0.2); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid #f0f0f0; }
.modal-header h3 { font-size: 18px; font-weight: 500; margin: 0; color: #333; }
.modal-close { background: none; border: none; font-size: 28px; cursor: pointer; color: #898d94; padding: 0; line-height: 1; }
.modal-close:hover { color: #333; }
.modal-body { padding: 24px; }
.modal-body dt { font-weight: 500; color: #696161; font-size: 13px; margin-top: 12px; }
.modal-body dd { margin: 4px 0 0 0; font-size: 14px; line-height: 1.6; }
.modal-body dd:empty::after { content: '—'; color: #dadada; }

/* Survey page */
.survey-container { max-width: 1000px; margin: 40px auto; padding: 0 20px; }
.survey-container h1 { font-size: 24px; font-weight: 500; margin-bottom: 32px; color: #333; }
.survey-container h2 { font-size: 17px; font-weight: 500; margin: 32px 0 16px; padding-bottom: 8px; border-bottom: 2px solid #f0f0f0; color: #BC2E24; }
.survey-container label { font-size: 14px; }
.survey-container .btn-primary { background: #BC2E24; }
.survey-container .btn-primary:hover { background: #8a1f17; }

/* Dadata suggestions */
.dadata-suggestions { position: absolute; z-index: 200; background: #fff; border: 1px solid #d0d0d0; border-top: none; max-height: 300px; overflow-y: auto; width: 100%; box-sizing: border-box; display: none; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.dadata-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
.dadata-item:hover { background: #f8f8f8; }
.dadata-item strong { display: block; color: #333; }
.dadata-item span { display: block; color: #898d94; font-size: 12px; margin-top: 2px; }

.form-group { position: relative; }

@media (max-width: 768px) {
    .form-row { flex-direction: column; gap: 0; }
    .dashboard-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .topnav-inner { font-size: 13px; gap: 8px; }
}
