:root {
    --bg-dark: #0f172a;
    --card-bg: #1e293b;
    --input-bg: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --brand-red: #ef4444;
    --border: #334155;
    font-size: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    padding: 1rem;
    padding-bottom: 5rem;
}

.header {
    text-align: center;
    padding: 1rem 0 1.5rem;
}

.logo-text {
    font-size: 1.4rem;
    font-weight: 800;
}

.logo-text .accent {
    color: var(--brand-red);
}

.client-logo {
    max-height: 3.2rem;
    max-width: 80%;
    display: block;
    margin: 0 auto 0.4rem;
}

.powered-by {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 0.03em;
}

.powered-by .accent {
    color: var(--brand-red);
    font-weight: 700;
}

.wrap {
    max-width: 34rem;
    margin: 0 auto;
}

/* Registro */
.register-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    padding: 2rem 1.5rem;
    margin-top: 2rem;
    text-align: center;
}

.register-card h1 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.register-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* Inputs genéricos */
.field {
    margin-bottom: 1.2rem;
    text-align: left;
}

.field label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.field .required {
    color: var(--brand-red);
}

.field input[type="text"],
.field input[type="number"],
.field input[type="date"],
.field input[type="time"],
.field select,
.field textarea,
.field input[type="file"] {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.7rem 0.8rem;
    border-radius: 0.4rem;
    font-size: 1rem;
}

.field textarea {
    min-height: 5rem;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--brand-red);
}

.textarea-wrap {
    position: relative;
}

.file-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.file-preview {
    display: none;
    max-width: 100%;
    max-height: 12rem;
    border-radius: 0.4rem;
    border: 1px solid var(--border);
    object-fit: cover;
}

/* Campo calculado (ej. tiempo trabajado) */
.duration-display {
    background-color: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    padding: 0.7rem 0.8rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Checkbox que descuenta tiempo (ej. pausa, comida) */
.field-checkbox {
    margin-bottom: 0.8rem;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.95rem;
}

.checkbox-row input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    accent-color: var(--brand-red);
    flex-shrink: 0;
}

.checkbox-badge {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.1rem 0.5rem;
    border-radius: 1rem;
    margin-right: 0.3rem;
}

/* Lista de nombres (ej. compañeros de trabajo) */
.tags-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.tag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 0.25rem 0.5rem 0.25rem 0.7rem;
    font-size: 0.85rem;
}

.tag-chip button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
}

.tag-chip button:hover {
    color: var(--brand-red);
}

.tags-input-row {
    display: flex;
    gap: 0.5rem;
}

.tags-input-row input {
    flex: 1;
    min-width: 0;
    background-color: var(--input-bg);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.7rem 0.8rem;
    border-radius: 0.4rem;
    font-size: 1rem;
}

.tags-input-row .tag-add-btn {
    flex: none;
    width: auto;
    padding: 0.7rem 1rem;
    white-space: nowrap;
}

.mic-btn {
    position: absolute;
    right: 0.5rem;
    bottom: 0.5rem;
    background: var(--brand-red);
    border: none;
    color: #fff;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.mic-btn.recording {
    background: #dc2626;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Botones */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background-color: var(--brand-red);
    color: #fff;
    border: none;
    font-weight: 700;
    font-size: 1rem;
    padding: 0.85rem;
    border-radius: 0.4rem;
    cursor: pointer;
    width: 100%;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.btn:hover {
    background-color: #dc2626;
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn.secondary {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.btn.secondary:hover {
    background: var(--card-bg);
    transform: none;
}

/* Pestañas */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.2rem;
}

.tab-btn {
    flex: 1;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.7rem;
    border-radius: 0.4rem;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
}

.tab-btn.active {
    color: var(--text-main);
    border-color: var(--brand-red);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Resumen del periodo */
.period-summary {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    padding: 1rem 1.2rem;
    margin-bottom: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.period-summary .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.period-summary .value {
    font-size: 1.5rem;
    font-weight: 800;
}

/* Tarjetas de entrada */
.entry-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    padding: 1rem 1.2rem;
    margin-bottom: 0.8rem;
}

.entry-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.entry-card-title {
    font-weight: 700;
}

.entry-card-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem 0.4rem;
}

.icon-btn:hover {
    color: var(--text-main);
}

.entry-card-row {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}

.entry-card-row strong {
    color: var(--text-main);
    font-weight: 600;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2.5rem 1rem;
    font-size: 0.9rem;
}

/* Botón flotante agregar */
.fab {
    position: fixed;
    bottom: 1.2rem;
    left: 50%;
    transform: translateX(-50%);
    max-width: 34rem;
    width: calc(100% - 2rem);
    z-index: 20;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 50;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.open {
    display: flex;
}

.modal-sheet {
    background: var(--bg-dark);
    border-top: 1px solid var(--border);
    border-radius: 1rem 1rem 0 0;
    width: 100%;
    max-width: 34rem;
    max-height: 88vh;
    overflow-y: auto;
    padding: 1.5rem;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* Firma */
.signature-pad {
    width: 100%;
    height: 8rem;
    background-color: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    touch-action: none;
    cursor: crosshair;
}

.signature-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.4rem;
}

.signature-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-decoration: underline;
    cursor: pointer;
}

.status-msg {
    margin-top: 1rem;
    font-size: 0.9rem;
    text-align: center;
}

.status-msg.error {
    color: var(--brand-red);
}

.status-msg.ok {
    color: #4ade80;
}

.sent-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    color: #4ade80;
    border: 1px solid #4ade80;
    padding: 0.1rem 0.5rem;
    border-radius: 1rem;
    margin-left: 0.5rem;
}

.translated-tag {
    display: inline-block;
    font-size: 0.65rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 0.1rem 0.4rem;
    border-radius: 1rem;
    margin-left: 0.4rem;
}
