:root {
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-primary-soft: #eff4ff;
    --color-text: #1f2933;
    --color-text-muted: #6b7280;
    --color-border: #e2e5ea;
    --color-bg: #ffffff;
    --color-bg-soft: #f8f9fb;
    --color-danger: #dc2626;
    --color-danger-soft: #fef2f2;
    --color-success: #059669;
    --color-success-soft: #ecfdf5;
    --color-pending: #d97706;
    --color-pending-soft: #fffbeb;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
    --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font-sans);
    color: var(--color-text);
    background: var(--color-bg-soft);
    font-size: 16px;
    line-height: 1.5;
}
.widget { max-width: 480px; margin: 0 auto; padding: 2em 1.25em; }
.widget-wide { max-width: 720px; }

h1 { font-size: 1.5em; font-weight: 700; margin: 0 0 0.25em; letter-spacing: -0.01em; }
h2 { font-size: 1em; font-weight: 700; margin: 1.75em 0 0.85em; color: var(--color-text); }
.subtitle { color: var(--color-text-muted); margin: 0 0 1.75em; font-size: 0.95em; }

/* ── Cards / panels ── */
.panel {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    padding: 1.5em;
    margin-bottom: 1.25em;
}

/* ── Profile header (my-data) ── */
.profile-header { display: flex; align-items: flex-start; gap: 1.25em; }
.profile-avatar {
    width: 72px; height: 72px; border-radius: 50%; object-fit: cover;
    background: var(--color-bg-soft); border: 1px solid var(--color-border);
    flex-shrink: 0;
}
.profile-header-info { flex: 1; min-width: 0; }
.profile-name { font-size: 1.15em; font-weight: 700; margin: 0 0 0.5em; }
.profile-avatar-placeholder { display: flex; align-items: center; justify-content: center; color: var(--color-text-muted); }
.profile-avatar-placeholder svg { width: 38px; height: 38px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ── Accordion (registration modules, my-data modules) ── */
.module-accordion {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    margin-bottom: 0.75em;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.module-accordion summary {
    padding: 0.95em 1.1em;
    font-weight: 600;
    cursor: pointer;
    background: var(--color-bg);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.6em;
    user-select: none;
    transition: background 0.15s;
}
.module-accordion summary:hover { background: var(--color-bg-soft); }
.module-accordion summary::-webkit-details-marker { display: none; }
.module-accordion summary::marker { content: ''; }
.module-accordion summary::before {
    content: '';
    display: inline-block;
    width: 0.55em;
    height: 0.55em;
    border-right: 2px solid var(--color-text-muted);
    border-bottom: 2px solid var(--color-text-muted);
    transform: rotate(-45deg);
    transition: transform 0.2s;
    margin-right: 0.2em;
}
.module-accordion[open] summary::before { transform: rotate(45deg); }
.module-accordion-body { padding: 0.25em 1.1em 1.2em; border-top: 1px solid var(--color-border); }

/* ── Form fields ── */
.field { margin-bottom: 1.1em; }
.field label { display: block; font-weight: 600; font-size: 0.88em; margin-bottom: 0.35em; color: var(--color-text); }
.field .req { color: var(--color-danger); }
.field input[type], .field select {
    width: 100%; padding: 0.65em 0.8em; border: 1px solid var(--color-border);
    border-radius: 8px; font-size: 0.97em; font-family: inherit; background: var(--color-bg);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.field input[type]:focus, .field select:focus {
    outline: none; border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-soft);
}
.field input:invalid:not(:placeholder-shown) { border-color: var(--color-danger); }

/* ── Buttons ── */
.btn {
    display: inline-block; padding: 0.7em 1.3em; border-radius: 8px;
    font-weight: 600; font-size: 0.95em; border: 1px solid transparent; cursor: pointer;
    text-align: center; text-decoration: none; transition: all 0.15s; font-family: inherit;
}
.btn-block { display: block; width: 100%; }
.btn-primary { background: var(--color-primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--color-primary-dark); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-secondary { background: var(--color-bg-soft); color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: var(--color-border); }
.btn-sm { padding: 0.45em 0.9em; font-size: 0.85em; }
.btn-link { display: block; text-align: center; margin-top: 1.25em; color: var(--color-primary); text-decoration: none; font-size: 0.92em; font-weight: 500; }
.btn-link:hover { text-decoration: underline; }

/* ── Alerts ── */
.alert { padding: 0.8em 1.1em; border-radius: 8px; margin-bottom: 1.25em; font-size: 0.9em; }
.alert-error { background: var(--color-danger-soft); color: var(--color-danger); border: 1px solid #fecaca; }
.alert-success { background: var(--color-success-soft); color: var(--color-success); border: 1px solid #a7f3d0; }
.text-muted { color: var(--color-text-muted); font-size: 0.88em; }

/* ── My-data display rows ── */
.data-row { display: flex; align-items: center; gap: 0.6em; padding: 0.75em 0; border-bottom: 1px solid var(--color-border); font-size: 0.93em; }
.data-row:last-child { border-bottom: none; }
.data-row .k { color: var(--color-text-muted); font-weight: 500; flex: 1 1 auto; }
.data-row .v { font-weight: 500; }
.data-row .photo-preview { margin-left: auto; }

/* ── Field rows: <details> wraps row+form so form expands below the full row ── */
.field-row { border-bottom: 1px solid var(--color-border); }
.field-row:last-child { border-bottom: none; }
.field-row > summary.data-row { border-bottom: none; cursor: pointer; list-style: none; }
.field-row > summary.data-row::-webkit-details-marker { display: none; }
.field-row > summary.data-row::marker { content: ''; }
.field-row > summary.data-row:hover { background: var(--color-bg-soft); border-radius: 6px; }
.edit-icon { flex-shrink: 0; color: var(--color-text-muted); font-size: 0.85em; opacity: 0.45; transition: opacity 0.15s, color 0.15s; margin-left: auto; }
.field-row > summary.data-row:hover .edit-icon,
.field-row[open] > summary.data-row .edit-icon { opacity: 1; color: var(--color-primary); }
.field-edit-panel { padding: 0.9em 0.1em 1em; }
.field-edit-panel .field { margin-bottom: 0.85em; }

/* Profile photo upload toggle in the header */
.photo-edit-toggle > summary {
    display: inline-block; margin-top: 0.5em; font-size: 0.83em; font-weight: 500;
    color: var(--color-primary); cursor: pointer; list-style: none;
    text-decoration: underline; text-underline-offset: 2px;
}
.photo-edit-toggle > summary::-webkit-details-marker { display: none; }
.photo-edit-toggle > summary::marker { content: ''; }
.field-edit-panel-profile { padding: 0.75em 0 0; }

/* ── Status badges ── */
.status-badge {
    display: inline-flex; align-items: center; gap: 0.4em;
    padding: 0.25em 0.7em; border-radius: 999px; font-size: 0.78em; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.03em;
}
.status-pending  { background: var(--color-pending-soft);  color: var(--color-pending); }
.status-approved { background: var(--color-success-soft); color: var(--color-success); }
.status-rejected { background: var(--color-danger-soft);  color: var(--color-danger); }

.change-request-form .field { margin-bottom: 0.85em; }

/* ── My requests list: one compact line per request ── */
.request-item {
    display: flex; justify-content: space-between; align-items: center; gap: 0.75em;
    padding: 0.6em 0; border-bottom: 1px solid var(--color-border); font-size: 0.88em;
}
.request-item:last-child { border-bottom: none; }
.request-line {
    overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    flex: 1 1 auto; min-width: 0;
}
.request-line strong { font-weight: 600; }
.request-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 0.35em; flex-shrink: 0; }
.cancel-form { margin: 0; }
.btn-link-danger { display: inline; color: var(--color-error, #dc2626); font-size: 0.82em; background: none; border: none; padding: 0; cursor: pointer; text-decoration: underline; }
.btn-link-danger:hover { opacity: 0.75; }

/* ── Photo / signature ── */
.photo-upload { display: flex; align-items: center; gap: 1.1em; }
.photo-preview {
    width: 72px; height: 72px; border-radius: 50%; object-fit: cover;
    background: var(--color-bg-soft); border: 1px solid var(--color-border);
}
.signature-pad-wrap { border: 1px solid var(--color-border); border-radius: 8px; overflow: hidden; background: var(--color-bg); }
.signature-pad-wrap canvas { display: block; width: 100%; height: 150px; touch-action: none; cursor: crosshair; }
.signature-actions { display: flex; gap: 0.6em; margin-top: 0.6em; }

@media (max-width: 400px) {
    .widget, .widget-wide { padding: 1.5em 1em; }
}
