/* ---------------------------------------------------------------------------
   Application form
   --------------------------------------------------------------------------- */

:root {
    --bg: #f0efe9;
    --card: #ffffff;
    --border: #dadce0;
    --accent: #1a73e8;
    --accent-dark: #1557b0;
    --text: #202124;
    --muted: #5f6368;
    --danger: #d93025;
    --success: #188038;
    --radius: 8px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    padding: 24px 12px 64px;
    background: var(--bg);
    color: var(--text);
    font: 400 15px/1.5 Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

.wrap {
    max-width: 640px;
    margin: 0 auto;
}

.page-title {
    margin: 0 0 20px;
    padding: 22px 24px;
    background: var(--card);
    border: 1px solid var(--border);
    border-top: 8px solid var(--accent);
    border-radius: var(--radius);
    font-size: 28px;
    font-weight: 400;
    line-height: 1.25;
}

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

.card {
    position: relative;
    margin-bottom: 12px;
    padding: 22px 24px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.card.invalid { border-color: var(--danger); }

.label {
    display: block;
    font-size: 16px;
    color: var(--text);
    line-height: 1.4;
}

.req {
    margin-left: 4px;
    color: var(--danger);
}

.help {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--muted);
}

/* --- Text inputs ---------------------------------------------------------- */

input[type="text"],
input[type="email"],
input[type="tel"],
textarea {
    display: block;
    width: 100%;
    margin-top: 18px;
    padding: 4px 0 8px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    color: var(--text);
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}

textarea {
    resize: vertical;
    min-height: 44px;
    line-height: 1.6;
}

input::placeholder,
textarea::placeholder { color: #9aa0a6; }

input:focus,
textarea:focus {
    outline: none;
    border-bottom: 2px solid var(--accent);
    padding-bottom: 7px;
}

.card.invalid input,
.card.invalid textarea { border-bottom-color: var(--danger); }

/* --- File fields ---------------------------------------------------------- */

.drop {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
    padding: 10px;
    border: 1px dashed transparent;
    border-radius: var(--radius);
    transition: background .15s, border-color .15s;
}

.drop.dragging {
    background: #e8f0fe;
    border-color: var(--accent);
}

.file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
}

.btn-file {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--card);
    color: var(--accent);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.btn-file:hover { background: #f6f9fe; border-color: #c6dafc; }

/* Keyboard focus lands on the hidden input; style its visible label. */
.file-input:focus-visible + .btn-file {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.drop-hint {
    font-size: 13px;
    color: var(--muted);
}

.file-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 8px 12px;
    background: #f1f3f4;
    border-radius: 999px;
    font-size: 13px;
}

.chip-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60%;
}

.chip-size {
    color: var(--muted);
    margin-right: auto;
}

.chip-remove {
    flex: none;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #d7dadd;
    color: #3c4043;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.chip-remove:hover { background: #c4c7ca; }

/* --- Errors and alerts ----------------------------------------------------- */

.error {
    margin: 8px 0 0;
    color: var(--danger);
    font-size: 13px;
    min-height: 0;
}

.error:empty { display: none; }

.alert {
    margin-bottom: 16px;
    padding: 14px 18px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    font-size: 14px;
}

.alert-error {
    border-left: 4px solid var(--danger);
    color: #8c1d16;
}

.alert-success {
    border-left: 4px solid var(--success);
    color: #0d652d;
}

/* --- Actions --------------------------------------------------------------- */

.actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
}

.btn-submit {
    padding: 10px 26px;
    border: 0;
    border-radius: 4px;
    background: var(--accent);
    color: #fff;
    font: 500 15px/1 inherit;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, box-shadow .15s;
}

.btn-submit:hover { background: var(--accent-dark); box-shadow: 0 1px 3px rgba(60,64,67,.3); }

.btn-submit:disabled {
    background: #a6c8f5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-clear {
    border: 0;
    background: none;
    color: var(--accent);
    font: 500 14px/1 inherit;
    font-family: inherit;
    cursor: pointer;
    padding: 8px;
}

.btn-clear:hover { text-decoration: underline; }

/* --- Progress -------------------------------------------------------------- */

.progress {
    margin-top: 16px;
    height: 4px;
    background: #dadce0;
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0;
    background: var(--accent);
    transition: width .2s ease;
}

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

.hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.footnote {
    margin: 24px 0 0;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
}

@media (max-width: 480px) {
    body { padding: 12px 8px 48px; }
    .page-title { font-size: 22px; padding: 18px; }
    .card { padding: 18px; }
    .chip-name { max-width: 45%; }
}

/* --- Admin panel ----------------------------------------------------------- */

.admin-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.admin-wrap { max-width: 1100px; margin: 0 auto; }

.table-scroll {
    overflow-x: auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

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

table.data th {
    background: #f8f9fa;
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
}

table.data tr:last-child td { border-bottom: 0; }

table.data td.info {
    max-width: 320px;
    white-space: pre-wrap;
    word-break: break-word;
}

.file-links { min-width: 260px; }

.no-files { color: var(--muted); }

/* Each attachment is one pill split in two: the label previews the file, the
   arrow forces a download. */
.file-pill {
    display: inline-flex;
    align-items: stretch;
    margin: 0 6px 5px 0;
    background: #e8f0fe;
    border-radius: 999px;
    overflow: hidden;
    vertical-align: top;
}

.file-pill a {
    display: inline-flex;
    align-items: center;
    color: var(--accent);
    font-size: 12px;
    text-decoration: none;
    transition: background .15s;
}

.pill-view {
    padding: 3px 8px 3px 11px;
    white-space: nowrap;
}

.pill-dl {
    padding: 3px 9px 3px 7px;
    border-left: 1px solid rgba(26, 115, 232, .25);
}

.file-pill a:hover { background: #c6dafc; }

.pill-view:focus-visible,
.pill-dl:focus-visible,
.btn-zip:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.btn-zip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0 6px 5px 0;
    padding: 4px 12px;
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: var(--card);
    color: var(--accent);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, color .15s;
}

.btn-zip:hover {
    background: var(--accent);
    color: #fff;
}

.pager {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

.pager a, .pager span {
    padding: 8px 16px;
    border-radius: 4px;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
}

.pager span { color: var(--muted); }

.login-card {
    max-width: 380px;
    margin: 10vh auto 0;
}

.login-card .btn-submit { width: 100%; margin-top: 20px; }
